Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#67977 closed defect (fixed)

gtk4: build fails with gcc, due to use of '-export_dynamic'

Reported by: barracuda156 Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: gtk4

Description

:info:build FAILED: testsuite/gtk/builder 
:info:build /opt/local/bin/gcc-mp-12  -o testsuite/gtk/builder testsuite/gtk/builder.p/builder.c.o -L/opt/local/lib -I/opt/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error -Wl,-headerpad_max_install_names -lMacportsLegacySupport -arch ppc -pipe -Os -arch ppc -Wl,-rpath,@loader_path/../../gtk gtk/libgtk-4.1.dylib -Wl,-export_dynamic /opt/local/lib/libgmodule-2.0.dylib /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libgobject-2.0.dylib /opt/local/lib/libgio-2.0.dylib /opt/local/lib/libpangocairo-1.0.dylib /opt/local/lib/libpango-1.0.dylib /opt/local/lib/libharfbuzz.dylib /opt/local/lib/libcairo.dylib /opt/local/lib/libfribidi.dylib /opt/local/lib/libcairo-gobject.dylib /opt/local/lib/libfontconfig.dylib /opt/local/lib/libfreetype.dylib /opt/local/lib/libgdk_pixbuf-2.0.dylib /opt/local/lib/libepoxy.dylib -lm /opt/local/lib/libgraphene-1.0.dylib /opt/local/lib/libXi.dylib /opt/local/lib/libX11.dylib /opt/local/lib/libpangoft2-1.0.dylib -lintl /opt/local/lib/libpng16.dylib /opt/local/lib/libtiff.dylib /opt/local/lib/libjpeg.dylib /opt/local/lib/libXrender.dylib /opt/local/lib/libXext.dylib /opt/local/lib/libXcursor.dylib /opt/local/lib/libXdamage.dylib /opt/local/lib/libXfixes.dylib /opt/local/lib/libXrandr.dylib /opt/local/lib/libXinerama.dylib -lcairo-script-interpreter
:info:build ld: unknown option: -export_dynamic
:info:build collect2: error: ld returned 1 exit status

Attachments (1)

gtk4_10.6_main.log (2.3 MB) - added by barracuda156 9 months ago.

Change History (14)

comment:1 Changed 9 months ago by mascguy (Christopher Nielsen)

-export_dynamic isn't Linux-specific. From the man page for ld:

-export_dynamic
    Preserves all global symbols in main executables during LTO. Without this option, Link Time Optimization is allowed to inline
    and remove global functions. This option is used when a main executable may load a plug-in which requires certain symbols from
    the main executable.

However, a quick Google search suggests that it's not necessarily supported with GCC.

Just as importantly, gtk4 doesn't build for macOS 10.6 and earlier. And to answer the obvious question: No, we don't have an ETA, relative to supporting 10.6.

https://ports.macports.org/port/gtk4/details/

comment:2 Changed 9 months ago by mascguy (Christopher Nielsen)

Resolution: invalid
Status: assignedclosed

comment:3 in reply to:  1 Changed 9 months ago by barracuda156

Replying to mascguy:

-export_dynamic isn't Linux-specific. From the man page for ld:

-export_dynamic
    Preserves all global symbols in main executables during LTO. Without this option, Link Time Optimization is allowed to inline
    and remove global functions. This option is used when a main executable may load a plug-in which requires certain symbols from
    the main executable.

However, a quick Google search suggests that it's not necessarily supported with GCC.

Just as importantly, gtk4 doesn't build for macOS 10.6 and earlier. And to answer the obvious question: No, we don't have an ETA, relative to supporting 10.6.

https://ports.macports.org/port/gtk4/details/

Given the stage of the build it failed for me, it might succeed once the wrong flag removed or replaced with an appropriate one.

Why isn’t it building on Intel? There are no logs in details.

comment:4 Changed 9 months ago by barracuda156

P.S. I don’t really get why this is invalid. This looks like a genuine bug unrelated to OS version.

comment:5 Changed 9 months ago by mascguy (Christopher Nielsen)

Resolution: invalid
Status: closedreopened
Summary: gtk4 uses Linux flags on Mac which breaks the buildgtk4: build fails with gcc, due to use of '-export_dynamic'

Well, the implication that -export_dynamic is a Linux-only flag, is not correct. That's what's invalid.

Instead, it appears to a problem for GCC.

Nonetheless, we can keep this open for now, and see what our option are.

comment:6 Changed 9 months ago by barracuda156

Thank you for re-opening. I think even if PowerPC systems cannot be supported here for w/e reason, fixing this for GCC on Intel is desirable, and also for 10.6 x86_64.

A quick search via BBEdit did not reveal where -export_dynamic comes from though. I will look into that again today after sorting some other stuff.

comment:7 Changed 9 months ago by mascguy (Christopher Nielsen)

This appears to be natively supported by Meson, per their docs:

https://mesonbuild.com/Reference-manual_functions.html#build_target_export_dynamic

comment:8 Changed 9 months ago by jmroot (Joshua Root)

-Wl, is the mechanism provided by the compiler front-end to pass flags to the linker.

comment:9 Changed 9 months ago by barracuda156

Besides, why do we even build test-suite here by default, when there is a tests variant? I suggest to add -Dbuild-testsuite=false into default config and replace it in tests.

comment:10 Changed 9 months ago by barracuda156

In fact, without the testsuite (which is broken by -export_dynamic flag) gtk4 builds fine for me on 10.6 with zero manual efforts. No new patches etc.

36-25% port -v installed gtk4
The following ports are currently installed:
  gtk4 @4.10.4_0+x11 (active) requested_variants='' platform='darwin 10' archs='ppc' date='2023-08-18T15:48:12+0800'
Last edited 9 months ago by barracuda156 (previous) (diff)

Changed 9 months ago by barracuda156

Attachment: gtk4_10.6_main.log added

comment:11 in reply to:  9 Changed 9 months ago by mascguy (Christopher Nielsen)

Replying to barracuda156:

Besides, why do we even build test-suite here by default, when there is a tests variant? I suggest to add -Dbuild-testsuite=false into default config and replace it in tests.

Ah, that was simply an oversight on our part. (Typically there's only one test-related option. But in this case, we have to disable two.)

comment:12 Changed 9 months ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: reopenedclosed

In 724d9ac335c8f58ac0966b9b000e1ad542b865ea/macports-ports (master):

gtk4: only build/run tests, via variant tests

Fixes: #67977

comment:13 Changed 9 months ago by barracuda156

Thank you! I will see later how to get rid of that flag for tests when using GCC, but at least the port is buildable by default now, which is great.

Note: See TracTickets for help on using tickets.