Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure breaks linking by manually adding bundle1.o: duplicate symbol dyld_stub_binding_helper #1662

Open
barracuda156 opened this issue Jul 30, 2024 · 8 comments · May be fixed by #1750
Open

Comments

@barracuda156
Copy link

GCC libraries are not supposed to be linked directly to. Configure specifically adds bundle, and that appears to break linking:

Making modules...

make[1]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod'
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/ctcp.mod'
ccache /usr/bin/gcc-4.2 -std=gnu99 -fPIC -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -I/opt/local/include -DMAKING_MODS -c .././ctcp.mod/ctcp.c && mv -f ctcp.o ../
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/console.mod'
ccache /usr/bin/gcc-4.2 -std=gnu99 -fPIC -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -I/opt/local/include -DMAKING_MODS -c .././console.mod/console.c && mv -f console.o ../
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/assoc.mod'
ccache /usr/bin/gcc-4.2 -std=gnu99 -fPIC -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -I/opt/local/include -DMAKING_MODS -c .././assoc.mod/assoc.c && mv -f assoc.o ../
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/channels.mod'
ccache /usr/bin/gcc-4.2 -std=gnu99 -fPIC -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -I/opt/local/include -DMAKING_MODS -c .././channels.mod/channels.c && mv -f channels.o ../
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/compress.mod'
ccache /usr/bin/gcc-4.2 -std=gnu99 -fPIC -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -I/opt/local/include -DMAKING_MODS -c .././compress.mod/compress.c && mv -f compress.o ../
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/blowfish.mod'
ccache /usr/bin/gcc-4.2 -std=gnu99 -fPIC -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -I/opt/local/include -DMAKING_MODS -c .././blowfish.mod/blowfish.c && mv -f blowfish.o ../
ccache /usr/bin/gcc-4.2 -std=gnu99 -dynamiclib   -Wl,-single_module -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -o ../../../ctcp.so ../ctcp.o -L/opt/local/lib -L/opt/local/lib -ltcl8.6 -lz -lpthread -framework CoreFoundation -lssl -lcrypto  -lresolv /usr/lib/bundle1.o && touch ../../../ctcp.so
ld: duplicate symbol dyld_stub_binding_helper in /usr/lib/bundle1.o and /usr/lib/dylib1.10.5.o
collect2: ld returned 1 exit status
make[2]: *** [../../../ctcp.so] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/ctcp.mod'
make[1]: *** [ctcp.mod_so] Error 2
make[1]: *** Waiting for unfinished jobs....
ccache /usr/bin/gcc-4.2 -std=gnu99 -dynamiclib   -Wl,-single_module -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -o ../../../console.so ../console.o -L/opt/local/lib -L/opt/local/lib -ltcl8.6 -lz -lpthread -framework CoreFoundation -lssl -lcrypto  -lresolv /usr/lib/bundle1.o && touch ../../../console.so
ccache /usr/bin/gcc-4.2 -std=gnu99 -dynamiclib   -Wl,-single_module -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -o ../../../assoc.so ../assoc.o -L/opt/local/lib -L/opt/local/lib -ltcl8.6 -lz -lpthread -framework CoreFoundation -lssl -lcrypto  -lresolv /usr/lib/bundle1.o && touch ../../../assoc.so
ccache /usr/bin/gcc-4.2 -std=gnu99 -dynamiclib   -Wl,-single_module -pipe -Os -arch ppc -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod -I/opt/local/include -DHAVE_CONFIG_H -I/opt/local/include -o ../../../compress.so ../compress.o -lz -L/opt/local/lib -L/opt/local/lib -ltcl8.6 -lz -lpthread -framework CoreFoundation -lssl -lcrypto  -lresolv /usr/lib/bundle1.o && touch ../../../compress.so
ld: duplicate symbol dyld_stub_binding_helper in /usr/lib/bundle1.o and /usr/lib/dylib1.10.5.o
collect2: ld returned 1 exit status
make[2]: *** [../../../console.so] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/console.mod'
make[1]: *** [console.mod_so] Error 2
ld: duplicate symbol dyld_stub_binding_helper in /usr/lib/bundle1.o and /usr/lib/dylib1.10.5.o
collect2: ld returned 1 exit status
make[2]: *** [../../../assoc.so] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/assoc.mod'
make[1]: *** [assoc.mod_so] Error 2
ld: duplicate symbol dyld_stub_binding_helper in /usr/lib/bundle1.o and /usr/lib/dylib1.10.5.o
collect2: ld returned 1 exit status
make[2]: *** [../../../compress.so] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_irc_eggdrop/eggdrop/work/eggdrop-1.9.5/src/mod/compress.mod'
make[1]: *** [compress.mod_so] Error 2
@michaelortmann
Copy link
Member

