<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/67442>67442</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ld64.lld and duplicate symbols
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lld
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alucryd
</td>
</tr>
</table>
<pre>
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)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsmEuL4zgXhn-NsjnYSPItXmTRF8JX628xy3AsHTualiWPJCeV-fWDnOpu6C4YZqaKYSBQ-FKcy6tHB4XXGKOZHNGBNR9Z83mHazr7cEC7qnDTu8Hr2-F_Bqb1Fpn8BE9MdjOkcDNuguRBBR8jKD8vxhIgWDMAk_uLWSKTPaQzJjhjhEgXCmghrDGBpoWcJqcMxRL-j9reIJ0JYsJE4Md7VH4zKlfM6TTH3G8gmCil3P3qQyS4mnSGZGYCdDpXuQEGArQWFovTSvoeotfFGpXrx9s8eBtLeAKFLpf5Ahj8uqVjgjXm6qzlxS-WyU9Fgdb6azGvNpnFUqFpNM4k4x1rOVzP5CBhmGgTZY1bnzcpV-O0v27QVjf6kFaHifJKvwXPqHwEEwHB-WLKq1O4RsrNrW7r0lqde2hPEZxPENdl8SHddY4WpxKeYl50XrEDtImCw2QuBFe8ZZKa0G6wXmUA3m3gf-gXjSZWHeEJtHdMdrmhcV9-3pZMevIvozAQjOaZNKC7bRsSvXcQPcw3OKPT9_BkSJeMf2b8w8u15S9_2-uPGoHJ7nQ65dan0QcykzvRs6Jl2wDZgXGseikFTB7PfiYmjzQPt2E1VlNg8vgxPw0-MXnEMF_2Jx-fmTzGhJNxE5NHa4b7NeBFUIlM7mPShVTYcJJNw1EI0nUZky7beqzlKGShprXkZcg3z2T_9zRYM5gZJ_ptRZeKP1H3PfKbxLHdCzFWgvecuKz6TSJq3bdDV78u8VXEG-CBJuNOq8uz-2D7ZmxPp6DtKR8j6vQ7BU8PuG8NN9CG98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