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

share-generics leads to unresolved external symbols/undefined references #120229

Open
byeongkeunahn opened this issue Jan 22, 2024 · 3 comments
Open
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@byeongkeunahn
Copy link

Hello, I've been trying to get cargo test working in the project basm-rs and found a weird behavior that looks like a bug. Specifically, running the following command results in link failure on both Windows x64, Linux x64, and Linux i686:

git clone -b reproduce-test-build-fail --single-branch https://github.com/byeongkeunahn/basm-rs.git
cd basm-rs
cargo test

The full error message on CI is as follows:

Full message on CI (Windows x64)

Run cargo test --lib -- --test-threads 1
   Compiling rand_core v0.6.4
   Compiling libm v0.2.8
   Compiling compiler_builtins v0.1.106
   Compiling ryu v1.0.16
   Compiling rand v0.8.5
   Compiling basm v0.1.0 (D:\a\basm-rs\basm-rs\basm)
   Compiling basm-macro v0.1.0 (D:\a\basm-rs\basm-rs\basm-macro)
   Compiling basm-std v0.1.0 (D:\a\basm-rs\basm-rs\basm-std)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX64\\x64\\link.exe" "/DEF:C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcW4rIKn\\lib.def" "/NOLOGO" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcW4rIKn\\symbols.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.19m471wlfcz2i7kd.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.1wfczv3x8ts8pykt.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.23akb3bsibrx6x9.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.2amleo09ao45a7ql.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.2wnangwg7ji2ugni.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.3o8p0xm07tudh1kg.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.3ou8ecm87gs0nnzl.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.3rr9durlhp3crx2b.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.49gn4lpeupqvpk0v.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.4kupheul9i7wc6li.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.4xq7jsyv3mj5kfj6.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.56yo3hj1m57g5wc6.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.6j8pa6fb3uylsx2.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.91ysqxld4tgstmz.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.r30jl8fkwerr179.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.zvb4p6kwamoh0rq.rcgu.o" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.2lccn3x3fv8gji2p.rcgu.o" "/LIBPATH:D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps" "/LIBPATH:D:\\a\\basm-rs\\basm-rs\\target\\debug\\deps" "/LIBPATH:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libtest-734df8d793eb12e1.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libgetopts-0aecb7b68fed9d10.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunicode_width-001edea5b8bb31db.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_std-97139a3d956a18be.rlib" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libbasm_std-245e72d8e840a284.rlib" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\libryu-c882e9eacc78902d.rlib" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\librand-e4fb1eca8cd80423.rlib" "D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\librand_core-fef47197ec49a16e.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-4c5d092b901daedc.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-c1d0337b7fc45efe.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_demangle-6d37ce9e793737f0.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_detect-54c5af2eb7310822.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libhashbrown-6be25f581644e237.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_alloc-3bed8915f2af4b48.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-beec6f2f96f7d444.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcfg_if-99164f8878459c2d.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-3ee616106607257a.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-f01f1b5b0462925e.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\librustc_std_workspace_core-747897f502f49f1a.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-0a7d9524c210bd3d.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-d0b7cd1e3991caf1.rlib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "ws2_32.lib" "kernel32.lib" "ntdll.lib" "kernel32.lib" "msvcrt.lib" "/NXCOMPAT" "/LIBPATH:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:D:\\a\\basm-rs\\basm-rs\\target\\x86_64-pc-windows-msvc\\debug\\deps\\basm-757f6b3fe12ac161.exe" "/OPT:NOREF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note:    Creating library D:\a\basm-rs\basm-rs\target\x86_64-pc-windows-msvc\debug\deps\basm-757f6b3fe12ac161.lib and object D:\a\basm-rs\basm-rs\target\x86_64-pc-windows-msvc\debug\deps\basm-757f6b3fe12ac161.exp
          libbasm_std-245e72d8e840a284.rlib(basm_std-245e72d8e840a284.4rfhk36cnv5mo2s5.rcgu.o) : error LNK2019: unresolved external symbol _ZN63_$LT$I$u20$as$u20$core..iter..traits..collect..IntoIterator$GT$9into_iter17h13499b354cfda9fbE referenced in function _ZN95_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..iter..traits..collect..FromIterator$LT$T$GT$$GT$9from_iter17ha6a09a1574924818E
          libbasm_std-245e72d8e840a284.rlib(basm_std-245e72d8e840a284.4ijtffz3k5m4m2c4.rcgu.o) : error LNK2001: unresolved external symbol _ZN63_$LT$I$u20$as$u20$core..iter..traits..collect..IntoIterator$GT$9into_iter17h13499b354cfda9fbE
          libbasm_std-245e72d8e840a284.rlib(basm_std-245e72d8e840a284.4ijtffz3k5m4m2c4.rcgu.o) : error LNK2019: unresolved external symbol _ZN4core4iter5range101_$LT$impl$u20$core..iter..traits..iterator..Iterator$u20$for$u20$core..ops..range..Range$LT$A$GT$$GT$4next17hbf4bb43b4401a50cE referenced in function _ZN8basm_std8platform6malloc8dlmalloc17Dlmalloc$LT$A$GT$18check_malloc_state17h8a5961e78415af17E
          libbasm_std-245e72d8e840a284.rlib(basm_std-245e72d8e840a284.c2yw05t128kbpw4.rcgu.o) : error LNK2001: unresolved external symbol _ZN4core4iter5range101_$LT$impl$u20$core..iter..traits..iterator..Iterator$u20$for$u20$core..ops..range..Range$LT$A$GT$$GT$4next17hbf4bb43b4401a50cE
          libbasm_std-245e72d8e840a284.rlib(basm_std-245e72d8e840a284.3dpkbehllprhjzep.rcgu.o) : error LNK2019: unresolved external symbol _ZN4core3cmp6min_by17h991649daaf4b1dc4E referenced in function _ZN100_$LT$core..iter..adapters..take..Take$LT$I$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$9size_hint17h113b8a1fcab53f3bE
          D:\a\basm-rs\basm-rs\target\x86_64-pc-windows-msvc\debug\deps\basm-757f6b3fe12ac161.exe : fatal error LNK1120: 3 unresolved externals
          

