rust-lang / rust-lang/rust

the rust build fails on FreeBSD/amd64-14 due to not finding libzstd despite it being installed on the build host.

Open
#135,503 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-freebsd T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried building rust (on FreeBSD/amd64 14.0) from today's clone (HEAD is 8c39ce5b4fb5b61796e5fd8cec56c7b9abd2122b)

./configure --set install.prefix=$HOME --set install.sysconfdir=$HOME/etc --llvm-root=/usr/local/llvm19
./x.py build

It ended unsuccessfully with the following:

   Compiling rustc_driver v0.0.0 (/home/woods/work/m-rust/compiler/rustc_driver)
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-sysroot/lib/rustlib/x86_64-unknown-freebsd/bin:/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/bin:/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0/lib/rustlib/x86_64-unknown-freebsd/bin:/home/woods/pkg/bin:/home/woods/bin:/bin:/usr/bin:/usr/local/bin:" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustcAGOOXN/list" "-Wl,--no-undefined-version" "-m64" "/tmp/rustcAGOOXN/symbols.o" "<1 object files omitted>" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/deps/rustc_driver-678ab8838275942c.0bj53j4cvoxvg8zvx88oek9t7.rcgu.rmeta" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/deps/{librustc_driver_impl-4bae2b5e07e44ec5.rlib,libctrlc-71f931fb16bec6af.rlib,libnix-1442dacdc2c23b79.rlib,librustc_log-c0d6dbecb9cd6dd4.rlib,libtracing_tree-df3639e168c3645e.rlib,libtracing_log-f99def6756aafc8e.rlib,libnu_ansi_term-a98b4f33bd82980a.rlib,libtracing_subscriber-4af61ac18f717d43.rlib,libnu_ansi_term-3b384a8bc7193777.rlib,liboverload-8fc38ace4bb4d4d5.rlib,libsharded_slab-a2f9aa0cd3f25a45.rlib,liblazy_static-914814e95529954b.rlib,libmatchers-067e388262b33701.rlib,libregex_automata-4adedaf6ee0fa036.rlib,libregex_syntax-4c39ade0ad89ae6d.rlib,libthread_local-c4030bc03cb07099.rlib,librustc_smir-94aa48ecbee0c0d4.rlib,libstable_mir-0621e0b5a08f8701.rlib,libtime-d1304a4bb48a1848.rlib,libtime_core-b734096f6ecb5eb5.rlib,libnum_conv-3e0c51cc5fed482c.rlib,libderanged-008beceb12e7b50a.rlib,libpowerfmt-3e9933fe193a019f.rlib,librustc_interface-61ed7d2625417c15.rlib,librustc_codegen_llvm-25c7a8ed8c5465b5.rlib,librustc_llvm-274993179981bcc4.rlib,librustc_sanitizers-d264b09a88f43596.rlib,librustc_hir_typeck-b03ff094e3a2218b.rlib,librustc_hir_analysis-d234234108a003c5.rlib,librustc_monomorphize-c6e8114b8224cda7.rlib,librustc_mir_transform-4e37530aca707852.rlib,librustc_mir_build-9ea12534cbd67e09.rlib,librustc_pattern_analysis-1339abb6211c245e.rlib,librustc_borrowck-9d8433099891f68b.rlib,librustc_traits-958b3148185c2a3c.rlib,librustc_const_eval-c2146265b7408c4d.rlib,librustc_mir_dataflow-2a0f908c13915c17.rlib,librustc_ast_lowering-67063c831bd5d3ab.rlib,librustc_builtin_macros-d22d1eb4f2c29dd5.rlib,librustc_resolve-e53c128ec5f51623.rlib,libpulldown_cmark-68b5c2f2c499d835.rlib,libunicase-8acba8277f961efd.rlib,libpulldown_cmark_escape-723191d07bc8e169.rlib,librustc_passes-319ce4cdcd47d95d.rlib,librustc_privacy-187c6eae831ed696.rlib,librustc_ty_utils-7b4363f085be8f28.rlib,librustc_query_impl-a5f444cae3f476ff.rlib,librustc_lint-45b4eac1ae9f7f25.rlib,libunicode_security-2305730dac9c3b6b.rlib,libunicode_script-ae2a107fc491f12d.rlib,librustc_codegen_ssa-9170e61d173a58b9.rlib,libwasm_encoder-c1005a5681831cf0.rlib,libleb128-4ea5827ad7ab45ca.rlib,libthorin-4836e2f36c09df26.rlib,libhashbrown-acb128d3aafd8e04.rlib,libahash-ca3b6da3e6d427e9.rlib,liballocator_api2-65278355585bae51.rlib,libgimli-754ad356442ad26e.rlib,libfallible_iterator-7b97c71b81546f0e.rlib,librustc_symbol_mangling-aa81523337a2e783.rlib,librustc_demangle-063ce806a6dfa9ed.rlib,libpunycode-9d3c60cfc702bf02.rlib,librustc_trait_selection-b13e11ce3ba168f1.rlib,librustc_next_trait_solver-c705d25318f657cc.rlib,librustc_parse_format-1b833b63b367e737.rlib,librustc_transmute-0a9bc7d98bae3125.rlib,librustc_infer-3f52bd30dec15574.rlib,librustc_incremental-a9515441c3ab6d5c.rlib,libpathdiff-e9ecf6c05ed4f809.rlib,librustc_metadata-3015d800c2ea1fdf.rlib,liblibloading-5e7d99a01c821283.rlib,librustc_expand-595875b815d92e43.rlib,librustc_ast_passes-d41e714d79deacb3.rlib,librustc_parse-e92fc18d31ec22b9.rlib,libunicode_normalization-66e2a5fd6170449c.rlib,libtinyvec-9943206937676f25.rlib,libtinyvec_macros-37be9b660011dd03.rlib}" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-sysroot/lib/rustlib/x86_64-unknown-freebsd/lib/{libproc_macro-96ee6d83eae46b34.rlib}" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/deps/{libregex-2bea9ac640f180bf.rlib,libregex_automata-647e0511891b8f0f.rlib,libaho_corasick-f23555996dc4619d.rlib,libregex_syntax-64253bda1bda70db.rlib,libcc-6e9b4ff5d6443c9f.rlib,libshlex-be60fb23f5fe6fec.rlib,libar_archive_writer-2a8b4e1afb1943a4.rlib,librustc_middle-484b1881b6f3c05c.rlib,libfield_offset-593055940b88c5e9.rlib,libmemoffset-d9b0c3210aca29f5.rlib,librustc_apfloat-4e7872f929d403e9.rlib,libgsgdt-564226be9f7ca74a.rlib,libpolonius_engine-bb3a22c6e2244dca.rlib,libdatafrog-135888ec959203c9.rlib,librustc_query_system-d4ea58f31d4db76b.rlib,librustc_attr_parsing-38c8b27306098089.rlib,librustc_attr_data_structures-65c40a1a6cda555b.rlib,librustc_session-0e9871ae42652270.rlib,libgetopts-27aa0516e322f727.rlib,libunicode_width-bc149f880e63bd63.rlib,librustc_hir_pretty-206eb5f8dd19d9b1.rlib,librustc_errors-f946bf2f8e700c80.rlib,libtermize-ce3ec6ba467a42cd.rlib,librustc_error_codes-b9d8df4e46351aac.rlib,librustc_type_ir-f54c70b1dfc386e8.rlib,librustc_ast_pretty-12b7ff69144951bd.rlib,libitertools-3e3ff0b1c8d4bf49.rlib,libannotate_snippets-9b20301b1b3d9a87.rlib,libanstyle-84c992b12f50dac3.rlib,libtermcolor-654ba8bbb92e5984.rlib,librustc_lint_defs-ea7ebf96a83bb970.rlib,librustc_error_messages-2356bf78fa6678d6.rlib,librustc_baked_icu_data-a98d4ebe25fa9af6.rlib,libicu_list-ac9b7ea4ce1ab578.rlib,libicu_list_data-8ee642e65c15914c.rlib,libregex_automata-cc7a3a7523062e6e.rlib,libicu_provider_adapters-38158b6002458522.rlib,libicu_locid_transform-eec6a847293ac9fc.rlib,libicu_locid_transform_data-825f90b22a433841.rlib,libicu_provider-df9a8027f2c847be.rlib,libicu_locid-78a1a244a3a8ac5b.rlib,liblitemap-93d975e2cd116bb1.rlib,libwriteable-5ae134a171443db4.rlib,libfluent_bundle-4aa5dfb4a552ec40.rlib,libfluent_langneg-7bfa05aa09c9f74a.rlib,libintl_pluralrules-4c1d35599ac487d0.rlib,libself_cell-5d8fd69232569989.rlib,libself_cell-b0ff3ef64a40c698.rlib,libintl_memoizer-2d9750366ebb1874.rlib,libtype_map-3cc803b01bff4da3.rlib,libunic_langid-dceccb47dd44dd89.rlib,libunic_langid_macros-4640b415f304e02a.rlib,libunic_langid_impl-d794a6b3c4630e82.rlib,libtinystr-a57119c43811c860.rlib,libzerovec-beda1b95e521d919.rlib,libyoke-6f7618785e8dbfa2.rlib,libzerofrom-4812fbb32d1507f6.rlib,libfluent_syntax-392311bd6333574a.rlib,libthiserror-37aa34d6eddcecf9.rlib,librustc_hir-71b742c708031fd7.rlib,libodht-ea3cfec055e891b6.rlib,librustc_target-224f6d47fb75a45e.rlib,libobject-39e2d0036a658f7a.rlib,libruzstd-50a940a4324ec02c.rlib,libtwox_hash-82a4ca5450c07ed6.rlib,libstatic_assertions-e68e80149a9f58f3.rlib,libflate2-406a8709afe5980d.rlib,libminiz_oxide-a648d51f161daac9.rlib,libadler2-fb1fb62726045bf1.rlib,libcrc32fast-00805bfffac5de92.rlib,libwasmparser-fdf733c5576d8c4f.rlib,librustc_fs_util-36e75bf255966d88.rlib,librustc_abi-aee6187d68fa8f5c.rlib,librustc_feature-892a64a2c7f3bc8f.rlib,libserde_json-aadd8bc2513e3f81.rlib,libryu-c464a3fbe63b3bcf.rlib,libserde-8d95b7475b55d2a4.rlib,librand_xoshiro-27378eabb6871455.rlib,librand-52d716baae3ac197.rlib,librand_chacha-2b6daeb70e843955.rlib,libppv_lite86-04fe3b6371f86655.rlib,libzerocopy-828797d8768a7475.rlib,libbyteorder-5283af83e54dc47e.rlib,librand_core-d38b5d372c69d418.rlib,librustc_ast-08a251c6832351a6.rlib,libmemchr-0534aa5fd4e2537b.rlib,librustc_ast_ir-382b2f0be9d1f26b.rlib,librustc_lexer-4788e64988e83250.rlib,libunicode_xid-63b77864dd1deb85.rlib,libunicode_properties-954574c360b909b3.rlib,librustc_span-adb841bb52e9683a.rlib,libunicode_width-6c56bd6c6c225ae3.rlib,libblake3-ef07d89ededadc67.rlib,libconstant_time_eq-8211d5e9dcefa3db.rlib,libarrayref-4110a6e4434e2df8.rlib,libitoa-97de34720279d13b.rlib,libscoped_tls-28b3ced1ae35c388.rlib,libsha2-751b38e1ee150a21.rlib,libsha1-73755c23bdb322cf.rlib,libcpufeatures-8f745d695829d317.rlib,libmd5-5d6eead03ad06579.rlib,libdigest-66f3498185594879.rlib,libblock_buffer-7d595291c034ede8.rlib,libcrypto_common-a57783a659a1aff5.rlib,libgeneric_array-353d10e05a4d71a9.rlib,libtypenum-760c1e2613e03e75.rlib,librustc_data_structures-1053647515096a54.rlib,libelsa-8096b935d4697546.rlib,libstable_deref_trait-9712baa2c8bc7388.rlib,libstacker-27c30d4695daed8a.rlib,libpsm-64b545ee7521e23d.rlib,libmemmap2-6adc1efc15a27a67.rlib,librustc_arena-5db0bf02ab8f9233.rlib,libtempfile-bfdefe5410259fda.rlib,libgetrandom-721e4f81a8dd825a.rlib,libfastrand-1fd238d90c73318f.rlib,librustix-44eaff68ea54eb49.rlib,libbitflags-f03bd5a3a2eadeab.rlib,liberrno-e4500660b0f7bbb6.rlib,librustc_stable_hash-b2fef44724b745b4.rlib,libarrayvec-3df6e03caacc1602.rlib,libmeasureme-a11b9e6d02c245b1.rlib,librustc_hash-3a80cf31c5eb998f.rlib,libparking_lot-3f85b0f41caa1d58.rlib,libparking_lot_core-9a1ca066262f7d18.rlib,liblock_api-7b110236eee6ec51.rlib,libscopeguard-dd9f46b9888d511a.rlib,librustc_graphviz-bce1cb9bd7e0b48c.rlib,libjobserver-0906cfd33a10f04e.rlib,libtracing-05e162d36b3dc762.rlib,libcfg_if-93f68ca2cfeae092.rlib,libpin_project_lite-d5321628bd2b0cc8.rlib,libtracing_core-cb13cd587f3cea2d.rlib,libonce_cell-edfc948814f25d31.rlib,librustc_hash-3383be06cb568c81.rlib,librustc_index-3db69d9a816b3639.rlib,librustc_serialize-0839f2b3f7ac629f.rlib,libindexmap-50c421918c915529.rlib,libequivalent-d5de69d1a0ce348b.rlib,librayon-455e3a2ba8168a6c.rlib,librayon_core-617cec76f7e4e92e.rlib,libnum_cpus-0ccb12dbc54ca1bf.rlib,liblibc-9ba6b2a659063125.rlib,libcrossbeam_deque-0ddec9b29b4d9196.rlib,libcrossbeam_epoch-0101bfe3c3ae7290.rlib,libcrossbeam_channel-5e671f5d1760fba6.rlib,libcrossbeam_utils-e6d36c606961ae0b.rlib,libeither-34c50a8e6c5afbec.rlib,libhashbrown-999d4dc558f71ad2.rlib,libfoldhash-c70e8f802b9f757b.rlib,libthin_vec-98e722f8714e6247.rlib,libsmallvec-dc0381fe1ecd023f.rlib,libena-5f114bda1d55ee57.rlib,liblog-bf4c16985b990e5e.rlib}" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-sysroot/lib/rustlib/x86_64-unknown-freebsd/lib/{libstd-9922f423544429c4.rlib,libpanic_unwind-a2e9435a70d003be.rlib,libobject-a2cbacc1d9b0cbb6.rlib,libmemchr-abfb5a964f1f530a.rlib,libaddr2line-5fafdcabda5449e2.rlib,libgimli-38f8fa3b8a8c44ee.rlib,librustc_demangle-9295d63a05b32ed3.rlib,libstd_detect-562bc339c6ae89c6.rlib,libhashbrown-94276790940a08b7.rlib,librustc_std_workspace_alloc-d5e9c95677475f2d.rlib,libminiz_oxide-fe15f28d5b78702e.rlib,libadler2-602fd801b8e4808c.rlib,libunwind-557a67c374cbc641.rlib,libcfg_if-d243372002117ff8.rlib,liblibc-7cddd3f0c774adf1.rlib,liballoc-18859d5d405dba87.rlib,librustc_std_workspace_core-7fc511c2f3ba90f3.rlib,libcore-e20f11d3e16bf07e.rlib,libcompiler_builtins-fd24d3e3bbb46650.rlib}" "-Wl,-Bdynamic" "-lPolly" "-lPollyISL" "-lrt" "-lexecinfo" "-lpthread" "-lm" "-lz" "-lzstd" "-lc++" "-lc" "-lrt" "-lutil" "-lexecinfo" "-lkvm" "-lmemstat" "-lkvm" "-lutil" "-lprocstat" "-lrt" "-ldevstat" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lrt" "-lutil" "-lexecinfo" "-lkvm" "-lmemstat" "-lkvm" "-lutil" "-lprocstat" "-lrt" "-ldevstat" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/psm-436e38c2f952a9a4/out" "-L" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/blake3-c3090fa4edb10df8/out" "-L" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/blake3-c3090fa4edb10df8/out" "-L" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/build/rustc_llvm-df31628df9f34818/out" "-L" "/usr/local/llvm19/lib" "-o" "/home/woods/work/m-rust/build/x86_64-unknown-freebsd/stage0-rustc/x86_64-unknown-freebsd/release/deps/librustc_driver-678ab8838275942c.so" "-shared" "-Wl,-soname=librustc_driver-678ab8838275942c.so" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: ld: error: unable to find library -lzstd
          cc: error: linker command failed with exit code 1 (use -v to see invocation)
 

Note that zstd is installed:

# pkg info | grep zstd
zstd-1.5.6                     Fast real-time compression algorithm

Obviously the build isn't looking in /usr/local for installed libraries, and I don't see any obvious option in the configure script to tell it either to look there generically by default, or even to look there explicitly for libzstd.

# pkg shlib libzstd.so.1
libzstd.so.1 is provided by the following packages:
zstd-1.5.6
libzstd.so.1 is linked to by the following packages:
llvm15-15.0.7_10
mesa-dri-24.0.7
rsync-3.3.0
tiff-4.4.0_3
binutils-2.43.1,1
llvm19-19.1.6

Perhaps this is one of those intermediate library rpath problems, but anyway, how do I tell x.py to always look in /usr/local for more libraries?

System info:

$ uname -a                                                                                               
FreeBSD fezzik 14.0-RELEASE-p4 FreeBSD 14.0-RELEASE-p4 #0 releng/14.0-4edf3b807: Sat Dec 30 17:43:31 EST 2023     root@worm:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-ZFS amd64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the FreeBSD/amd64-14 failure with the reported ./configure options and ./x.py build command. Trace the build configuration and link arguments that produce -lzstd, then verify that a clean Rust build succeeds with libzstd installed on the host.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.