Try with different options, but can't build anyway: #30 0x00000000003a0558 (/usr/local/llvm13/bin/ld+0x3a0558) clang-13: error: unable to execute command: Abort trap clang-13: error: linker command failed due to signal (use -v to see invocation) gmake[5]: *** [/usr/ports/www/firefox/work/firefox-110.0/config/rules.mk:540: libxul.so] Error 254 gmake[5]: Leaving directory '/usr/ports/www/firefox/work/.build/toolkit/library/build' gmake[4]: *** [/usr/ports/www/firefox/work/firefox-110.0/config/recurse.mk:72: toolkit/library/build/target] Error 2 /usr/ports/www/firefox/work/.build/_virtualenvs/build/bin/python -m mozbuild.action.check_binary --target ../../dist/bin/firefox BUILDTASK {"argv": ["/usr/ports/www/firefox/work/firefox-110.0/python/mozbuild/mozbuild/action/check_binary.py", "--target", "../../dist/bin/firefox"], "start": 1676735559.906442, "end": 1676735559.924812, "context": null} gmake[5]: Leaving directory '/usr/ports/www/firefox/work/.build/browser/app' gmake[4]: Leaving directory '/usr/ports/www/firefox/work/.build' gmake[3]: *** [/usr/ports/www/firefox/work/firefox-110.0/config/recurse.mk:34: compile] Error 2 gmake[3]: Leaving directory '/usr/ports/www/firefox/work/.build' gmake[2]: *** [/usr/ports/www/firefox/work/firefox-110.0/config/rules.mk:361: all] Error 2 gmake[2]: Leaving directory '/usr/ports/www/firefox/work/.build' ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. ***Error code 1 Stop. make[1]: stopped in /usr/ports/www/firefox Error code 1 Stop.
(In reply to Roman Karandashev from comment #0) Which version of FreeBSD, exactly? freebsd-version-kru ; uname -aKU
(In reply to Graham Perrin from comment #1) freebsd-version-kru: 13.2-BETA2 13.2-BETA2 13.2-STABLE uname -aKU: FreeBSD ryzen-bsd 13.2-BETA2 FreeBSD 13.2-BETA2 releng/13.2-065f78545 GENERIC amd64 1302000 1302500
Do you have LTO enabled? Rust port and c++ LLVM version mismatches often causes linking problems when LTO is enabled.
(In reply to Oleg Sidorkin from comment #3) Like you said, I get LLVM errors with LTO (Link-Time Optimization) option. I tried building www/firefox with two approaches -- (1) Ports (2) Poudriere Both approaches fail with the same LLVM error near the very end for FreeBSD 13.1-RELEASE. What "version mismatches" can there be to result in these LLVM errors? Isn't using Poudriere to build it in isolation good enough? Why would it fail to build using LTO option in Poudriere? ==== APPROACH 1: Ports ==== $ cd /usr/ports/www/firefox $ make config-recursive $ make install clean ==== APPROACH 2: Poudriere ==== I simply followed instructions to setup Poudriere. https://www.digitalocean.com/community/tutorials/how-to-set-up-a-poudriere-build-system-to-create-packages-for-your-freebsd-servers $ poudriere jail -c -j 131Ramd64 -v 13.1-RELEASE $ poudriere ports -c -p 2023Q1 The following is the Makefile config options I set for www/firefox. ---Begin OPTIONS List--- ===> The following configuration options are available for firefox-110.0_3,2: CANBERRA=off: Sound theme alerts DBUS=on: D-Bus IPC system support DEBUG=off: Build with debugging support FFMPEG=on: FFmpeg support (WMA, AIFF, AC3, APE...) LIBPROXY=off: Proxy support via libproxy LTO=on: Use Link-Time Optimization OPTIMIZED_CFLAGS=on: Use extra compiler optimizations PROFILE=on: Build with profiling support TEST=off: Build and/or run tests ====> Extra cubeb audio backends (OSS is always available) ALSA=off: ALSA audio architecture support JACK=on: JACK audio server support PULSEAUDIO=on: PulseAudio sound server support SNDIO=on: Sndio audio support ===> Use 'make config' to modify these settings ---End OPTIONS List--- This is the same LLVM error I get for both approaches. /usr/local/bin/clang++13 -Qunused-arguments -std=gnu++17 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -DLIBICONV_PLUG -isystem /usr/local/include -fno-sized-deallocation -fno-aligned-new -O2 -pipe -O3 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DLIBICONV_PLUG -isystem /usr/local/include -fno-exceptions -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pipe -O2 -O3 -fno-omit-frame-pointer -funwind-tables -shared -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,--gc-sections -Wl,-h,libxul.so -o libxul.so /wrkdirs/usr/ports/www/firefox/work/.build/toolkit/library/build/libxul_so.list -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,/wrkdirs/usr/ports/www/firefox/work/.build/dist/bin -Wl,-rpath-link,/usr/local/lib ../../../js/src/build/libjs_static.a /wrkdirs/usr/ports/www/firefox/work/.build/x86_64-unknown-freebsd/release/libgkrust.a ../../../config/external/lgpllibs/liblgpllibs.so ../../../config/external/sqlite/libmozsqlite3.so ../../../widget/gtk/mozgtk/libmozgtk.so ../../../widget/gtk/mozwayland/libmozwayland.so -L/usr/local/lib -licui18n -L/usr/local/lib -licuuc -licudata -laom -ldav1d -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrandr -lXrender -lXtst -lpthread -lffi -lplds4 -lplc4 -lnspr4 -pthread -ldl -lz -lm -lnss3 -lsmime3 -lssl3 -lnssutil3 -lfreetype -lfontconfig -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lutil -lpng16 -lwebpdemux -lwebp -lsharpyuv -lgraphite2 -levent -lvpx -lpixman-1 -ldbus-glib-1 -ldbus-1 -lxcb-shm -lX11-xcb -lxcb -lXcursor -lXi LLVM ERROR: Type mismatch in constant table! PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: /usr/local/llvm13/bin/ld --eh-frame-hdr -Bshareable --hash-style=both --enable-new-dtags -o libxul.so /usr/lib/crti.o /usr/lib/crtbeginS.o -L/usr/local/lib -L/usr/local/lib -L/usr/lib -plugin /usr/local/llvm13/bin/../lib/LLVMgold.so -plugin-opt=mcpu=x86-64 -plugin-opt=O3 -plugin-opt=thinlto -plugin-opt=-function-sections -plugin-opt=-data-sections -z defs --warn-unresolved-symbols --gc-sections -h libxul.so /wrkdirs/usr/ports/www/firefox/work/.build/toolkit/library/build/libxul_so.list -plugin-opt=-import-instr-limit=10 -plugin-opt=-import-hot-multiplier=30 --as-needed -z noexecstack -z text -z relro -z nocopyreloc -Bsymbolic-functions --build-id=sha1 -rpath-link /wrkdirs/usr/ports/www/firefox/work/.build/dist/bin -rpath-link /usr/local/lib ../../../js/src/build/libjs_static.a /wrkdirs/usr/ports/www/firefox/work/.build/x86_64-unknown-freebsd/release/libgkrust.a ../../../config/external/lgpllibs/liblgpllibs.so ../../../config/external/sqlite/libmozsqlite3.so ../../../widget/gtk/mozgtk/libmozgtk.so ../../../widget/gtk/mozwayland/libmozwayland.so -licui18n -licuuc -licudata -laom -ldav1d -lX11 -lXcomposite -lXdamage -lXext -lXfixes -lXrandr -lXrender -lXtst -lpthread -lffi -lplds4 -lplc4 -lnspr4 -ldl -lz -lm -lnss3 -lsmime3 -lssl3 -lnssutil3 -lfreetype -lfontconfig -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lutil -lpng16 -lwebpdemux -lwebp -lsharpyuv -lgraphite2 -levent -lvpx -lpixman-1 -ldbus-glib-1 -ldbus-1 -lxcb-shm -lX11-xcb -lxcb -lXcursor -lXi -lc++ -lm -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtendS.o /usr/lib/crtn.o #0 0x0000000825db08f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/llvm13/lib/libLLVM-13.so+0x2bb08f8) #1 0x0000000825daec25 llvm::sys::RunSignalHandlers() (/usr/local/llvm13/lib/libLLVM-13.so+0x2baec25) #2 0x0000000825db10c1 (/usr/local/llvm13/lib/libLLVM-13.so+0x2bb10c1) #3 0x0000000822917580 (/lib/libthr.so.3+0x1a580) #4 0x0000000822916b3f (/lib/libthr.so.3+0x19b3f) #5 0x00007ffffffff8a3 ([vdso]+0x2d3) #6 0x000000082a0b033a thr_kill (/lib/libc.so.7+0x13733a) #7 0x000000082a028c74 _raise (/lib/libc.so.7+0xafc74) #8 0x000000082a0da109 abort (/lib/libc.so.7+0x161109) #9 0x0000000825cf3f1d (/usr/local/llvm13/lib/libLLVM-13.so+0x2af3f1d) #10 0x0000000825cf3d59 (/usr/local/llvm13/lib/libLLVM-13.so+0x2af3d59) #11 0x000000082674756e (/usr/local/llvm13/lib/libLLVM-13.so+0x354756e) #12 0x000000082672367e (/usr/local/llvm13/lib/libLLVM-13.so+0x352367e) #13 0x000000082672c0e8 (/usr/local/llvm13/lib/libLLVM-13.so+0x352c0e8) #14 0x00000008267147d3 llvm::BitcodeModule::getModuleImpl(llvm::LLVMContext&, bool, bool, bool, llvm::function_ref<llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > (llvm::StringRef)>) (/usr/local/llvm13/lib/libLLVM-13.so+0x35147d3) #15 0x0000000826714e94 llvm::BitcodeModule::getLazyModule(llvm::LLVMContext&, bool, bool) (/usr/local/llvm13/lib/libLLVM-13.so+0x3514e94) #16 0x00000008272fb1b9 (/usr/local/llvm13/lib/libLLVM-13.so+0x40fb1b9) #17 0x00000008272faee7 llvm::irsymtab::readBitcode(llvm::BitcodeFileContents const&) (/usr/local/llvm13/lib/libLLVM-13.so+0x40faee7) #18 0x00000008272f875b llvm::object::readIRSymtab(llvm::MemoryBufferRef) (/usr/local/llvm13/lib/libLLVM-13.so+0x40f875b) #19 0x0000000827158a57 llvm::lto::InputFile::create(llvm::MemoryBufferRef) (/usr/local/llvm13/lib/libLLVM-13.so+0x3f58a57) #20 0x0000000000497a55 lld::elf::BitcodeFile::BitcodeFile(llvm::MemoryBufferRef, llvm::StringRef, unsigned long) (/usr/local/llvm13/bin/ld+0x497a55) #21 0x0000000000498930 lld::elf::BitcodeFile* lld::make<lld::elf::BitcodeFile, llvm::MemoryBufferRef&, llvm::StringRef&, unsigned long&>(llvm::MemoryBufferRef&, llvm::StringRef&, unsigned long&) (/usr/local/llvm13/bin/ld+0x498930) #22 0x0000000000496656 lld::elf::createObjectFile(llvm::MemoryBufferRef, llvm::StringRef, unsigned long) (/usr/local/llvm13/bin/ld+0x496656) #23 0x00000000004963da lld::elf::ArchiveFile::fetch(llvm::object::Archive::Symbol const&) (/usr/local/llvm13/bin/ld+0x4963da) #24 0x000000000055da95 lld::elf::SymbolTable::addSymbol(lld::elf::Symbol const&) (/usr/local/llvm13/bin/ld+0x55da95) #25 0x0000000000496093 lld::elf::ArchiveFile::parse() (/usr/local/llvm13/bin/ld+0x496093) #26 0x00000000004943f4 lld::elf::parseFile(lld::elf::InputFile*) (/usr/local/llvm13/bin/ld+0x4943f4) #27 0x000000000046700c void lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1, true> >(llvm::opt::InputArgList&) (/usr/local/llvm13/bin/ld+0x46700c) #28 0x000000000045bd43 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/local/llvm13/bin/ld+0x45bd43) #29 0x0000000000459ea7 lld::elf::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) (/usr/local/llvm13/bin/ld+0x459ea7) #30 0x00000000003a0558 (/usr/local/llvm13/bin/ld+0x3a0558) clang-13: error: unable to execute command: Abort trap (core dumped) clang-13: error: linker command failed due to signal (use -v to see invocation) gmake[4]: *** [/wrkdirs/usr/ports/www/firefox/work/firefox-110.0/config/rules.mk:540: libxul.so] Error 254 gmake[4]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build/toolkit/library/build' gmake[3]: *** [/wrkdirs/usr/ports/www/firefox/work/firefox-110.0/config/recurse.mk:72: toolkit/library/build/target] Error 2 gmake[3]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build' gmake[2]: *** [/wrkdirs/usr/ports/www/firefox/work/firefox-110.0/config/recurse.mk:34: compile] Error 2 gmake[2]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build' gmake[1]: *** [/wrkdirs/usr/ports/www/firefox/work/firefox-110.0/config/rules.mk:361: all] Error 2 gmake[1]: Leaving directory '/wrkdirs/usr/ports/www/firefox/work/.build' *** Error code 1 Stop. make: stopped in /usr/ports/www/firefox =>> Cleaning up wrkdir ===> Cleaning for firefox-110.0_3,2 build of www/firefox | firefox-110.0_3,2 ended at Sun Feb 19 11:29:09 EST 2023 build time: 02:42:09 !!! build failure encountered !!!
(In reply to Soe Tun from comment #4) Does firefox builds fine with LTO disabled? Long story is: AFAIK, when LTO is enabled LLVM adds extra segment with bytecode to object files. This segments are collected by linker and then linker compiles the binary by looking at all bytecode. Rust compiler is built on top of LLVM that is part of rust package. Rust develpers update LLVM quite often. Current rust in ports is probably built on top of LLVM 15. In your case firefox was built with LLVM 13 (that's due to various wasm libraries dependencies). So Rust-compiled files have bytecode segments built by LLVM15, but linker is from LLVM13. And linker doesn't understand some specific instructions that were added after LLVM13 release.
(In reply to Oleg Sidorkin from comment #5) I've build without LTO options (disable by default and i don't enable it), because i've read that it cause problem.
(In reply to Oleg Sidorkin from comment #5) > Does firefox builds fine with LTO disabled? Just tried rebuilding without LTO, and it finished successfully. > Current rust in ports is probably built on top of LLVM 15. I checked the Rust version in my Poudriere ports for 2023Q1. $ cat /usr/local/poudriere/ports/default/lang/rust/Makefile PORTNAME= rust PORTVERSION?= 1.66.0 I checked Rust 1.66 release: https://github.com/rust-lang/rust/releases/tag/1.66.0 Checking GitHub Actions CI config for the release's commit SHA shows it is still using LLVM 13. https://github.com/rust-lang/rust/blob/69f9c33d71c871fc16ac445211281c6e7a340943/.github/workflows/ci.yml#L50 Newer Rust releases have moved to LLVM 14 and LLVM 15. https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml#L295-L299
(In reply to Soe Tun from comment #7) > Checking GitHub Actions CI config *-llvm-* jobs in CI are for external/system LLVM e.g., review D32654. > still using LLVM 13 Rust >= 1.65 uses LLVM 15, see https://github.com/rust-lang/rust/commit/8c1f9d04e820 Rust >= 1.69 may use LLVM 16, see https://github.com/rust-lang/rust/pull/107224
> www/firefox: can't build Firefox 110.0.3 on FreeBSD 13.2 STABLE For what it's worth, no problem with 112.0.1_1,2 on 13.2-RELEASE. The tail end of a run of poudriere: … [06:36:17] Built ports: x11-toolkits/pango x11-themes/adwaita-icon-theme graphics/libjxl graphics/librsvg2-rust multimedia/aom multimedia/ffmpeg x11-toolkits/gtk30 www/firefox [06:36:17] Fetched ports: print/tex-dvipsk print/tex-basic-engines multimedia/libass devel/tex-web2c [thirteen-default] [2023-04-23_12h55m17s] [committing:] Queued: 12 Built: 8 Failed: 0 Skipped: 0 Ignored: 0 Fetched: 4 Tobuild: 0 Time: 06:36:12 [06:36:18] Logs: /usr/local/poudriere/data/logs/bulk/thirteen-default/2023-04-23_12h55m17s [06:36:18] Cleaning up [06:36:18] Unmounting file systems root@fuji:~ # poudriere jail -i -j thirteen Jail name: thirteen Jail version: 13.2-RELEASE Jail arch: amd64 Jail method: http Jail mount: /usr/local/poudriere/jails/thirteen Jail fs: fuji/poudriere/jails/thirteen Jail updated: 2023-04-23 08:30:15 Jail pkgbase: disabled root@fuji:~ # uname -aKU FreeBSD fuji 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64 1302001 1302001 root@fuji:~ #
Same issue here – even after explicitly turning off the LTO option in the Firefox port. Nevertheless, I see -flto=thin on the Clang command line, and it ends up with ld: error: /usr/ports/www/firefox/work/.build/x86_64-unknown-freebsd/release/libgkrust.a(gkrust_shared-66f29eab26fc6ab8.gkrust_shared.5b365a90a9baeaef-cgu.0.rcgu.o): Unknown attribute kind (86) (Producer: 'LLVM16.0.5-rust-1.71.0-stable' Reader: 'LLVM 13.0.1') clang-13: error: linker command failed with exit code 1 (use -v to see invocation) gmake[5]: *** [/usr/ports/www/firefox/work/firefox-116.0.1/config/rules.mk:532: libxul.so] Error 1 gmake[5]: Leaving directory '/usr/ports/www/firefox/work/.build/toolkit/library/build'