On FreeBSD 14.3 "ld: error" when trying to build and run "hello world" program
⚓ Rust 📅 2026-01-10 👤 surdeus 👁️ 1I was trying to run a small "hello world" program and received a few errors. This is one of them. I have a new Rust installation with Cargo on FreeBSD14.2
root@user-ghostbsd:/home/user/Downloads/memory # cargo run
Compiling proc-macro2 v1.0.105
Compiling quote v1.0.43
Compiling libm v0.2.15
Compiling libc v0.2.180
Compiling serde_core v1.0.228
Compiling portable-atomic v1.13.0
Compiling serde v1.0.228
Compiling rustix v1.1.3
error: linking with cc failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/rustcYZEtLK/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/lib/rustlib/x86_64-unknown-freebsd/lib/{libstd-,libpanic_unwind-,libobject-,libmemchr-,libaddr2line-,libgimli-,libcfg_if-,librustc_demangle-,libstd_detect-,libhashbrown-,librustc_std_workspace_alloc-,libminiz_oxide-,libadler2-,libunwind-,liblibc-,librustc_std_workspace_core-,liballoc-,libcore-,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lrt" "-lutil" "-lexecinfo" "-lkvm" "-lmemstat" "-lkvm" "-lutil" "-lprocstat" "-lrt" "-ldevstat" "-L" "/tmp/rustcYZEtLK/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-o" "/home/user/Downloads/memory/target/debug/build/quote-ebcbd81c14b23f6f/build_script_build-ebcbd81c14b23f6f" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use --verbose to show all linker arguments
= note: ld: error: cannot open Scrt1.o: No such file or directory
ld: error: cannot open crti.o: No such file or directory
ld: error: cannot open crtbeginS.o: No such file or directory
ld: error: unable to find library -lexecinfo
ld: error: unable to find library -lpthread
ld: error: unable to find library -lgcc_s
ld: error: unable to find library -lc
ld: error: unable to find library -lm
ld: error: unable to find library -lrt
ld: error: unable to find library -lpthread
ld: error: unable to find library -lrt
ld: error: unable to find library -lutil
ld: error: unable to find library -lexecinfo
ld: error: unable to find library -lkvm
ld: error: unable to find library -lmemstat
ld: error: unable to find library -lkvm
ld: error: unable to find library -lutil
ld: error: unable to find library -lprocstat
ld: error: unable to find library -lrt
ld: error: unable to find library -ldevstat
ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
There a few more errors, but each is about the same as the one above. I am new to Rust and FreeBSD (coming from Ubuntu Linux). Any help with this is appreciated much. Thanks.
1 post - 1 participant
🏷️ Rust_feed