Rebuild std on FreeBSD with ino64 update



So, Rust nightly is basically unusable to me running 12-CURRENT with new stat struct (and some other updates). I can install Rust stable from ports which has the patch for ino64, however I need nightly and ports does not provide that.

I have patched std and libc in rust-src but no matter how I run build the bootstrap process always crashes with no backtrace or debug information. I also tried modifying existing (freebsd) port to use nightly instead of stable but same error…

What is the magic recipe for successfully building nightly on FreeBSD? There must be one since its available with rustup…

Or better yet, can the rust build infrastructure be updated to provide a toolchain like nightly-x86_64-unknown-freebsd-ino64 until we can detect OS version in rustc and have a more permanent solution? :slight_smile:

Patch for 1.18 is here:



First, regarding a solution to target FreeBSD 12.x (with the ABI breaking change around stat(2)), there is an ongoing discussion about a future RFC to extend target triples.

About the rust-nightly port on FreeBSD, I didn’t have time yet to update it. I didn’t even try to build Rust from sources recently. I hope to work on it in the coming weeks. Sorry, I’m not of great help here :-/


I debugged the bootstrap binary and of course, should have known. It crashes when doing fs operations due to ino64 changes. If possible I need to tell the build script to use the patched rust from ports…


Or maybe easiest is to “cross compile” from pre-ino64 -> post-ino64…


On the upstream issue the libs team has concluded that an “easy” way forward would be to add dynamic detection of the FreeBSD version and use the correct stat appropriately, and that would avoid new targets and blocking on anything else.


Here’s a temporary fix for those who can’t wait.
Just re-apply each time you update nightly with rustup.