Abort build early when the kernel does not have it. Prevent regular bug reports that deal with this.
It seems some sysctl are not present if COMPAT_FREEBSD11 is missing: https://github.com/libstatgrab/libstatgrab/issues/103, why not checking if sysctl vm.stats.vm.v_cache_count suceeds (I haven't tried if it works to be honest)?
Anyway, the issue is not limited to rust. People can have the problem doing the following:
pkg add rust make -C /usr/ports/www/firefox
The check should probably be duplicated in every consumers (cargo.mk, bsd.gecko.mk...)
I have tested this patch, since I had a kernel without COMPAT_ options around and it does what it tries, this is the output in poudriere:
=========================================================================== =======================<phase: configure >============================ ===> Configuring for rust-1.40.0 ===> FreeBSD 10 autotools fix applied to /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/vendor/libssh2-sys/libssh2/config.rpath ===> FreeBSD 10 autotools fix applied to /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/vendor/backtrace-sys/src/libbacktrace/config/libtool.m4 ===> FreeBSD 10 autotools fix applied to /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/vendor/backtrace-sys/src/libbacktrace/configure Bad system call => Sanity check failed: kernel is missing COMPAT_FREEBSD11 => Aborting build *** Error code 1 Stop. make: stopped in /usr/ports/lang/rust =>> Cleaning up wrkdir ===> Cleaning for rust-1.40.0
Looks ugly and doesn't cover runtime (see below) but I won't block landing.
$ pkg install rust ripgrep $ truss rustc test.rs 2>&1 | tail -5 compat11.stat("(null)",0x0) ERR#78 'Function not implemented' SIGNAL 12 (SIGSYS) code=SI_KERNEL _umtx_op(0x8011f3500,UMTX_OP_WAIT,0x188aa,0x0,0x0) ERR#4 'Interrupted system call' <thread 100951 exited> process killed, signal = 12 $ truss rg test 2>&1 | tail -3 compat11.stat("(null)",0x0) ERR#78 'Function not implemented' SIGNAL 12 (SIGSYS) code=SI_KERNEL process killed, signal = 12
|382 ↗||(On Diff #66613)|
Necessary for what? www/firefox has lots of dependencies. Please, document why the quirk is needed rather than what it does.
|386 ↗||(On Diff #66613)|
|| and ; are easy to miss. Maybe add indentation to denote the conditional or explicitly use if...fi.
|149 ↗||(On Diff #66613)|
Why are you testing mknod (a rarely used syscall) insted of fstat?
Yes, of course, but so far I have only seen people complain on Bugzilla when they are building their own stuff, i.e., kernels without COMPAT_FREEBSD11 + lang/rust and www/firefox. That same user group does not seem to use binary packages.
I suppose I could add an UPDATING entry for this too to cover all the bases but then this is as far as it should go IMHO. Then again binary package users will not read UPDATING either, so it would probably solve nothing.
|149 ↗||(On Diff #66613)|
It was the first SYS_freebsd11_* one in sys/syscall.h and I just picked it. The only goal here is to check if the kernel has COMPAT_FREEBSD11 syscalls. I do not understand why it matters what syscall we test for?