You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like cargo-zigbuild, or possibly zig itself might be stripping some parts of the data section more aggressively than the normal toolchain.
I ran into this when attempting to compile code that uses dnoltay's linkme crate.
I believe that the following code is enough to repro:
use linkme::distributed_slice;
#[distributed_slice]
pub static BENCHMARKS: [fn() ->()];
The output of compiling that with zigbuild for macos:
root@fc1f4ba9c8d7:/home/linkme-test# cargo zigbuild --target x86_64-apple-darwin
Compiling linkme-test v0.1.0 (/home/linkme-test)
error: linking with `/root/.cache/cargo-zigbuild/0.18.2/zigcc-x86_64-apple-darwin.sh` failed: exit status: 1
|
= note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET LC_ALL="C" PATH="/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" ZERO_AR_DATE="1" "/root/.cache/cargo-zigbuild/0.18.2/zigcc-x86_64-apple-darwin.sh" "-arch" "x86_64" "-m64" "/tmp/rustchpeyDi/symbols.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.15jrcircyanqr740.rcgu.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.29rupb9b6toiq3wz.rcgu.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.367eabxtgl6g1qos.rcgu.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.3w6a1jgc8e3l4ajl.rcgu.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.5fc7ph7yzrh08ioi.rcgu.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.om0rsfvk4eoer1e.rcgu.o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.58za6qdy5pd70skz.rcgu.o" "-L" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps" "-L" "/home/linkme-test/target/debug/deps" "-L" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/liblinkme-75a8fb44f794695e.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libstd-f4038c6a2122598b.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-4d5ab9013fdd121e.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libobject-a06a66efc4b44ca6.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-5ab035970e797532.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-df34c142418a2ac8.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libgimli-dbcd4dcfbda6fdbf.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-b4a3aace37c012fb.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-6b29ce58982babf2.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-99d6689a246a8b6b.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-3ccc36334290888c.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-e6b42d0c074bdff6.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libadler-a36f9401955835a3.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libunwind-e88e61505c140ea2.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-56481735f90af261.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/liblibc-51841927df3cf5b1.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/liballoc-162d0e2e1ee955d8.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-1ec4c76e19c090bf.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libcore-37be1cf71fc9b666.rlib" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-11c3039f74959a20.rlib" "-lSystem" "-lc" "-lm" "-L" "/usr/local/rustup/toolchains/1.75.0-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5" "-Wl,-dead_strip" "-nodefaultlibs"
= note: error(link): undefined reference to symbol 'section$end$__DATA$__linkmeFlhDRphL'
error(link): first referenced in '/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.15jrcircyanqr740.rcgu.o'
error(link): undefined reference to symbol 'section$start$__DATA$__linkm2FlhDRphL'
error(link): first referenced in '/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.15jrcircyanqr740.rcgu.o'
error(link): undefined reference to symbol 'section$end$__DATA$__linkm2FlhDRphL'
error(link): first referenced in '/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.15jrcircyanqr740.rcgu.o'
error(link): undefined reference to symbol 'section$start$__DATA$__linkmeFlhDRphL'
error(link): first referenced in '/home/linkme-test/target/x86_64-apple-darwin/debug/deps/linkme_test-e030de1a8749e2e5.15jrcircyanqr740.rcgu.o'
error: UndefinedSymbolReference
= 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)
The text was updated successfully, but these errors were encountered:
It seems like cargo-zigbuild, or possibly zig itself might be stripping some parts of the data section more aggressively than the normal toolchain.
I ran into this when attempting to compile code that uses dnoltay's linkme crate.
I believe that the following code is enough to repro:
The output of compiling that with zigbuild for macos:
The text was updated successfully, but these errors were encountered: