[Bug 268328] www/firefox fails to build with LTO enabled

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 12 Dec 2022 11:26:47 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268328

            Bug ID: 268328
           Summary: www/firefox fails to build with LTO enabled
           Product: Ports & Packages
           Version: Latest
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: gecko@FreeBSD.org
          Reporter: freebsd-bug-report-yf@yf.bsdclub.org
          Assignee: gecko@FreeBSD.org
             Flags: maintainer-feedback?(gecko@FreeBSD.org)

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.