After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 628936 - gtk build fails because of objective-c elements
gtk build fails because of objective-c elements
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
2.90.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
: 642085 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-07 03:27 UTC by John Ralls
Modified: 2012-03-02 19:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Rearrange Makefile.am to hide objective-c from g-ir-scanner (1.85 KB, patch)
2010-09-07 03:27 UTC, John Ralls
none Details | Review
Lower-impact, more correct rearrangement (1.78 KB, patch)
2010-09-07 17:09 UTC, John Ralls
none Details | Review
Reduced patch: Only changes compiler flags (1.08 KB, patch)
2010-11-21 15:56 UTC, John Ralls
none Details | Review
Minimal patch updated to apply to master of 11Sep2011 (1.57 KB, patch)
2011-09-12 16:44 UTC, John Ralls
committed Details | Review

Description John Ralls 2010-09-07 03:27:22 UTC
Created attachment 169644 [details] [review]
Rearrange Makefile.am to hide objective-c from g-ir-scanner

G-ir-scanner doesn't like objective-c, but gtk/Makefile.am passes a gcc option (-xobjective-c) and files (gtkquartz.c and gtksearchenginequartz.c)containing objective-c to it.

Attached patch rearranges Makefile.am slightly to hide the option and files from g-ir-scanner.
Comment 1 Christian Persch 2010-09-07 13:57:54 UTC
IMHO the correct fix is to replace $(gtk_all_c_sources) with $(gtk_c_sources) in the introspection_files variable, instead.
Comment 2 John Ralls 2010-09-07 17:09:45 UTC
Created attachment 169689 [details] [review]
Lower-impact, more correct rearrangement

Using gtk_c_sources would actually defeat part of the change, which is to hide gtksearchenginequartz.c and gtkquartz.c from the scanner. gtk_c_sources includes those when building for quartz. 

This new patch doesn't move gtk_clipboard_dnd_c_sources out of gtk_basic_c_sources. Instead, it moves gtkquartz.c from gtk_clipboard_dnd_c_sources to gtk_use_quartz_c_sources so that it isn't added to gtk_all_c_sources.

If it's indeed unnecessary to submit all of the "use_platform" sources (except for gtksearchenginequartz.c and gtkquartz.c) to the scanner, then one should define a new variable gtk_introspection_c_sources and take the "stub" sources out of gtk_use_quartz_c_sources. When building quartz gtk_c_sources would include gtk_quartz_c_sources and gtk_introspection_c_sources would not. That would require testing on all three platforms.
Comment 3 Christian Persch 2010-09-07 17:16:31 UTC
Well, the change in comment 1 is enough to fix this for non-osx (since all_c_sources includes the osx sources also on non-osx). Fixing it for osx itself does indeed need more changes.
Comment 4 John Ralls 2010-09-07 19:02:50 UTC
No, look again: gtk_all_c_sources does *not* include quartz sources, no matter what platform it's building for (even quartz). Maybe it should, but it doesn't.

So I don't think that there's a problem to fix on non-OSX builds.
Comment 5 Kristian Rietveld 2010-11-20 22:03:08 UTC
(In reply to comment #2)
> Created an attachment (id=169689) [details] [review]
> Lower-impact, more correct rearrangement
> 
> Using gtk_c_sources would actually defeat part of the change, which is to hide
> gtksearchenginequartz.c and gtkquartz.c from the scanner. gtk_c_sources
> includes those when building for quartz. 
> 
> This new patch doesn't move gtk_clipboard_dnd_c_sources out of
> gtk_basic_c_sources. Instead, it moves gtkquartz.c from
> gtk_clipboard_dnd_c_sources to gtk_use_quartz_c_sources so that it isn't added
> to gtk_all_c_sources.

Aren't gtkclipboard-quartz.c and gtkdnd-quartz.c still passed to the IR scanner now?   Both contain objective-C, so the scanner will still break?
Comment 6 John Ralls 2010-11-20 22:22:53 UTC
Yes, they are, but the scanner doesn't break, it just whines about the "@" which introduces strings:
gtk/gtkclipboard-quartz.c:80: unexpected character `@'

See bug 626995.
Comment 7 Kristian Rietveld 2010-11-21 10:09:17 UTC
So the scanner breaks for gtkquartz.c and gtksearchenginequartz.c, and it does not break for gtkclipboard-quartz.c and gtkdnd-quartz.c?  I don't really get that, because I don't see gtkclipboard-quartz.c and gtkdnd-quartz.c use "less" Objective-C than gtksearchenginequartz.c ...
Comment 8 John Ralls 2010-11-21 15:56:36 UTC
Created attachment 174965 [details] [review]
Reduced patch: Only changes compiler flags

You're right, and I don't at this point remember why I made the distinction. If you prefer, this patch only changes the compiler flag.
Comment 9 John Ralls 2011-09-12 16:44:08 UTC
Created attachment 196281 [details] [review]
Minimal patch updated to apply to master of 11Sep2011
Comment 10 Kristian Rietveld 2011-09-17 06:59:04 UTC
(In reply to comment #9)
> Created an attachment (id=196281) [details] [review]
> Minimal patch updated to apply to master of 11Sep2011

One possible disadvantage of this approach is that all files are now compiled with -xobjective-c turned on.  If we would introduce objective-C code in generic GTK+ C sources by accident, then the compiler wouldn't notice for us.  (The Linux people would though :).

I don't have problems with having -xobjective-c turned on for the entire build and would be fine with this going in.



Matthias: could you comment here as well, since it does in theory touch non-quartz parts of Makefile.am ?
Comment 11 Emmanuele Bassi (:ebassi) 2011-09-17 09:12:48 UTC
in Clutter I enabled -xobjective-c when building on OS X — though that was a necessity since Clutter uses a non-recursive layout — and never had any issue.
Comment 12 John Ralls 2011-09-17 21:09:17 UTC
(In reply to comment #10)
> One possible disadvantage of this approach is that all files are now compiled
> with -xobjective-c turned on.  If we would introduce objective-C code in
> generic GTK+ C sources by accident, then the compiler wouldn't notice for us. 
> (The Linux people would though :).

That's true now, because ${gtk_clipboard_dnd_c_sources_CFLAGS} gets added to AM_CPPFLAGS. (gtk_use_quartz_CFLAGS is a no-op.) AFAIK, there are only per-target CFLAGS in Automake, not per-source. I think that the only way to have -xobjective-c turned on for only those files which need it (and BTW gtkselection.c is one of them) would be to break them out into a separate convenience library and then link that back in to libgtk. Do you guys really want to go that route?
Comment 13 Kristian Rietveld 2011-09-30 06:38:13 UTC
Comment on attachment 196281 [details] [review]
Minimal patch updated to apply to master of 11Sep2011

Let's commit it, seems ebassi has positive experiences with this.
Comment 14 John Ralls 2011-10-05 00:39:00 UTC
Comment on attachment 196281 [details] [review]
Minimal patch updated to apply to master of 11Sep2011

Pushed onto gtk-2-24, gtk-3-2, and master.
Comment 15 John Ralls 2012-03-02 19:40:23 UTC
*** Bug 642085 has been marked as a duplicate of this bug. ***