Opened 4 months ago

Last modified 3 months ago

#70386 assigned defect

glib2 @2.78.4_0+x11: ld: unknown option: -export_dynamic

Reported by: nathanpc (Nathan Campos) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: leopard ppc64 ppc Cc: nathanpc (Nathan Campos)
Port: glib2

Description

While trying to upgrade all the outdated packages in my Power Mac G5 running Mac OS X 10.5.8 Leopard, I wasn't able to proceed due to a build error in the glib2 package. Since this is quite an important package I'm a bit worried. I've also attached the build logs, but the crucial part is this:

:debug:build system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_glib2/glib2/work/build" && /opt/local/bin/ninja -j2 --verbose -v
:info:build [1/268] /opt/local/bin/gcc-mp-7  -o gmodule/tests/module-test-library gmodule/tests/module-test-library.p/module-test.c.o -L/opt/local/lib -I/opt/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-export_dynamic -Wl,-headerpad_max_install_names -lresolv -bind_at_load -lMacportsLegacySupport -arch ppc -pipe -Os -Wno-deprecated-declarations -arch ppc -Wl,-rpath,@loader_path/../../glib -Wl,-rpath,@loader_path/.. glib/libglib-2.0.0.dylib gmodule/libgmodule-2.0.0.dylib -lm -lintl
:info:build FAILED: gmodule/tests/module-test-library
:info:build /opt/local/bin/gcc-mp-7  -o gmodule/tests/module-test-library gmodule/tests/module-test-library.p/module-test.c.o -L/opt/local/lib -I/opt/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-export_dynamic -Wl,-headerpad_max_install_names -lresolv -bind_at_load -lMacportsLegacySupport -arch ppc -pipe -Os -Wno-deprecated-declarations -arch ppc -Wl,-rpath,@loader_path/../../glib -Wl,-rpath,@loader_path/.. glib/libglib-2.0.0.dylib gmodule/libgmodule-2.0.0.dylib -lm -lintl
:info:build ld: unknown option: -export_dynamic
:info:build collect2: error: ld returned 1 exit status
:info:build [2/268] /opt/local/bin/gcc-mp-7  -o gmodule/tests/module-test-plugin gmodule/tests/module-test-plugin.p/module-test.c.o -L/opt/local/lib -I/opt/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-export_dynamic -Wl,-headerpad_max_install_names -lresolv -bind_at_load -lMacportsLegacySupport -arch ppc -pipe -Os -Wno-deprecated-declarations -arch ppc -Wl,-rpath,@loader_path/../../glib -Wl,-rpath,@loader_path/.. glib/libglib-2.0.0.dylib gmodule/libgmodule-2.0.0.dylib -lm -lintl
:info:build FAILED: gmodule/tests/module-test-plugin
:info:build /opt/local/bin/gcc-mp-7  -o gmodule/tests/module-test-plugin gmodule/tests/module-test-plugin.p/module-test.c.o -L/opt/local/lib -I/opt/local/include -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-export_dynamic -Wl,-headerpad_max_install_names -lresolv -bind_at_load -lMacportsLegacySupport -arch ppc -pipe -Os -Wno-deprecated-declarations -arch ppc -Wl,-rpath,@loader_path/../../glib -Wl,-rpath,@loader_path/.. glib/libglib-2.0.0.dylib gmodule/libgmodule-2.0.0.dylib -lm -lintl
:info:build ld: unknown option: -export_dynamic
:info:build collect2: error: ld returned 1 exit status
:info:build ninja: build stopped: subcommand failed.

I was able to find a related ticket:53150, which led me to do the following operation in order to try and fix this:

