Bug 284298 - lang/rust: remove COMPAT_FREEBSD11 sanity check canary script
Summary: lang/rust: remove COMPAT_FREEBSD11 sanity check canary script
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Rust Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-23 21:41 UTC by Siva Mahadevan
Modified: 2025-11-13 14:58 UTC (History)
8 users (show)

See Also:
bugzilla: maintainer-feedback? (rust)


Attachments
[PATCH] lang/rust: remove COMPAT_FREEBSD11 sanity check canary script (6.08 KB, patch)
2025-01-23 21:41 UTC, Siva Mahadevan
no flags Details | Diff
rerolled rust patch (5.36 KB, patch)
2025-03-06 21:23 UTC, Mark Linimon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Siva Mahadevan freebsd_triage 2025-01-23 21:41:56 UTC
Created attachment 256940 [details]
[PATCH] lang/rust: remove COMPAT_FREEBSD11 sanity check canary script

This change removes the rust-compat11-canary.sh sanity check script (which
ensures COMPAT_FREEBSD11 is set in the active kernel). It is no longer
needed in the following files:

* lang/rust*, Mk/Uses/cargo.mk, Mk/bsd.gecko.mk:
  Commit https://github.com/rust-lang/libc/commit/f5172d29959326a45bd6cef88c38896bf3aeb479
  is merged into the std libc since 0.2.151. The earliest version of rust that bundles this
  stdlib is rust 1.78.
* lang/rust182: same as above reason
* lang/go-devel: Go 1.20 removes the need for COMPAT_FREEBSD11. See
  -> https://go.dev/wiki/FreeBSD
  -> closed issue https://github.com/golang/go/issues/53280 containing all
     the commits that fix this
  -> commits https://github.com/golang/go/commit/d8220ac32fc73e69aa6d58890b6b5277d277825f
     and https://github.com/golang/go/commit/e0e1ce9888f5483f834e435d53f5c6c42b9b12a1 that
     remove the need for COMPAT_FREEBSD11 and are in go 1.20+
Comment 1 Piotr Kubaj freebsd_committer freebsd_triage 2025-01-24 10:06:09 UTC
For Rust ports, there are still many ports using older libc, so I'm afraid this will have to stay, unless they are upgraded to at least 0.2.151:
   1 (rust/crates/libc-0.2.108.crate)
   1 (rust/crates/libc-0.2.113.crate)
   1 (rust/crates/libc-0.2.122.crate)
   1 (rust/crates/libc-0.2.123.crate)
   1 (rust/crates/libc-0.2.127.crate)
   1 (rust/crates/libc-0.2.134.crate)
   1 (rust/crates/libc-0.2.145.crate)
   1 (rust/crates/libc-0.2.146.crate)
   1 (rust/crates/libc-0.2.49.crate)
   1 (rust/crates/libc-0.2.54.crate)
   1 (rust/crates/libc-0.2.58.crate)
   1 (rust/crates/libc-0.2.65.tar.gz)
   1 (rust/crates/libc-0.2.66.tar.gz)
   1 (rust/crates/libc-0.2.68.tar.gz)
   1 (rust/crates/libc-0.2.69.crate)
   1 (rust/crates/libc-0.2.69.tar.gz)
   1 (rust/crates/libc-0.2.70.crate)
   1 (rust/crates/libc-0.2.70.tar.gz)
   1 (rust/crates/libc-0.2.73.crate)
   1 (rust/crates/libc-0.2.74.crate)
   1 (rust/crates/libc-0.2.81.crate)
   1 (rust/crates/libc-0.2.86.tar.gz)
   1 (rust/crates/libc-0.2.87.crate)
   1 (rust/crates/libc-0.2.88.tar.gz)
   1 (rust/crates/libc-0.2.92.crate)
   1 (rust/crates/libc-0.2.93.crate)
   1 (rust/crates/libc-0.2.93.tar.gz)
   1 (rust/crates/libc-0.2.95.crate)
   2 (rust/crates/libc-0.2.101.crate)
   2 (rust/crates/libc-0.2.107.crate)
   2 (rust/crates/libc-0.2.116.crate)
   2 (rust/crates/libc-0.2.119.crate)
   2 (rust/crates/libc-0.2.120.crate)
   2 (rust/crates/libc-0.2.131.crate)
   2 (rust/crates/libc-0.2.132.crate)
   2 (rust/crates/libc-0.2.135.crate)
   2 (rust/crates/libc-0.2.62.crate)
   2 (rust/crates/libc-0.2.71.tar.gz)
   2 (rust/crates/libc-0.2.79.tar.gz)
   2 (rust/crates/libc-0.2.99.crate)
   3 (rust/crates/libc-0.2.103.crate)
   3 (rust/crates/libc-0.2.121.crate)
   3 (rust/crates/libc-0.2.124.crate)
   3 (rust/crates/libc-0.2.138.crate)
   3 (rust/crates/libc-0.2.141.crate)
   3 (rust/crates/libc-0.2.142.crate)
   3 (rust/crates/libc-0.2.49.tar.gz)
   3 (rust/crates/libc-0.2.66.crate)
   3 (rust/crates/libc-0.2.80.tar.gz)
   3 (rust/crates/libc-0.2.82.crate)
   3 (rust/crates/libc-0.2.97.crate)
   3 (rust/crates/libc-0.2.98.crate)
   5 (rust/crates/libc-0.2.112.crate)
   5 (rust/crates/libc-0.2.125.crate)
   5 (rust/crates/libc-0.2.137.crate)
   5 (rust/crates/libc-0.2.144.crate)
   7 (rust/crates/libc-0.2.126.crate)
   8 (rust/crates/libc-0.2.148.crate)
   9 (rust/crates/libc-0.2.149.crate)
  10 (rust/crates/libc-0.2.140.crate)
  11 (rust/crates/libc-0.2.150.crate)
  18 (rust/crates/libc-0.2.147.crate)
  21 (rust/crates/libc-0.2.139.crate)

