Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#49391 closed defect (fixed)

gtk3 3.18 +quartz variant does not build on Mac OS X 10.6.8, Snow Leopard, "error: expected ‘)’ before ‘instancetype’"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: dbevans (David B. Evans), su-v, elelay (Eric Le Lay)
Port: gtk3

Description

/bin/sh ../../libtool  --tag=CC   --mode=compile /usr/bin/llvm-gcc-4.2 -arch x86_64 -DHAVE_CONFIG_H -I. -I../..  -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk  -DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS -DGLIB_MIN_REQUIRED_VERSION=GLIB_VERSION_2_44 -DGLIB_MAX_ALLOWED_VERSION=GLIB_VERSION_2_46 -D_REENTRANT -DMESA_EGL_NO_X11_HEADERS -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/cairo -I/opt/local/include/gio-unix-2.0/ -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include   "-xobjective-c" -I/opt/local/include -DX_LOCALE  -pipe -Os -fstrict-aliasing -arch x86_64 -Wall -MT gdkevents-quartz.lo -MD -MP -MF .deps/gdkevents-quartz.Tpo -c -o gdkevents-quartz.lo gdkevents-quartz.c
libtool: compile:  /usr/bin/llvm-gcc-4.2 -arch x86_64 -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS -DGLIB_MIN_REQUIRED_VERSION=GLIB_VERSION_2_44 -DGLIB_MAX_ALLOWED_VERSION=GLIB_VERSION_2_46 -D_REENTRANT -DMESA_EGL_NO_X11_HEADERS -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/cairo -I/opt/local/include/gio-unix-2.0/ -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -xobjective-c -I/opt/local/include -DX_LOCALE -pipe -Os -fstrict-aliasing -arch x86_64 -Wall -MT gdkevents-quartz.lo -MD -MP -MF .deps/gdkevents-quartz.Tpo -c gdkevents-quartz.c  -fno-common -DPIC -o .libs/gdkevents-quartz.o
gdkdevice-core-quartz.c: In function ‘gdk_quartz_device_core_get_state’:
gdkdevice-core-quartz.c:133: warning: ‘gdk_window_get_pointer’ is deprecated (declared at ../../gdk/gdkwindow.h:851)
gdkdisplaymanager-quartz.c: In function ‘gdk_quartz_display_manager_class_init’:
gdkdisplaymanager-quartz.c:58: warning: unused variable ‘manager_class’
gdkcursor-quartz.c: In function ‘-[gdkCoreCursor _coreCursorType]’:
gdkcursor-quartz.c:299: warning: ‘NSCursor’ may not respond to ‘-_coreCursorType’
gdkcursor-quartz.c:299: warning: (Messages without a matching method signature
gdkcursor-quartz.c:299: warning: will be assumed to return ‘id’ and accept
gdkcursor-quartz.c:299: warning: ‘...’ as arguments.)
gdkcursor-quartz.c:299: warning: return makes integer from pointer without a cast
gdkcursor-quartz.c: At top level:
gdkcursor-quartz.c:313: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:314: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:320: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:321: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:322: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:325: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:326: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:327: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:328: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:329: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:330: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:331: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:332: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:333: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:334: error: expected ‘)’ before ‘instancetype’
gdkcursor-quartz.c:335: error: expected ‘)’ before ‘instancetype’
…
make[4]: *** [gdkcursor-quartz.lo] Error 1

The build without +quartz succeeds.

Attachments (3)

main.log (156.1 KB) - added by ballapete (Peter "Pete" Dyballa) 9 years ago.
main.log
gdk_quartz_gdkcursor-quartz-10_6-compat.diff (4.7 KB) - added by elelay (Eric Le Lay) 9 years ago.
patch expanding macro, replacing instancetype with id, checking if cursor is supported
03_gdk_quarz_gdkcursor-quartz-10_6_compat.diff (453 bytes) - added by elelay (Eric Le Lay) 8 years ago.
part 3. of original patch: don't set an unsupported cursor

Download all attachments as: .zip

Change History (18)

Changed 9 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

main.log

comment:1 Changed 9 years ago by mf2k (Frank Schima)

Cc: cal@… removed
Owner: changed from macports-tickets@… to cal@…

Changed 9 years ago by elelay (Eric Le Lay)

patch expanding macro, replacing instancetype with id, checking if cursor is supported

comment:2 Changed 9 years ago by elelay (Eric Le Lay)

Here is a patch for gdkcursor-quartz.c:

  1. the compiler on 10.6 doesn't support instancetype so I replaced it with id;
  2. it also doesn't support this macro definition so I expanded it manually
  3. some cursors are not available on 10.6, so I added a check for respondsToSelector before calling performSelector

With 1. and 2. gtk3 +quartz compiles on 10.6

With 3. it doesn't crash when one runs the gtk3-demo Cursors demo.

It only makes sense to apply the patch on 10.6.

comment:3 Changed 8 years ago by p.ohanlon@…

This problem also affects OSX Lion 10.7.5 but elelay's patch fixes it.

comment:4 Changed 8 years ago by dbevans (David B. Evans)

Thanks to all for their input on this issue to date.

Since this is an Objective C compiler issue, I'm thinking that it would be best to categorize the issue by Xcode/compiler version rather than OS version. I'm trying to track down just when instancetype was introduced to Objective C. The earliest that I can find is Xcode 5 and/or clang 3.3. This is consistent with the reported failures on 10.7 and previous and implies that 10.8 using Xcode 4.6.3 and earlier might fail as well.