$ /opt/local/bin/ld -v
@(#)PROGRAM:ld  PROJECT:ld64-97.17
configured to support archs: i386 x86_64 ppc ppc64 armv6 armv7
LTO support using: LLVM version 3.3
$ sudo port -v -f deactivate ld64
--->  Unable to deactivate ld64 @3_6+ld64_97, the following ports depend on it:
--->  	gcc7 @7.5.0_4
Warning: Deactivate forced.  Proceeding despite dependencies.
--->  Deactivating ld64 @3_6+ld64_97
--->  Cleaning ld64
--->  Removing work directory for ld64
$ sudo port -v install ld64 -ld64_97
--->  Computing dependencies for ld64.Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
.
Error: Cannot install ld64-latest for the arch 'powerpc' because
Error: its dependency libtapi does not build for the required arch by default
Error: and the configured universal_archs 'i386 ppc' are not sufficient.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port ld64 failed

What would be the next steps in order to resolve this issue?

Attachments (2)

glib2_main.log (1.4 MB) - added by nathanpc (Nathan Campos) 4 months ago.
main.log (1.3 MB) - added by rmottola (Riccardo) 3 months ago.
Buold on 10.6 intel clang 3.7

Change History (15)

Changed 4 months ago by nathanpc (Nathan Campos)

Attachment: glib2_main.log added

comment:1 Changed 4 months ago by nathanpc (Nathan Campos)

Cc: nathanpc added

comment:2 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to mascguy
Status: newassigned

comment:3 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

I don't think #53150 is relevant. #53150 is about -export_dynamic being automatically added when -rdynamic is used. In the case of glib2 here, -rdynamic is not being used. The error is only happening when building the gmodule tests, so I think it is because the file gmodule/tests/meson.build is explicitly asking for -export_dynamic by using 'export_dynamic' : true:

https://gitlab.gnome.org/GNOME/glib/-/blob/ade79bcb5006c33d6f644cfe41d22d14728e585f/gmodule/tests/meson.build#L56

comment:4 in reply to:  3 Changed 3 months ago by barracuda156

Replying to ryandesign:

I don't think #53150 is relevant. #53150 is about -export_dynamic being automatically added when -rdynamic is used. In the case of glib2 here, -rdynamic is not being used. The error is only happening when building the gmodule tests, so I think it is because the file gmodule/tests/meson.build is explicitly asking for -export_dynamic by using 'export_dynamic' : true:

https://gitlab.gnome.org/GNOME/glib/-/blob/ade79bcb5006c33d6f644cfe41d22d14728e585f/gmodule/tests/meson.build#L56

Ryan, do you know how to fix it in meson, so that the flag is used conditionally on macOS version? See discussion here: https://github.com/mesonbuild/meson/pull/13291

comment:5 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

No, I don't; I don't like meson and don't know very much about it.

comment:6 Changed 3 months ago by rmottola (Riccardo)

Neither I do like meson and know how to fix things there....

Just want to add that I have this problem also on 10.6 x86 32bit, so it is not a 10.5/ppc only thing.

I will upgrade more systems during and after holidays, so in case it pops out elsewhere..

Known workarounds? It is quite a core package unfortunately.

Changed 3 months ago by rmottola (Riccardo)

Attachment: main.log added

Buold on 10.6 intel clang 3.7

comment:7 Changed 3 months ago by rmottola (Riccardo)

An attempt to build with gcc12 fails because it wants libc++ 11 and not 03

FAILED: glib/tests/cxx-98.p/cxx.cpp.o 
/opt/local/bin/g++-mp-12 -Iglib/tests/cxx-98.p -Iglib/tests -I../glib-2.78.4/glib/tests -I. -I../glib-2.78.4 -Iglib -I../glib-2.78.4/glib -I/opt/local/include -fdiagnostics-color=always -O2 -g -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wmissing-field-initializers -Wnonnull -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Werror=unused-result -pipe -Os -stdlib=libc++ -arch i386 '-DG_LOG_DOMAIN="GLib"' -UG_DISABLE_ASSERT -std=c++98 '-D_G_EXPECTED_CXX_STANDARD="98"' -MD -MQ glib/tests/cxx-98.p/cxx.cpp.o -MF glib/tests/cxx-98.p/cxx.cpp.o.d -o glib/tests/cxx-98.p/cxx.cpp.o -c ../glib-2.78.4/glib/tests/cxx.cpp
In file included from /opt/local/libexec/gcc12/libc++/include/c++/v1/stddef.h:39,
                 from ../glib-2.78.4/glib/gmacros.h:40,
                 from glib/glibconfig.h:9,
                 from ../glib-2.78.4/glib/gtypes.h:34,
                 from ../glib-2.78.4/glib/galloca.h:34,
                 from ../glib-2.78.4/glib/glib.h:32,
                 from ../glib-2.78.4/glib/tests/cxx.cpp:20:
/opt/local/libexec/gcc12/libc++/include/c++/v1/__config:232:2: error: #error "libc++ does not support using GCC with C++03. Please enable C++11"
  232 | #error "libc++ does not support using GCC with C++03. Please enable C++11"
      |  ^~~~~
/opt/local/libexec/gcc12/libc++/include/c++/v1/__nullptr:56:13: error: 'nullptr' was not declared in this scope
   56 |     typedef decltype(nullptr) nullptr_t;
      |             ^~~~~~~~
/opt/local/libexec/gcc12/libc++/include/c++/v1/__nullptr:56:13: error: 'nullptr' was not declared in this scope
/opt/local/libexec/gcc12/libc++/include/c++/v1/stdlib.h:107:53: error: expected initializer before 'noexcept'
  107 | inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
      |                                                     ^~~~~~~~~
/opt/local/libexec/gcc12/libc++/include/c++/v1/stdlib.h:111:63: error: expected initializer before 'noexcept'
  111 | inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
      |                                                               ^~~~~~~~~
/opt/local/libexec/gcc12/libc++/include/c++/v1/stdlib.h:118:60: error: expected initializer before 'noexcept'

comment:8 in reply to:  5 ; Changed 3 months ago by barracuda156

Replying to ryandesign:

No, I don't; I don't like meson and don't know very much about it.

Ok, let's first conditionally revert that breakage in meson port, because this error is too critical to wait for months until someone fixes it upstream.

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

Replying to rmottola:

An attempt to build with gcc12 fails because it wants libc++ 11 and not 03

Using gcc with libc++ is largely untested and expected not to work in some/many cases. Especially an old one.

comment:10 in reply to:  8 ; Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to barracuda156:

Ok, let's first conditionally revert that breakage in meson port, because this error is too critical to wait for months until someone fixes it upstream.

Maybe the first step should instead be to file a meson bug report.

comment:11 Changed 3 months ago by smith-48116

This is preventing me from building 'nut' that monitors and controls a UPS systems with 10.5 and 10.6 machines. Please fix!

comment:12 Changed 3 months ago by Sergey Fedorov <barracuda@…>

In 9efbf0afa0f4348c50473d378872fb066e07760f/macports-ports (master):

py-meson: unbreak linking on < 10.7

See:
#70386
#70496

comment:13 in reply to:  10 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

Maybe the first step should instead be to file a meson bug report.

https://github.com/mesonbuild/meson/issues/13543

Note: See TracTickets for help on using tickets.