On FreeBSD/amd64 13.1-RELEASE-p5, when I built www/firefox with LTO option enabled (because I built it for updating before ports tree fc0a979a30ea24c8d28d8a3893bb5ac0549e56cb , which was enabled by default), it failed with: ... /usr/local/bin/clang13 -Qunused-arguments -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -DLIBICONV_PLUG -isystem /usr/local/include -O2 -pipe -O3 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fPIC -ffunction-sections -fdata-sections -fno-math-errno -pipe -O2 -O3 -fomit-frame-pointer -funwind-tables -shared -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,--gc-sections -Wl,-h,libnssckbi.so -o libnssckbi.so stub.o -flto=thin -Wl,-plugin-opt=-import-instr-limit=10 -Wl,-plugin-opt=-import-hot-multiplier=30 -pthread -Wl,--as-needed -fstack-protector-strong -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,nocopyreloc -Wl,-Bsymbolic-functions -Wl,--build-id=sha1 -fstack-protector-strong -fstack-clash-protection -Wl,-rpath-link,/opt/ports/usr/ports/www/firefox/work/.build/dist/bin -Wl,-rpath-link,/usr/local/lib /opt/ports/usr/ports/www/firefox/work/.build/x86_64-unknown-freebsd/release/libbuiltins_static.a -Wl,--version-script,libnssckbi.so.symbols -L/usr/local/lib ld: error: /opt/ports/usr/ports/www/firefox/work/.build/x86_64-unknown-freebsd/release/libbuiltins_static.a(builtins_static-e6f7a98e90c6be5b.1da5sob8z9irceuj.rcgu.o): Unknown attribute kind (82) (Producer: 'LLVM15.0.0-rust-1.65.0-stable' Reader: 'LLVM 13.0.1') clang-13: error: linker command failed with exit code 1 (use -v to see invocation) It seems it was caused by llvm version missmatch between objects produced by Rust and clang13. And why clang13 is used is the description below in Mk/bsd.gecko.mk. [[[ # if !defined(DEFAULT_VERSIONS) || ! ${DEFAULT_VERSIONS:Mllvm*} || ${PORT_OPT IONS:MLTO} LLVM_DEFAULT= 13 # chase bundled LLVM in lang/rust for LTO LLVM_VERSION= 13.0.1 # keep in sync with devel/wasi-compiler-rt${LLVM_DEFAULT} # endif ]]] actually after I run 'make config' to unset LTO option, the port was built successfuly.
Your experience is in line with expectations.
Because Rust 1.65.0 uses/bundles LLVM 15, whereas the WASI toolchain in our tree is still on LLVM 13, and LTO between different LLVM versions was never guaranteed to work anyway.
Then it is kind that stopping build with suggession to unset LTO before starting building process, untill the WASI toolchain would get ready. I spent a few days for finding about the LTO option.
Is it possible for what's represented at <https://www.freshports.org/www/firefox/#config> to gain a hint? <https://cgit.freebsd.org/ports/tree/www/firefox/Makefile.options>
Not really, not least because this LTO procedure is shared amongst all gecko@ ports. The real issue at hand is the mixing-and-matching of LLVM toolchains (and libraries, in mesa's case at least), especially at the bitcode level, just Doesn't Work. I've had LLVM 14's WASI bits working locally, but now that we're on LLVM 15, I've hit a snag porting those WASI bits due to some CMake changes at least. Additionally, there is the thought of revisiting allowing the use of LLVM ports for the Rust toolchain (instead of building the bundled one), since AFAICT the issues that led to removing that option no longer apply.
Created attachment 246215 [details] Fixes LLVM mismatch error By default Firefox does cross-language LTO, which will cause the version mismatch as Rust tracks a newer LLVM than the wasm toolchain. Disabling cross-langauge LTO fixes the issue.
firefox-126.0_2,2 is failing with LTO. Anyone experience it? Tomorrow I will take a closer look at logs but I didn't a relevant errors, only warnings: ``` In file included from /wrkdirs/usr/ports/www/firefox/work/.build/dist/include/mozilla/layers/TextureClient.h:24: /wrkdirs/usr/ports/www/firefox/work/.build/dist/include/mozilla/gfx/CriticalSection.h:55:3: warning: mutex 'mMutex' is still held at the end of function [-Wthread-safety-analysis] 55 | } | ^ /wrkdirs/usr/ports/www/firefox/work/.build/dist/include/mozilla/gfx/CriticalSection.h:53:26: note: mutex acquired here 53 | DebugOnly<int> err = pthread_mutex_lock(&mMutex); | ^ /wrkdirs/usr/ports/www/firefox/work/.build/dist/include/mozilla/gfx/CriticalSection.h:58:26: warning: releasing mutex 'mMutex' that was not held [-Wthread-safety-analysis] 58 | DebugOnly<int> err = pthread_mutex_unlock(&mMutex); | ^ 2 warnings generated. 2 warnings generated. 2 warnings generated. gmake[3]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build/dom/media' 2 warnings generated. 2 warnings generated. gmake[3]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build/gfx/thebes' gmake[2]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build' gmake[1]: *** [/wrkdirs/usr/ports/www/firefox/work/firefox-126.0/config/recurse.mk:34: compile] Error 2 gmake[1]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build' gmake: *** [/wrkdirs/usr/ports/www/firefox/work/firefox-126.0/config/rules.mk:361: all] Error 2 ===> Compilation failed unexpectedly. ```