I'm not sure about go, but I think it will be similar there.
Comment 2 Siva Mahadevan freebsd_triage 2025-01-24 13:37:21 UTC
(In reply to Piotr Kubaj from comment #1)
Can you share your script to produce these results? I'd like to keep the bug open and "in progress" if possible. I'll slowly attempt to whittle down this list by upgrading these crates/ports upstream, then revisit this bug.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2025-03-06 21:23:23 UTC
Created attachment 258367 [details]
rerolled rust patch

^Triage: rerolled patch with changes to obsolete lang/rust182 elided.
Comment 4 Siva Mahadevan freebsd_triage 2025-03-11 02:43:30 UTC
(In reply to Piotr Kubaj from comment #1)
Just a quick bump, could you share your script that produced these search results?
Comment 5 Mikael Urankar freebsd_committer freebsd_triage 2025-03-11 08:19:11 UTC
(In reply to Siva Mahadevan from comment #4)
You can use something like that 
grep -r "rust/crates/libc-0.2.*crate" | awk /SIZE/'{print $2}' | sort | uniq -c | sort
Comment 6 epopen 2025-04-10 01:38:09 UTC
(In reply to Mark Linimon from comment #3)
Hi Siva Mahadevan & Mark Linimon 

Thanks your patch.
I had apply and test it and got build failed as follows for reference.

install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/lib/rustlib/x86_64-unknown-freebsd/bin/rust-objcopy
install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/share/doc/rust/COPYRIGHT
install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/share/doc/rust/LICENSE-APACHE
install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/share/doc/rust/LICENSE-MIT
install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/share/doc/rust/README.md
install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/share/man/man1/rustc.1
install: copying file /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/share/man/man1/rustdoc.1

    rustc installed.

===>  Building for rust-1.86.0
Building bootstrap
running: /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/cargo build --manifest-path /usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/Cargo.toml -Zroot-dir=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src --verbose --verbose --frozen
   Compiling libc v0.2.167
   Compiling proc-macro2 v1.0.89
     Running `CARGO=/usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/libc-0.2.167 CARGO_MANIFEST_PATH=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/libc-0.2.167/Cargo.toml CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION=1.63 CARGO_PKG_VERSION=0.2.167 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=167 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps:' /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/rustc --crate-name build_script_build --edition=2021 /usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/libc-0.2.167/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=135 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=8db02bb8dabfa2bb -C extra-filename=-8815617aee9109f7 --out-dir /usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/build/libc-8815617aee9109f7 -C strip=debuginfo -L dependency=/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps --cap-lints warn -Zallow-features= -C linker=cc -Wrust_2018_idioms -Wunused_lifetimes`
     Running `CARGO=/usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/proc-macro2-1.0.89 CARGO_MANIFEST_PATH=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/proc-macro2-1.0.89/Cargo.toml CARGO_PKG_AUTHORS='David Tolnay <dtolnay@gmail.com>:Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_DESCRIPTION='A substitute implementation of the compiler'\''s `proc_macro` API to decouple token-based libraries from the procedural macro use case.' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=proc-macro2 CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/dtolnay/proc-macro2' CARGO_PKG_RUST_VERSION=1.56 CARGO_PKG_VERSION=1.0.89 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=89 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps:' /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/rustc --crate-name build_script_build --edition=2021 /usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/proc-macro2-1.0.89/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=135 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "nightly", "proc-macro", "span-locations"))' -C metadata=62220295272fafe7 -C extra-filename=-ff9f883ce77dec02 --out-dir /usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/build/proc-macro2-ff9f883ce77dec02 -C strip=debuginfo -L dependency=/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps --cap-lints warn -Zallow-features= -C linker=cc -Wrust_2018_idioms -Wunused_lifetimes`
error: could not compile `proc-macro2` (build script)

Caused by:
  process didn't exit successfully: `CARGO=/usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/proc-macro2-1.0.89 CARGO_MANIFEST_PATH=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/proc-macro2-1.0.89/Cargo.toml CARGO_PKG_AUTHORS='David Tolnay <dtolnay@gmail.com>:Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_DESCRIPTION='A substitute implementation of the compiler'\''s `proc_macro` API to decouple token-based libraries from the procedural macro use case.' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=proc-macro2 CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/dtolnay/proc-macro2' CARGO_PKG_RUST_VERSION=1.56 CARGO_PKG_VERSION=1.0.89 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=89 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps:' /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/rustc --crate-name build_script_build --edition=2021 /usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/proc-macro2-1.0.89/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=135 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="proc-macro"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "nightly", "proc-macro", "span-locations"))' -C metadata=62220295272fafe7 -C extra-filename=-ff9f883ce77dec02 --out-dir /usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/build/proc-macro2-ff9f883ce77dec02 -C strip=debuginfo -L dependency=/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps --cap-lints warn -Zallow-features= -C linker=cc -Wrust_2018_idioms -Wunused_lifetimes` (signal: 12, SIGSYS: bad system call)
warning: build failed, waiting for other jobs to finish...
error: could not compile `libc` (build script)

Caused by:
  process didn't exit successfully: `CARGO=/usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/libc-0.2.167 CARGO_MANIFEST_PATH=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/libc-0.2.167/Cargo.toml CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
  ' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_RUST_VERSION=1.63 CARGO_PKG_VERSION=0.2.167 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=167 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps:' /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/rustc --crate-name build_script_build --edition=2021 /usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/vendor/libc-0.2.167/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=135 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("align", "const-extern-fn", "default", "extra_traits", "rustc-dep-of-std", "rustc-std-workspace-core", "std", "use_std"))' -C metadata=8db02bb8dabfa2bb -C extra-filename=-8815617aee9109f7 --out-dir /usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/build/libc-8815617aee9109f7 -C strip=debuginfo -L dependency=/usr/PortsWRKDIR/usr/ports/lang/rust/work/_build/bootstrap/debug/deps --cap-lints warn -Zallow-features= -C linker=cc -Wrust_2018_idioms -Wunused_lifetimes` (signal: 12, SIGSYS: bad system call)
Traceback (most recent call last):
  File "/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/x.py", line 53, in <module>
    bootstrap.main()
  File "/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 1339, in main
    bootstrap(args)
  File "/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 1306, in bootstrap
    build.build_bootstrap()   
  File "/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 1010, in build_bootstrap
    run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
  File "/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/bootstrap.py", line 236, in run
    raise RuntimeError(err)   
RuntimeError: failed to run: /usr/PortsWRKDIR/usr/ports/lang/rust/work/bootstrap/bin/cargo build --manifest-path /usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src/src/bootstrap/Cargo.toml -Zroot-dir=/usr/PortsWRKDIR/usr/ports/lang/rust/work/rustc-1.86.0-src --verbose --verbose --frozen
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/lang/rust
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/rust

===>>> make build failed for lang/rust
===>>> Aborting update  


Thanks a lot.
Comment 7 Siva Mahadevan freebsd_triage 2025-04-10 01:40:28 UTC
(In reply to epopen from comment #6)

The patch is not yet ready due to all the upstream (or local patch) libc version updates that are required from comment #1. We're not yet ready to remove the COMPAT_FREEBSD11 sanity check.