michaelortmann commented Jul 31, 2024

Additional info:

Installed macOS from scratch, then installed official command line developer tools (git, ...), then:

https://pastebin.com/RA8Giqqf

see also:

dnl EGG_DARWIN_BUNDLE

@barracuda156
Copy link
Author

Additional info:

Installed macOS from scratch, then installed official command line developer tools (git, ...), then:

https://pastebin.com/RA8Giqqf

@michaelortmann You could take a look how it is built in MacPorts: https://github.com/macports/macports-ports/blob/master/irc/eggdrop/Portfile (or install directly from MacPorts, if it is an acceptable option).

@michaelortmann
Copy link
Member

Thank you!

Also for reference, this Issue is related to #176

@michaelortmann
Copy link
Member

In Mac OS X 10.4, dlopen was rewritten to be a native part of dyld. See: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlopen.3.html

So eggdrop under Darwin / macOS should check, if it can use the dl*() functions load method, or check for macOS version >= 10.4 and in this case prefer the dl*() functions load method over the NS*() and rld_*() functions, and prefer the ld linker flag -shared over -bundle and linking to bundle1.o.

@barracuda156
Copy link
Author

and prefer the ld linker flag -shared over -bundle and linking to bundle1.o.

-shared is a Linux flag, Apple ld does not have it: https://www.manpagez.com/man/1/ld64
There is -dynamic, but it is the default anyway.

@michaelortmann
Copy link
Member

my macOS 13.7.3 also warns about NS* deprecation:

gcc -g -O2 -pipe -Wall -I.. -I.. -DHAVE_CONFIG_H -iwithsysroot /System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -c modules.c
modules.c:763:9: warning: 'NSCreateObjectFileImageFromFile' is deprecated: first deprecated in macOS 10.5 - dlopen() [-Wdeprecated-declarations]
ret = NSCreateObjectFileImageFromFile(workbuf, &file);

@michaelortmann
Copy link
Member

michaelortmann commented Jan 29, 2025

current eggdrop git compiles fine under my testsystem, if i compile manually, without macports or homebrew:

https://pastebin.com/1xGimpST

macOS Ventura 13.7.3

% uname -a
Darwin michaels-iMac-Pro.local 22.6.0 Darwin Kernel Version 22.6.0: Thu Dec  5 23:45:11 PST 2024; root:xnu-8796.141.3.709.7~4/RELEASE_X86_64 x86_64
% gcc -v
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Its a vanilla install: only base system + "Command Line Developer Tools"

Dynamic loading is hard to get right under macOS, for i only have this single macOS version at hand, and macOS versions evolved around dynamic loading. Looks like current macOS versions do have bundle1.o in pathes that eggdrop doesnt check so the bug is not triggered on current macOS versions. The bug report is for macOS Snow Leopard 10.6 (2009 - 2011) and i never tested older macOS like this before, for they are hard to install under qemu.

@michaelortmann
Copy link
Member

@barracuda156 please can you give #1750 a try? and maybe post the whole configure / make config / make and uname -a info on pastebin for bonus points? merci!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants