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

ld64.lld and duplicate symbols #67442

Open
alucryd opened this issue Sep 26, 2023 · 2 comments
Open

ld64.lld and duplicate symbols #67442

alucryd opened this issue Sep 26, 2023 · 2 comments
Labels

Comments

@alucryd
Copy link

alucryd commented Sep 26, 2023

Hi guys, I'm trying to cross compile a lib (vips) that has several rust dependencies. Sadly the state of rust static libs seems to be getting worse with time and they are all plagued with duplicate symbols. I can work around that using -Wl,--allow-multiple-definition when targeting linux and windows, unfortunately targeting macos is a no-go because ld64.lld does not support that flag. Is there an alternative way of dealing with duplicate symbols on the ld64.lld side? I don't think rust static libs are going to be fixed anytime soon so my hands are tied.

duplicate symbol '___rust_foreign_exception' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '_rust_begin_unwind' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '___rdl_alloc_zeroed' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '___rdl_realloc' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '___rdl_dealloc' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '___rdl_alloc' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '_rust_panic' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '___rust_drop_panic' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(std-f6811f31090e0239.std.add96b74-cgu.0.rcgu.o)
duplicate symbol '___rdl_oom' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(alloc-ad1eeb16b5006415.alloc.c81d41f3-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(alloc-80ef5ce8d4cd7e19.alloc.157cdf10-cgu.0.rcgu.o)
duplicate symbol '___rg_oom' in:
    /home/embybuilder/Buildbot/armv8_osx/staging/lib/librav1e.a(std-2ca50e2550a11ed4.std.64f42f12-cgu.0.rcgu.o)
    /home/embybuilder/Buildbot/armv8_osx/libimagequant-armv8_osx/staging/lib/libimagequant.a(alloc-80ef5ce8d4cd7e19.alloc.157cdf10-cgu.0.rcgu.o)
ld: 10 duplicate symbols for architecture arm64
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
@github-actions github-actions bot added the lld label Sep 26, 2023
@rkettelerij
Copy link

rkettelerij commented Oct 3, 2023

Big +1 here, the linux (and I think windows) linker both support the --allow-multiple-definition flag. The linker on macOS doesn't, this makes it impossible to compile certain (cgo in my case) projects on macOS.

rkettelerij added a commit to PDOK/go-cloud-sqlite-vfs that referenced this issue Oct 3, 2023
@cerisier
Copy link
Contributor

The rabbit hole that led me to this issue, only to find out it's a dead end 😭

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

No branches or pull requests

3 participants