Since there is benefit in using instancetype, I'm wondering if it might be better to blacklist compilers that do not support it rather than doing the instancetype parts of the patch. The gtk3-demo issue is something different.

I'd propose using

PortGroup           compiler_blacklist_versions 1.0
compiler.blacklist  *gcc* {clang < 500}

I'm not in a position to test this but would appreciate it if those who are seeing this problem (both on 10.6 and 10.7) would try using this instead of all but the last hunk of the patch and report their findings.

Thanks again for your help.

comment:5 Changed 8 years ago by su-v

AFAICT blacklisting clang from Lion's Xcode is not necessary (gtk3 3.18.5 +quartz compiled here ok (OS X 10.7.5, Xcode 4.6.3, without the patch for 10.6.8 provided by elelay), and the gtk3-demo does not crash either) [*].

[*] Oddly (at least unexpectedly to me), the cursors seem to work even better with the Quartz backend compared to the X11-backend which supports fewer than the Quartz backend (in gtk3-demo), and only if patched with the latest commits from the git branch (committed right after the 3.18.5 tag).

Last edited 8 years ago by su-v (previous) (diff)

comment:6 Changed 8 years ago by su-v

Cc: suv-sf@… added

Cc Me!

comment:7 in reply to:  5 Changed 8 years ago by su-v

Replying to suv-sf@…:

[*] Oddly (at least unexpectedly to me), the cursors seem to work even better with the Quartz backend compared to the X11-backend which supports fewer than the Quartz backend (in gtk3-demo), and only if patched with the latest commits from the git branch (committed right after the 3.18.5 tag).

Clarification: this was tested (with either backend) on a MBP 13-inch, Late 2011 with just the built-in trackpad and no external mouse attached - gtk3 3.18.5 as is apparently fails to properly detect an input source (core pointer) on such a system.

comment:8 in reply to:  5 ; Changed 8 years ago by dbevans (David B. Evans)

Replying to suv-sf@…:

AFAICT blacklisting clang from Lion's Xcode is not necessary (gtk3 3.18.5 +quartz compiled here ok (OS X 10.7.5, Xcode 4.6.3, without the patch for 10.6.8 provided by elelay), and the gtk3-demo does not crash either) [*].

Which compiler is selected when you do this?

comment:9 in reply to:  8 Changed 8 years ago by su-v

Replying to devans@…:

Replying to suv-sf@…:

AFAICT blacklisting clang from Lion's Xcode is not necessary (gtk3 3.18.5 +quartz compiled here ok (OS X 10.7.5, Xcode 4.6.3, without the patch for 10.6.8 provided by elelay), and the gtk3-demo does not crash either) [*].

Which compiler is selected when you do this?

$ clang --version
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)

comment:10 in reply to:  3 Changed 8 years ago by dbevans (David B. Evans)

Replying to p.ohanlon@…:

This problem also affects OSX Lion 10.7.5 but elelay's patch fixes it.

Can you let us know which compiler is selected for your build? See comment:9 .

comment:11 Changed 8 years ago by dbevans (David B. Evans)

Cc: elelay@… added
Owner: changed from cal@… to devans@…
Status: newassigned

Based on results to date (suv-sf) I'm proposing to revise my suggested blacklisting to

PortGroup           compiler_blacklist_versions 1.0
compiler.blacklist  *gcc* {clang < 425}

This assumes that Xcode 4.6 or later will build correctly but nothing earlier. elelay, p.ohanlon, please test to see if this is a suitable replacement for the attached patch on your platforms. Thanks.

Last edited 8 years ago by dbevans (David B. Evans) (previous) (diff)

comment:12 in reply to:  11 Changed 8 years ago by elelay (Eric Le Lay)

Replying to devans@…:

This assumes that Xcode 4.6 or later will build correctly but nothing earlier. elelay, p.ohanlon, please test to see if this is a suitable replacement for the attached patch on your platforms. Thanks.

building with

$ /opt/local/bin/clang-mp-3.4  --version 
clang version 3.4.2 (tags/RELEASE_34/dot2-final) 
Target: x86_64-apple-darwin10.8.0 
Thread model: posix 

works fine. The cursors crash in gtk3-demo is still there, as expected. Corrected by attached patch.

Changed 8 years ago by elelay (Eric Le Lay)

part 3. of original patch: don't set an unsupported cursor

comment:13 Changed 8 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: assignedclosed

Tentative fix committed in r142846. Applies compiler blacklisting for +quartz builds only (per sl buildbot, gtk3 +x11 builds without it on 10.6) and applies elelay's cursor patch for +quartz build on 10.6 or earlier.

This should fix the problems reported here but please test and reopen if issues remain, particularly as previously reported on 10.7.

Thanks to all involved for their help in identifying and fixing this issue.

comment:14 in reply to:  13 Changed 8 years ago by elelay (Eric Le Lay)

Replying to devans@…:

This should fix the problems reported here but please test and reopen if issues remain, particularly as previously reported on 10.7.

Builds and runs fine here on 10.6.

Thanks!

comment:15 Changed 8 years ago by dbevans (David B. Evans)

And thanks for the feedback. Glad it's working for you.

Note: See TracTickets for help on using tickets.