[Bug 255311] mail/thunderbird fails to build with LTO option enabled

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 12 Jul 2021 15:20:37 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255311

Mikhail Teterin <mi_at_FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mi_at_FreeBSD.org
           Severity|Affects Only Me             |Affects Some People

--- Comment #1 from Mikhail Teterin <mi_at_FreeBSD.org> ---
"Me too"... Building on 11.4-stable/amd64, using clang12 (itself freshly built
by its port):

> error: linking with `/spare/usr/ports/mail/thunderbird/work/thunderbird-78.12.0/build/cargo-linker` failed: exit status: 1
>  |
>  = note: "/spare/usr/ports/mail/thunderbird/work/thunderbird-78.12.0/build cargo-linker" "-m64" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-Wl,--as-needed" "-L" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.0.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.1.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.10.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.11.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.12.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.13.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.14.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.15.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.2.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.3.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.4.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.5.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.6.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.7.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.8.rcgu.o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.build_script_build.4jz208pc-cgu.9.rcgu.o" "-o" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8" "/spare/usr/ports/mail/thunderbird/work/.build/release/build/proc-macro2-c10ea1ece1827ca8/build_script_build-c10ea1ece1827ca8.2crvumdazz2s49ps.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/spare/usr/ports/mail/thunderbird/work/.build/release/deps" "-L" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libstd-60484778edbab02a.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libpanic_unwind-dc2ae4d0a466e49f.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libminiz_oxide-4ffdbfe2ec17bf17.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libadler-c0c35bf5c8faaa12.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libobject-2f585d565898c512.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libaddr2line-c4981ba22728774a.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libgimli-53f3ea5ca1698b2e.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libstd_detect-ca404df982551ee0.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_demangle-6cc518f71c9c2316.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libhashbrown-df5cfc7c9e693ffe.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_alloc-05242e744576510b.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libunwind-9845119b8b6a2916.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libcfg_if-6c8ff242046b1c52.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/liblibc-85760c759f190965.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/liballoc-3a190eca975ddd7e.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_std_workspace_core-7525106f2a6b24a2.rlib" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libcore-4ee7510cd643b335.rlib" "-Wl,--end-group" "/opt/lib/rustlib/x86_64-unknown-freebsd/lib/libcompiler_builtins-46641b4a03e19e40.rlib" "-Wl,-Bdynamic" "-lexecinfo" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lrt" "-lutil" "-lutil"
>  = note: clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
>          /opt/bin/ld: /tmp/lto-llvm-f7837b.o: in function `std::backtrace_rs::symbolize::gimli::elf::Object::section':
>          std.36oq6ef3-cgu.5:(.text._ZN3std12backtrace_rs9symbolize5gimli3elf6Object7section17h56e1f216297ada85E+0x13): undefined reference to `__rust_probestack'
>          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Searching for the __rust_probestack, one finds:

       https://github.com/rust-lang/rust/issues/74657

where the "fix" seems to be in using lld or gold instead of bfd.

Indeed, after I edited the ${WRKSRC}/build/cargo-linker to add `-fuse-ld=gold`
to the command-line, the above error disappeared.

Should the port be doing this automatically?

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Mon Jul 12 2021 - 15:20:37 UTC

Original text of this message