error: could not compile `basm` (lib test) due to 1 previous error

Full message on CI (Linux x64)

Run cargo test --lib -- --test-threads 1
   Compiling rand_core v0.6.4
   Compiling compiler_builtins v0.1.106
   Compiling libm v0.2.8
   Compiling ryu v1.0.16
   Compiling rand v0.8.5
   Compiling basm v0.1.0 (/home/runner/work/basm-rs/basm-rs/basm)
   Compiling basm-macro v0.1.0 (/home/runner/work/basm-rs/basm-rs/basm-macro)
   Compiling basm-std v0.1.0 (/home/runner/work/basm-rs/basm-rs/basm-std)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/opt/hostedtoolcache/node/21.6.0/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustcAstNFn/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcAstNFn/symbols.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.1pmxuef9345pzewo.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.1z1fd6znyaz4dsy2.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.2179kv4c11o798up.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.2li7ash5vsmkrh5j.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.2qmm2ntqzllgq2ss.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.2shd2x77yworu6f2.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.3sxaiotzwqcm92wa.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.4avu7oh5gfzkl80o.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.4gowbmj8cz7izp3m.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.4nwgxcob9twzjdma.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.4v7yqmnw01dljkbc.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.4yedjrts29gyexwo.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.5dncoodo32l3cwm5.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.65j2ayy9x05vfp2.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.6nk0nh1wcueh27c.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.d4pbquy0fbzh39j.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1.36p72v54fdf8jd1l.rcgu.o" "-Wl,--as-needed" "-L" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps" "-L" "/home/runner/work/basm-rs/basm-rs/target/debug/deps" "-L" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-f4e30f41a473e406.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-e692166dbafddada.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode_width-cec78bc907a4bb46.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_std-140a2a3d5133a74c.rlib" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/libbasm_std-eaf5ccd60db51562.rlib" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/libryu-33e5dd6744529756.rlib" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/librand-35a408d7a94416da.rlib" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/librand_core-028366cb14706eb2.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-19d8bdaf9f223155.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-89ad4240c90c0e03.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-49ef38daea3f49e1.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-8666dad6789c0484.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-7b871242ae961a4e.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-8d4074793ba35678.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-ec84eb0416770982.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-68539ddfb3806005.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-ac61d465c61f24ac.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-19d2d9343e8c3ab1.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-e762a6d65f031366.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-e85e489d4408465b.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-da335adb5acc7119.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-527e3e7decf6a631.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-5f8c8143cdb8d04b.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-b905197320c3903d.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-9686387289eaa322.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-632ae0f28c5e55ff.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-3166674eacfcf914.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/basm-0440eb1e6c7f96b1" "-Wl,--no-gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/libbasm_std-eaf5ccd60db51562.rlib(basm_std-eaf5ccd60db51562.2wv92g1zvck95yo5.rcgu.o): in function `basm_std::platform::malloc::dlmalloc::Dlmalloc<A>::check_malloc_state':
          /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/libbasm_std-eaf5ccd60db51562.rlib(basm_std-eaf5ccd60db51562.2wv92g1zvck95yo5.rcgu.o): in function `basm_std::platform::malloc::dlmalloc::Dlmalloc<A>::check_malloc_state':
          /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/libbasm_std-eaf5ccd60db51562.rlib(basm_std-eaf5ccd60db51562.8dyitnt9kbnppwi.rcgu.o): in function `<alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter':
          /rustc/ef71f1047e04438181d7cb925a833e2ada6ab390/library/alloc/src/vec/mod.rs:2794: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/x86_64-unknown-linux-gnu/debug/deps/libbasm_std-eaf5ccd60db51562.rlib(basm_std-eaf5ccd60db51562.1rruxgavwn9yifvy.rcgu.o): in function `core::iter::traits::iterator::Iterator::fold':
          /rustc/ef71f1047e04438181d7cb925a833e2ada6ab390/library/core/src/iter/traits/iterator.rs:2639: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `basm` (lib test) due to 1 previous error

