Bug 253771 - www/firefox: fails to build with LTO enabled
Summary: www/firefox: fails to build with LTO enabled
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gecko (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-22 19:47 UTC by Ivan Rozhuk
Modified: 2021-05-11 18:02 UTC (History)
4 users (show)

See Also:
jbeich: maintainer-feedback+


Attachments
powerpc64le build log (248.99 KB, application/x-xz)
2021-02-23 10:00 UTC, Piotr Kubaj
no flags Details
amd64 build log (257.64 KB, application/x-xz)
2021-02-23 21:48 UTC, Piotr Kubaj
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2021-02-22 19:47:46 UTC

    
Comment 1 Ivan Rozhuk 2021-02-22 19:49:02 UTC
...
gmake[5]: Leaving directory '/tmp/ports/usr/ports/www/firefox/work/.build/config/external/sqlite'
gmake[5]: Entering directory '/tmp/ports/usr/ports/www/firefox/work/.build/toolkit/library/build'
toolkit/library/build/libxul.so
rm -f libxul.so
/usr/local/bin/clang++10 -std=gnu++17 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Qunused-arguments -DLIBICONV_PLUG -isystem /usr/local/include -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wno-range-loop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wno-error=deprecated-copy -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -O2 -pipe -O3 -pipe -funroll-loops -DSTRIP_FBSDID -D_FORTIFY_SOURCE=2 -mretpoline -O3 -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -fdebug-prefix-map=/tmp/ports/usr/ports/www/firefox/work/firefox-86.0=. -O3 -funroll-loops -DSTRIP_FBSDID -D_FORTIFY_SOURCE=2 -mretpoline -DLIBICONV_PLUG -isystem /usr/local/include -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pipe -O2 -O3 -O3 -fomit-frame-pointer -funwind-tables  -fPIC -shared -Wl,-z,defs -Wl,--warn-unresolved-symbols -Wl,--gc-sections -Wl,-h,libxul.so -o libxul.so /tmp/ports/usr/ports/www/firefox/work/.build/toolkit/library/build/libxul_so.list  -flto=thin -Wl,-plugin-opt=-import-instr-limit=10 -Wl,-plugin-opt=new-pass-manager -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 -Wl,-rpath-link,/tmp/ports/usr/ports/www/firefox/work/.build/dist/bin -Wl,-rpath-link,/usr/local/lib  ../../../js/src/build/libjs_static.a /tmp/ports/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/stub/libmozgtk_stub.so   -L/usr/local/lib -licui18n -L/usr/local/lib -licuuc -licudata -laom -ldav1d -lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes -lXi -lXrender -lpthread -lffi -lplds4 -lplc4 -lnspr4 -pthread -ldl -lz -lm -lnss3 -lsmime3 -lssl3 -lnssutil3 -lfreetype -lfontconfig -lutil -lpng -lwebpdemux -lwebp -lgraphite2 -lharfbuzz -levent -lvpx -lpixman-1 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lxcb-shm -lpangoft2-1.0 -lXt -lgthread-2.0
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: Invalid summary version 9. Version should be in the range [1-8].
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[5]: *** [/tmp/ports/usr/ports/www/firefox/work/firefox-86.0/config/rules.mk:545: libxul.so] Error 1
gmake[5]: Leaving directory '/tmp/ports/usr/ports/www/firefox/work/.build/toolkit/library/build'
gmake[4]: *** [/tmp/ports/usr/ports/www/firefox/work/firefox-86.0/config/recurse.mk:72: toolkit/library/build/target] Error 2
gmake[4]: *** Waiting for unfinished jobs....
/tmp/ports/usr/ports/www/firefox/work/.build/_virtualenvs/init_py3/bin/python -m mozbuild.action.check_binary --target libmozavcodec.so
BUILDTASK {"argv": ["/tmp/ports/usr/ports/www/firefox/work/firefox-86.0/python/mozbuild/mozbuild/action/check_binary.py", "--target", "libmozavcodec.so"], "start": 1614022177.1914897, "end": 1614022177.196874, "context": null}
chmod +x libmozavcodec.so
strip  libmozavcodec.so
../../../config/nsinstall -R -m 644 'libmozavcodec.so' '../../../dist/bin'
gmake[5]: Leaving directory '/tmp/ports/usr/ports/www/firefox/work/.build/media/ffvpx/libavcodec'
gmake[4]: Leaving directory '/tmp/ports/usr/ports/www/firefox/work/.build'
gmake[3]: *** [/tmp/ports/usr/ports/www/firefox/work/firefox-86.0/config/recurse.mk:34: compile] Error 2
gmake[3]: Leaving directory '/tmp/ports/usr/ports/www/firefox/work/.build'
gmake[2]: *** [/tmp/ports/usr/ports/www/firefox/work/firefox-86.0/config/rules.mk:355: all] Error 2
gmake[2]: Leaving directory '/tmp/ports/usr/ports/www/firefox/work/.build'
===> Compilation failed unexpectedly.
...
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2021-02-23 10:00:59 UTC
Created attachment 222751 [details]
powerpc64le build log

Works fine here, please verify your environment.
Comment 3 Ivan Rozhuk 2021-02-23 16:41:52 UTC
ffmpeg, svt-*, opencv - builds ok with LTO on my system, only ff fail.
Comment 4 Piotr Kubaj freebsd_committer freebsd_triage 2021-02-23 16:48:37 UTC
(In reply to rozhuk.im from comment #3)
Well, then there's something wrong on your end. Since you didn't specify anything about your environment, it's hard to tell what's wrong.

I can build firefox with LTO just fine on both amd64 and powerpc64le, on releng/13.0.

I don't have any older branches installed, but this option is non-default anyway and I assumed anyway it might not work on all supported architectures and branches anyway.

I already identified one issue on powerpc64le and fixed it, although the error was different than yours.
Comment 5 Ivan Rozhuk 2021-02-23 21:18:55 UTC
Probably because of that in my make.conf:

# Use same llvm version as for mesa.
.if ${.CURDIR:M*/www/firefox}
MESA_LLVM_VERSION!=${MAKE} -C ../../graphics/mesa-dri -V LLVM_DEFAULT
DEFAULT_VERSIONS+=llvm=${MESA_LLVM_VERSION}
.endif
Comment 6 jakub_lach 2021-02-23 21:26:18 UTC
Here I cannot build with LTO on amd64 13-STABLE, ldd hangs in uwait

<...>

BUILDTASK {"argv": ["/usr/obj/usr/ports/www/firefox/work/firefox-86.0/python/mozbuild/mozbuild/action/check_binary.py", "--target", "libmozavcodec.so"], "start": 1614112914.903988
chmod +x libmozavcodec.so
../../../config/nsinstall -R -m 644 'libmozavcodec.so' '../../../dist/bin'
gmake[5]: Leaving directory '/usr/obj/usr/ports/www/firefox/work/.build/media/ffvpx/libavcodec'

<...>

BUILDTASK {"argv": ["/usr/obj/usr/ports/www/firefox/work/firefox-86.0/python/mozbuild/mozbuild/action/check_binary.py", "--target", "libmozavcodec.so"], "start": 1614112914.903988
chmod +x libmozavcodec.so
../../../config/nsinstall -R -m 644 'libmozavcodec.so' '../../../dist/bin'
gmake[5]: Leaving directory '/usr/obj/usr/ports/www/firefox/work/.build/media/ffvpx/libavcodec'
^Cgmake[5]: *** [/usr/obj/usr/ports/www/firefox/work/firefox-86.0/config/rules.mk:545: libxul.so] Interrupt
gmake[4]: *** [/usr/obj/usr/ports/www/firefox/work/firefox-86.0/config/recurse.mk:72: toolkit/library/build/target] Interrupt
gmake[3]: *** [/usr/obj/usr/ports/www/firefox/work/firefox-86.0/config/recurse.mk:34: compile] Int  errupt
gmake[2]: *** [/usr/obj/usr/ports/www/firefox/work/firefox-86.0/config/rules.mk:355: all] Interrupt
*** Signal 2
*** Signal 2

<...>

BUILDTASK {"argv": ["/usr/obj/usr/ports/www/firefox/work/firefox-86.0/python/mozbuild/mozbuild/action/check_binary.py", "--target", "../../dist/bin/firefox"], "start": 1614115228.
gmake[5]: Leaving directory '/usr/obj/usr/ports/www/firefox/work/.build/browser/app'
gmake[5]: Entering directory '/usr/obj/usr/ports/www/firefox/work/.build/media/ffvpx/libavcodec'
gmake[5]: Nothing to be done for 'target'.
gmake[5]: Leaving directory '/usr/obj/usr/ports/www/firefox/work/.build/media/ffvpx/libavcodec'
Comment 7 Piotr Kubaj freebsd_committer freebsd_triage 2021-02-23 21:48:54 UTC
Created attachment 222770 [details]
amd64 build log

Well, here's a build log on 13.0 amd64. How long did your attempt take? For me, while I can build Firefox without LTO in ~25 minutes, with LTO, linking itself takes about 50 minutes.

The whole build process takes usually about 75 minutes with LTO.

Can you reproduce your build issues in Poudriere?
Comment 8 jakub_lach 2021-02-24 06:26:30 UTC
(In reply to Piotr Kubaj from comment #7)

Weird, after rmconfig and build ran without X it went fine (first without LTO and with subsequently). 

As I was not supervising the process, I thought that hanging for 20min+ in uwait earlier was hopeless, maybe I was wrong.
Comment 9 commit-hook freebsd_committer freebsd_triage 2021-05-11 17:56:11 UTC
A commit in branch 2021Q2 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=646b08b36e1c6bf9673b7da726ec0d72af7eb07a

commit 646b08b36e1c6bf9673b7da726ec0d72af7eb07a
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-05-05 17:13:38 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-05-11 17:55:06 +0000

    gecko: ignore llvm in DEFAULT_VERSIONS if LTO is enabled

    PR:             253771
    (cherry picked from commit 4e67118c7a58ddee28e376bc4291f348a9a0d38d)

 Mk/bsd.gecko.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2021-05-11 17:56:12 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4e67118c7a58ddee28e376bc4291f348a9a0d38d

commit 4e67118c7a58ddee28e376bc4291f348a9a0d38d
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-05-05 17:13:38 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-05-11 17:52:58 +0000

    gecko: ignore llvm in DEFAULT_VERSIONS if LTO is enabled

    PR:             253771
    MFH:            2021Q2

 Mk/bsd.gecko.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 11 Jan Beich freebsd_committer freebsd_triage 2021-05-11 18:02:25 UTC
comment 0 was a foot-shooting case due to LLVM mismatch. Don't enable LTO if you want to reduce the number of installed llvm* ports or switch to binary packages.