GNOME Bugzilla – Bug 727366
gtkapplication-quartz-menu.c fails to compile
Last modified: 2019-02-22 05:14:18 UTC
Compiling gtk+-3.12.0 on an Mavericks with minimum-version=10.6 against 10.6 SDK. Got the following stopper: gtkapplication-quartz-menu.c:265:46: warning: instance method '-backingScaleFactor' not found (return type defaults to 'id') [-Wobjc-method-access] scale = roundf ([[NSScreen mainScreen] backingScaleFactor]); ^~~~~~~~~~~~~~~~~~ /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSScreen.h:16:12: note: receiver is instance of class declared here @interface NSScreen : NSObject { ^ gtkapplication-quartz-menu.c:265:23: error: passing 'id' to parameter of incompatible type 'float' scale = roundf ([[NSScreen mainScreen] backingScaleFactor]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Developer/SDKs/MacOSX10.6.sdk/usr/include/architecture/i386/math.h:382:29: note: passing argument to parameter here extern float roundf ( float ); ^ 1 warning and 1 error generated. make[4]: *** [libgtk_3_la-gtkapplication-quartz-menu.lo] Error 1 make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
What version of Xcode are you using?
I build from the command line. I have the latest Xcode installed but don't use it. I point my build to /Developer/SDks (see above). gcc is 4.2.1 Hope that helps. Thanks, Partha
Also, I am not sure why the bug report is attached to gtk-mac-integration?
(In reply to comment #3) > Also, I am not sure why the bug report is attached to gtk-mac-integration? I misread the "gtkapplication" as "gtkosxapplication" (In reply to comment #2) > I build from the command line. I have the latest Xcode installed but don't use > it. I point my build to /Developer/SDks (see above). gcc is 4.2.1 Where did /Developer/SDKs and gcc 4.2.1 come from? They're not standard issue on Mavericks.
The SDKs are left over from Snow-Leopard and also because I try to build Gimp et al that is compatible with Snow Leopard and above. OK, you got me on the 4.2.1 issue. :) gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix
That's why I asked which version of Xcode. Unless you build your own compiler, the compiler tracks the Xcode version. I haven't tried anything with 5.1, never mind SDK 10.6. I usually use either Xcode-3.2 or 4.1 and SDK 10.5 (which I know doesn't work well with LLVM) for backwards compatibility. You can get both from the Apple Developer site. You don't need to have a paid account for access, a free one will work fine. None of which says anything about the validity of your bug; I just need to nail down how you got there to avoid a lot of flailing trying to reproduce it.
Thanks for your comments John. Just as Fyi - I have both accounts with Apple. I have built all the dependencies for Gimp for some time now with the above compiler. gtk+ 2.24.23, glib etc. build just fine within my setup. You can get my version of Gimp (McGimp) from my website. Previously, I also tried to build 3.11.5 with Xcode 3.2.1 under Snow Leopard ( I have it installed on an external USB drive) and it's the same issue as above. The last version that built correctly was 3.11.2 since gtkapplication-quartz-menu.c didn't exist then.
This also occurs on 10.6 with Xcode 3.2.6: https://trac.macports.org/ticket/43283. I guess a configure check needs to be added?
As shown above and in the referenced MacPorts ticket, the problem is that the backingScaleFactor method is not available for OS X 10.6 -- it was introduced in 10.7. Something like this should work: #ifdef __APPLE__ #include <Availability.h> #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 code for 10.6 and earlier #else existing code for 10.7 and later #endif #endif
Created attachment 276584 [details] [review] patchfile This patch enables compilation with the 10.6 SDK, and if running on 10.7 it properly gets the backingScaleFactor property. If running on 10.6 or below, scale is set to 1.
Gtk-mac-integration no longer supports ancient versions of MacOS X, so this is obsolete.