gyscos / zstd-rs

A rust binding for the zstd compression library.
MIT License
527 stars 112 forks source link

zstd fails to build on aarch64-unknown-linux-musl #257

Closed douglas-raillard-arm closed 8 months ago

douglas-raillard-arm commented 10 months ago

Running on rust 1.75.0:

RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target=aarch64-unknown-linux-musl

fails with:

error: linking with `aarch64-linux-gnu-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/work/projects/lisa/.lisa-venv-3.8/bin:/work/projects/lisa/shell/:/work/projects/lisa/tools/x86_64:/work/projects/lisa/tools/:/work/projects/lisa/tools/android-sdk-linux/tools/:/work/projects/lisa/tools/android-sdk-linux/platform-tools/:/work/projects/lisa/tools/android-sdk-linux/build-tools/34.0.0/:/home/dourai01/.cargo/bin:/home/dourai01/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/puppetlabs/bin:/home/dourai01/.local/bin" VSLANG="1033" "aarch64-linux-gnu-gcc" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o" "/tmp/rustc1PBh3i/symbols.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.00.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.01.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.02.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.03.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.04.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.05.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.06.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.07.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.08.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.09.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.10.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.11.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.12.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.13.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.14.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.trace_dump.2f90d5a7ab356903-cgu.15.rcgu.o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee.3sdm7m3bcab2kqts.rcgu.o" "-Wl,--as-needed" "-L" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps" "-L" "/work/projects/lisa/tools/trace-parser/trace-tools/target/release/deps" "-L" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/build/lz4-sys-2595212cf4dcacb3/out" "-L" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/build/zstd-sys-c7d512fb23371542/out" "-L" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/build/libdeflate-sys-88d9d235d019ae2c/out/lib" "-L" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liblib-663f79f9da0a3408.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libserde_json-c1dc623f2606afe0.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libryu-13a9dd90701f7eb6.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libitoa-83b21cacebbe1b1d.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrossbeam-3e056ddc129b3cf1.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrossbeam_deque-e96f0dc8929dd769.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrossbeam_channel-243782b681a8e215.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrossbeam_queue-272cbb983d17737d.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrossbeam_epoch-0fc1189d32ab8de1.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrossbeam_utils-66b0b00683897298.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libarrow2-0684caf7a0390600.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libforeign_vec-99fbe8918d26fad8.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libsimdutf8-9eb33b25dd06dbc8.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libdyn_clone-8ccca25a295d1a66.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libchrono-0c2c564301673e69.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbase64-93af7715f499a44d.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libethnum-121bbba9cc500d65.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libparquet2-8d7d45fe8720e37f.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzstd-3fb038b104a05d3a.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzstd_safe-d62c4c92518105a4.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liblz4-1f78f3b44be3dccb.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liblz4_sys-5c798d108112d2b8.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libflate2-d98a77428fa15594.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libminiz_oxide-271cbb033058ea94.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libadler-1cf5a91ff9bc70d6.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcrc32fast-347a24ed6a5a46e2.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbrotli-f79f2af22feeeceb.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbrotli_decompressor-9d4e7b84674f8573.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liballoc_stdlib-a528ed7cd444c048.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liballoc_no_stdlib-fd3fa0f5f484ffdd.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libasync_stream-59e801588c9f0ec8.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libstreaming_decompression-53a28d721b35b58c.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfallible_streaming_iterator-49188610fc82aa6d.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libparquet_format_safe-4b82e18a55a68d11.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures-6f54f3e88a9b71aa.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_executor-84a44012d0731054.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_util-185b9179d20b4091.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_io-d06069c20dde09cc.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libslab-cde2f1ba20a45eca.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_channel-25d3d3305387f437.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libpin_project_lite-5d2bb8f284231bbc.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_sink-19ef59dbca6890f1.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_task-03c3af76150fba2c.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libpin_utils-6e96329d2f6cdbf3.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libfutures_core-28d21c4a62570b04.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libsnap-c8351ad6d41e8eea.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libnum_traits-f3ebb169f69c69b5.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libarrow_format-48bb231909a0e213.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libplanus-d4ea8f8ecef89386.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libarray_init_cursor-4e47e9b16adb9d66.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libhashbrown-281483679b4367f7.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libahash-1e669009adbffa9a.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libgetrandom-f832c9e8fcb14816.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzerocopy-dacd185739c8df53.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libclap-f0cf1b772812cf66.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libclap_builder-c6fae364bdaebdb6.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libstrsim-4c2e4cd6e3238f54.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libanstream-27bbab3328e12d72.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libanstyle_query-bbf89215f2ee7f84.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcolorchoice-49a491ecda3efd55.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libanstyle_parse-e1f7feab2362018c.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libutf8parse-8ceb4418f5c2e5c1.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libclap_lex-240d95706c586610.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libanstyle-23c75c512fccbab1.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libtraceevent-9a430ce6d996b1de.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libmemmap2-e9f71d82079e9375.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liblibc-cc7003ff550084ad.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liblibdeflater-f098e4a5c7d48b36.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/liblibdeflate_sys-d5a5bd60c090ef80.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzstd-d208451a5eda06c2.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzstd_safe-5761144acdb71f42.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzstd_sys-0c8c8b974fd413ae.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbumpalo-cb858fc65f3584ad.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbitflags-9274f7e5c9a655d5.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libitertools-6f184d3807cc2e5c.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libeither-a00696196f05309d.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libthiserror-0fbd452cfcd8e778.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libsmartstring-1e2880b8bf7ff119.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libserde-1873681c02633d8e.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libstatic_assertions-38beee47b88fd751.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libgenawaiter-16abf03debd0f3b0.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libgenawaiter_macro-fb595a5d7b38b931.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libderef_map-2b846897a00a4291.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbytemuck-98761602b7380745.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libnom_locate-ce23f0d27d8179ee.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libbytecount-fc64e30ff242cbb5.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libnom-11311359eab7acf9.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libmemchr-529c0960ef408bd4.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libthread_local-ccd345be6a82c857.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libcfg_if-06a928694ab50d3b.rlib" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libonce_cell-d5823c7316b9ca1a.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd-a54c4e010363c2e3.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libpanic_unwind-4010db36b77a768e.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libobject-8c01afdafd577e54.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libmemchr-7f028984f1e33c40.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libaddr2line-aa7e2423c05c211b.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libgimli-1e966871a0b7bcae.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_demangle-2568fc7f8cea0211.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd_detect-803044a0ca9d0b4e.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libhashbrown-60691e01ef77b64c.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_alloc-9f7590908dc90a38.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libminiz_oxide-d07dcb31bd8ae203.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libadler-585126539727ea00.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libunwind-90c09dbf846f6cf8.rlib" "-lunwind" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libcfg_if-6417eccfbecefb1f.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-92b5f773e12779eb.rlib" "-lc" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/liballoc-a1dfaa1ac6bd309a.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_core-00c696506ff15043.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libcore-c0e7d62df1603775.rlib" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/libcompiler_builtins-38b80b5b9028b8db.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-nostartfiles" "-L" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib" "-L" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained" "-o" "/work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/trace_dump-3a37da189fb1c7ee" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o" "/home/dourai01/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: /usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /work/projects/lisa/tools/trace-parser/trace-tools/target/aarch64-unknown-linux-musl/release/deps/libzstd_sys-0c8c8b974fd413ae.rlib(zstd_v01.o): in function `memcpy':
          /usr/aarch64-linux-gnu/include/bits/string_fortified.h:34: undefined reference to `__memcpy_chk'
          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 `trace-tools` (bin "trace-dump") due to previous error
[2]    1882197 exit 101   RUSTFLAGS='-C target-feature=+crt-static' cargo build --release 
gyscos commented 8 months ago

Hi, and thanks for the report!

It seems maybe your cross-compiling C toolchain is not properly setup?

I'm testing on Archlinux, with aarch64-linux-musl-cross-bin installed, after running rustup target add aarch64-unknown-linux-musl, the command you wrote worked.

gyscos commented 8 months ago

Here's a dockerfile that sets up a minimal environment and runs the desired command:

FROM archlinux

RUN pacman -Syu rustup base-devel git --noconfirm
RUN mkdir /pkg && chmod -R 777 /pkg
USER nobody
ENV RUSTUP_HOME=/pkg/rustup
ENV CARGO_HOME=/pkg/cargo
RUN rustup default stable
RUN cd /pkg && \
    git clone https://aur.archlinux.org/aarch64-linux-musl-cross-bin && \
    cd aarch64-linux-musl-cross-bin && \
    makepkg
USER root
RUN pacman -U --noconfirm /pkg/aarch64-linux-musl-cross-bin/aarch64-linux-musl-cross-bin-*.pkg.tar.zst
USER nobody
ENV RUSTFLAGS='-C target-feature=+crt-static'
RUN rustup target add aarch64-unknown-linux-musl
RUN cd /pkg && \
    git clone https://github.com/gyscos/zstd-rs --recursive && \
    cd zstd-rs/zstd-safe/zstd-sys && \
    cargo build --release --target=aarch64-unknown-linux-musl
douglas-raillard-arm commented 8 months ago

I'll give another go to see if I can get more details. The environment is Alpine linux, and it does not distribute cross toolchains beyond clang and llvm tools. This is enough to cross compile everything else so far (at least everything that is in pure Rust, I'm not sure if I have any other C dependencies)

EDIT: the error I posted initially seems to have originated from my dev machine, not from my Alpine build env. It's using Ubuntu 20.04 with aarch64-linux-gnu- toolchain installed from the official repos.

EDIT2: I actually used export CC=clang with Ubuntu 20.04:

time CC=clang RUSTFLAGS='-Clinker=ld.lld -C target-feature=+crt-static' cargo build --release --target=aarch64-unknown-linux-musl

I suppose the issue here is that the CC is not targeting a musl build, whereas rustc is. In your setup, you properly install a musl C toolchain so the resulting object files can link cleanly against the ones produced by rustc when using a musl Rust target.

douglas-raillard-arm commented 8 months ago

I can't reproduce the issue though so I think we can close it. If I manage to hit it again I can re-open a new one, thanks for looking into that.