|
From: | T8N |
Subject: | Duplicate symbol error with clang 11.1.0 |
Date: | Tue, 20 Apr 2021 15:43:52 +0200 |
When cpio 2.13 is built using clang 11.1.0 there's a linking error because of a duplicate symbol: ``` Making install in src make[1]: Entering directory '/Users/toonn/src/nixpkgs/cpio-shell/cpio-2.13/cpio-2.13/src' CCLD cpio ld: warning: -sdk_version and -platform_version are not compatible, ignoring -sdk_version duplicate symbol '_program_name' in: global.o ../gnu/libgnu.a(progname.o) ld: 1 duplicate symbol for architecture x86_64 clang-11: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [Makefile:1276: cpio] Error 1 make[1]: Leaving directory '/Users/toonn/src/nixpkgs/cpio-shell/cpio-2.13/cpio-2.13/src' make: *** [Makefile:1282: install-recursive] Error 1 post-installation fixup gzipping man pages under /nix/store/9rnb8i3nfnjkhmibcwy517xq7ds611vh-cpio-2.13/share/man/ strip is /nix/store/ihs2dgd42s8h8b35fhv6qmy62vpv65g0-bootstrap-stage0-clang/bin/strip ``` The full linker invocation (I patched `src/Makefile` to pass `-v` in the `CCLD` definition): ``` "/nix/store/f2cpyzpmqp1j4b0hak27ji1avhr6ijz1-bootstrap-stage0-clang-wrapper-11.1.0/bin/ld" -demangle -lto_library /nix/store/7s9ra8gyq839w3fwk9i3jlp97cnd18vi-bootstrap-tools/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 10.12.0 0.0.0 -o cpio -L/nix/store/cdmicaw2115h2f4bxlwizsiv21b8ax59-bootstrap-stage0-libcxx/lib -L/nix/store/hzmh09gf10n90kniphrx6bl3lwg2iqs1-bootstrap-stage0-libcxxabi/lib -L/nix/store/cdmicaw2115h2f4bxlwizsiv21b8ax59-bootstrap-stage0-libcxx/lib -L/nix/store/hzmh09gf10n90kniphrx6bl3lwg2iqs1-bootstrap-stage0-libcxxabi/lib -L/nix/store/dp077zqaqq95qk6jklm2ra2wlvv0k2wh-bootstrap-stage0-Libsystem/lib -L/nix/store/ihs2dgd42s8h8b35fhv6qmy62vpv65g0-bootstrap-stage0-clang/lib -sdk_version 10.12 -no_uuid copyin.o copyout.o copypass.o defer.o dstring.o global.o fatal.o main.o tar.o util.o filemode.o idcache.o makepath.o userspec.o ../lib/libpax.a ../gnu/libgnu.a -lSystem -F/nix/store/7s9ra8gyq839w3fwk9i3jlp97cnd18vi-bootstrap-tools/Library/Frameworks ``` Previously cpio was being built using clang 7.1.0. I believe the relevant change is `-fno-common` became a default in clang 11.0.0 as can be read in the [release notes](https://releases.llvm.org/11.0.0/tools/clang/docs/ReleaseNotes.html#modified-compiler-flags). The build succeeds if I patch the `CC` definition in `src/Makefile` to pass `-fcommon` (I'm sure there's a better mechanism to do this but I'm not familiar with the use of CFLAGS). The [Gentoo Linux GCC 10 porting notes](https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common) may be helpful. |
[Prev in Thread] | Current Thread | [Next in Thread] |