rust-lang / rust-lang/rust

Cannot build WASM target on freebsd: 'errno.h' file not found

Open
#162,551 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

This broke somewhere after 2026-08-20 and 2026-08-30. Unfortunately, I cannot pinpoint exact broken version as versions right after that suffer from unrelated breakages.

Command used

After upding FreeBSD port lang/rust-nightly to the latest version (2026-08-20 with bootstraps 2026-08-28) , make -C /usr/ports/lang/rust-nigthly install

Expected behaviour

Successful build.

Actual behaviour

profiler_builtins fail to build for wasm target:

   Compiling profiler_builtins v0.0.0 (/work/usr/ports/lang/rust-nightly/work/rustc-nightly-src/library/profiler_builtins)
     Running `/work/usr/ports/lang/rust-nightly/work/_build/x86_64-unknown-freebsd/stage1-std/dist/build/profiler_builtins/72636cab5acea68e/out/build_script_build`
warning: profiler_builtins@0.0.0: /work/usr/ports/lang/rust-nightly/work/rustc-nightly-src/src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c:29:10: fatal error: 'errno.h' file not found
warning: profiler_builtins@0.0.0:    29 | #include <errno.h>
warning: profiler_builtins@0.0.0:       |          ^~~~~~~~~
warning: profiler_builtins@0.0.0: 1 error generated.
error: failed to run custom build command for `profiler_builtins v0.0.0 (/work/usr/ports/lang/rust-nightly/work/rustc-nightly-src/library/profiler_builtins)`

Notably, WASM target can be disabled in FreeBSD port, and rust builds fine if it is.

Bootstrap configuration (bootstrap.toml)
[build]
build-dir="/usr/ports/lang/rust-nightly/work/_build"
build-stage=2
doc-stage=2
test-stage=2
vendor=true
extended=true
python="/usr/local/bin/python3.12"
docs=false
verbose=2
profiler=true
target=["x86_64-unknown-freebsd","wasm32-unknown-unknown"]
cargo="/usr/ports/lang/rust-nightly/work/bootstrap/bin/cargo"
rustc="/usr/ports/lang/rust-nightly/work/bootstrap/bin/rustc"
tools=["analysis","cargo","clippy","rust-analyzer","rustdoc","rustfmt","src","miri","cargo-miri"]
ccache=false
[install]
prefix="/usr/ports/lang/rust-nightly/prefix"
sysconfdir="/usr/ports/lang/rust-nightly/prefix/etc"
[rust]
channel="nightly"
default-linker="cc"
deny-warnings=false
verbose-tests=true
download-rustc=false
lld=true
lto="thin"
remap-debuginfo=true
[llvm]
download-ci-llvm=false
clang=true
thin-lto=true
ninja=true
[target.x86_64-unknown-freebsd]
ar="ar"
cc="cc"
cxx="c++"
linker="cc"
[target.wasm32-unknown-unknown]
ar="ar"
cc="/usr/ports/lang/rust-nightly/work/_build/x86_64-unknown-freebsd/llvm/bin/clang"
cxx="/usr/ports/lang/rust-nightly/work/_build/x86_64-unknown-freebsd/llvm/bin/clang++"
linker="/usr/ports/lang/rust-nightly/work/_build/x86_64-unknown-freebsd/llvm/bin/clang"
[dist]
compression-formats=["xz"]
src-tarball=false
Operating system

FreeBSD 15.1

HEAD

cea272fa356e94bd2ee2cadf376630aa0683867a

Additional context

Full build log: https://people.freebsd.org/~amdmi3/rust.log
For reference, successful log for older version, 2026-08-20: https://people.freebsd.org/~amdmi3/rust20.log

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

Start with the failing profiler_builtins build and the compiler-rt file library/profiler_builtins invokes, src/llvm-project/compiler-rt/lib/profile/GCDAProfiling.c. Compare the wasm32-unknown-unknown compiler and linker settings in bootstrap.toml with the successful older build log and the failing log. Done means the FreeBSD port builds successfully with the WASM target enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.