2026-02-20 - Disabling Rust On NetBSD Pkgsrc ============================================ I decided to set up a NetBSD machine. I want to compile my own bits for old-time's sake. A friendly IRC user advised me to add MKLLVM=no to /etc/mk.conf to reduce my memory footprint. My main system runs Slackware64 15.0 and has 8 GB total RAM. I set up a guest VM with 2 GB RAM. NetBSD 10.1 installed and compiled a release just fine. It took about 7 hours. Then i started building pkgsrc packages. To my surprise, audio/audacity started building LLVM. Wait a second, didn't i disable LLVM? Well yes, but that was for NetBSD's base system, not for pkgsrc. When i run "make show-depends" in audio/audacity, i don't see LLVM. What gives? Just for fun, i ran: mv ../../lang/llvm ../../lang/llvm.bak I tried again and the resulting failure gave me a good clue: audio/audacity depends on doxygen to format its documentation. doxygen depends on graphviz. graphviz depends on gd. gd depends on libimagequant. libimagequant depends on rust. rust depends on llvm. I happen to know that rust requires 8 GB RAM to compile itself. That won't go very far on my pea shooter. In this case i can add PKG_DEFAULT_OPTIONS=-libimagequant to /etc/mk.conf but how can i prevent this problem from popping up again in the future? I found a clue in lang/rust/platform.mk. On platforms that don't support rust, it sets PLATFORM_SUPPORTS_RUST=no to inform packages that they should disable options that depend on rust. I added PLATFORM_SUPPORTS_RUST=no to /etc/mk.conf and i expect that to "disable" rust instead of trying to build it, because this system can't even. This is called keeping myself honest. p.s. I didn't actually measure how much memory it takes to compile rust. An online friend informs me that it requires more than 16 GB RAM to compile rust on his FreeBSD setup. I just took the rust web page's word for it [1]: > We recommend the following. > ... > 8GB+ RAM p.s. I also found it useful to add -llvm to PKG_DEFAULT_OPTIONS in /etc/mk.conf p.s. I learned later that it doesn't help to add MKLLVM=no to /etc/mk.conf. What works better is to add -V MKLLVMRT=no to the build.sh arguments. It just happened to work out for me because i forgot to use -x to tell build.sh to build the x11 sets. NetBSD may have an undocumented option to disable LLVM but at least it has an option. In contrast, FreeBSD never will have one, and it never did, and even if it had, it was an accident that it ever worked [2]! tags: bencollver,technical,unix Footnotes ========= [1] Rust Prerequisites [2] FreeBSD bug report Tags ==== bencollver technical unix