Full message on CI (Linux i686)

Run cargo test --lib -- --test-threads 1
   Compiling rand_core v0.6.4
   Compiling libm v0.2.8
   Compiling compiler_builtins v0.1.106
   Compiling ryu v1.0.16
   Compiling rand v0.8.5
   Compiling basm v0.1.0 (/home/runner/work/basm-rs/basm-rs/basm)
   Compiling basm-macro v0.1.0 (/home/runner/work/basm-rs/basm-rs/basm-macro)
   Compiling basm-std v0.1.0 (/home/runner/work/basm-rs/basm-rs/basm-std)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/opt/hostedtoolcache/node/21.6.0/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustcLNl6QE/list" "-Wl,--no-undefined-version" "-m32" "/tmp/rustcLNl6QE/symbols.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.12dpct4vmbuv7uru.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.1a52x31tci2w0da6.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.29csb1a655mn3t1o.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.2ggj536g4gf73jzl.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.37wnbs9pi72y10u4.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.3e8b5mvuwq6zbh3h.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.3j8g2x8cgk5h1g2q.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.3jem33d26ehi7qb.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.3n7uy33cn8qprzim.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.3vlnsgermbesu1jg.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.3ysvcv9dct813quq.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.43snsz67w8nd35h6.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.4z8maext4v8vtddk.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.mnoonidrq1hqvn1.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.ngm0qa9ksgxpgt6.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.uelge8wzgo05zg9.rcgu.o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc.2hzj9gquum10cxwl.rcgu.o" "-Wl,--as-needed" "-L" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps" "-L" "/home/runner/work/basm-rs/basm-rs/target/debug/deps" "-L" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libtest-f61aede353c7c605.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libgetopts-46ba20a33a92c6c0.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libunicode_width-715d53c3bbb00c5d.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/librustc_std_workspace_std-0be5833b6ed41930.rlib" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/libbasm_std-e87e0f55800b3875.rlib" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/libryu-b1b95caa84273c50.rlib" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/librand-081c28d9e16b1dfc.rlib" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/librand_core-c41625019cb4925b.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-2384fa7276a3860d.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libpanic_unwind-5ff802d1a4d1292a.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libobject-2d7b176326920afd.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libmemchr-3261a28c86870ed0.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libaddr2line-ad613c410fe0a189.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libgimli-35f0aa4e3970e553.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/librustc_demangle-7021270558821337.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libstd_detect-4f14f8c366b3bb68.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libhashbrown-e6bff978e0d8bf08.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cd90c665ca150058.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libminiz_oxide-e9f5d832406634b6.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libadler-f9b0d3138bd614a6.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libunwind-164a66cb6d62f1b0.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libcfg_if-406a7bd855df9a90.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/liblibc-c2e59719e8814223.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/liballoc-783d1bc0a2cc99ed.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/librustc_std_workspace_core-850027b81533328a.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-72fc9e09205386df.rlib" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib/libcompiler_builtins-95e5a22c2ba40524.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-linux-gnu/lib" "-o" "/home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/basm-3076c2a7e55229dc" "-Wl,--no-gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/libbasm_std-e87e0f55800b3875.rlib(basm_std-e87e0f55800b3875.4t3d1jg6rpaye30b.rcgu.o): in function `<alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter':
          /rustc/ef71f1047e04438181d7cb925a833e2ada6ab390/library/alloc/src/vec/mod.rs:2794: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/libbasm_std-e87e0f55800b3875.rlib(basm_std-e87e0f55800b3875.5cgxciqj6s799b3p.rcgu.o): in function `basm_std::platform::malloc::dlmalloc::Dlmalloc<A>::check_malloc_state':
          /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/libbasm_std-e87e0f55800b3875.rlib(basm_std-e87e0f55800b3875.5cgxciqj6s799b3p.rcgu.o): in function `basm_std::platform::malloc::dlmalloc::Dlmalloc<A>::check_malloc_state':
          /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1462: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `<I as core::iter::traits::collect::IntoIterator>::into_iter'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/basm-std/src/platform/malloc/dlmalloc.rs:1465: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          /usr/bin/ld: /home/runner/work/basm-rs/basm-rs/target/i686-unknown-linux-gnu/debug/deps/libbasm_std-e87e0f55800b3875.rlib(basm_std-e87e0f55800b3875.1znrcpvl8bicav47.rcgu.o): in function `core::iter::traits::iterator::Iterator::fold':
          /rustc/ef71f1047e04438181d7cb925a833e2ada6ab390/library/core/src/iter/traits/iterator.rs:2639: undefined reference to `core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::Range<A>>::next'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `basm` (lib test) due to 1 previous error

However, all of the above CI failures can be fixed by adding "-Z", "share-generics=no" to the RUSTFLAGS in .cargo/config.toml.

The CI is configured to use the most recent version of nightly Rust. But running cargo-bisect-rustc locally does not find any working version of nightly.

So, I'm filing a bug report here as it seems like the share-generics feature potentially has a bug.

Thanks!

@byeongkeunahn byeongkeunahn added the C-bug Category: This is a bug. label Jan 22, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 22, 2024
@saethlin saethlin added the A-linkage Area: linking into static, shared libraries and binaries label Jan 30, 2024
@saethlin
Copy link
Member

I think the bug is probably an interaction between share-generics and -Zexport-executable-symbols.

@saethlin
Copy link
Member

Ah! I was just going to link this in the tracking issue for export-executable-symbols and I see this comment: #84161 (comment)

The reachable_set analysis currently doesn't take the export-executable-symbols flag into account from what I can tell causing it to forget to include some #[no_mangle] functions in symbols.o.

I immediately noticed this as well. It seems plausible that fixing reachability analysis will fix this issue.

@saethlin saethlin self-assigned this Jan 30, 2024
@saethlin saethlin added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 30, 2024
@saethlin
Copy link
Member

I looked into this, and whatever is going on here is beyond my expertise in the compiler. I'm getting better at hacking on rustc, but not as fast as I thought.

@saethlin saethlin removed their assignment Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants