Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 650488 - dev-qt/qtwebengine-5.7.1-r2 fails to build with -flto: error: undefined reference to 'SyscallAsm'
Summary: dev-qt/qtwebengine-5.7.1-r2 fails to build with -flto: error: undefined refer...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
Reported: 2018-03-14 14:43 UTC by Alexander Miller
Modified: 2021-08-25 02:25 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

qtwebengine-fix-lto-build.patch (qtwebengine-fix-lto-build.patch,708 bytes, patch)
2018-03-14 14:43 UTC, Alexander Miller
Details | Diff
qtwebengine-5.9.4-fix-lto-build.patch (qtwebengine-5.9.4-fix-lto-build.patch,1.25 KB, patch)
2018-04-01 23:23 UTC, Alexander Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miller 2018-03-14 14:43:31 UTC
Created attachment 523902 [details, diff]

With LTO enabled, dev-qt/qtwebengine fails to build; here is the error from the build log:

rm -f
x86_64-pc-linux-gnu-g++ [...] -Wl,-soname, -o [...]
[...many warnings, mostly -Wodr related...]
/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/temp/cc2rKBOM.ltrans8.ltrans.o:<artificial>:function content::(anonymous namespace)::StartSandboxWithPolicy(sandbox::bpf_dsl::Policy*, base::ScopedGeneric<int, base::internal::ScopedFDCloseTraits>): error: undefined reference to 'SyscallAsm'
/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/temp/cc2rKBOM.ltrans17.ltrans.o:<artificial>:function sandbox::SIGSYSSchedHandler(sandbox::arch_seccomp_data const&, void*): error: undefined reference to 'SyscallAsm'
/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/temp/cc2rKBOM.ltrans26.ltrans.o:<artificial>:function sandbox::Die::ExitGroup(): error: undefined reference to 'SyscallAsm'
/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/temp/cc2rKBOM.ltrans26.ltrans.o:<artificial>:function sandbox::Die::ExitGroup(): error: undefined reference to 'SyscallAsm'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile.core_module:170: ../../lib/] Error 1
make[3]: Leaving directory '/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/work/qtwebengine-opensource-src-5.7.1/src/core'
make[2]: *** [Makefile:158: sub-core_module-pro-make_first] Error 2
make[2]: Leaving directory '/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/work/qtwebengine-opensource-src-5.7.1/src/core'
make[1]: *** [Makefile:50: sub-core-make_first] Error 2
make[1]: Leaving directory '/tmp/portage/dev-qt/qtwebengine-5.7.1-r2/work/qtwebengine-opensource-src-5.7.1/src'
make: *** [Makefile:45: sub-src-make_first] Error 2
 * ERROR: dev-qt/qtwebengine-5.7.1-r2::gentoo failed (compile phase):
 *   emake failed

This fails because in 3rdparty/chromium/sandbox/linux/seccomp-bpf/ a symbol is defined in a global asm statement, and gcc is unaware of that definition because it doesn't parse asm statements. Therefore, this file souldn't b e compiled with -flto. In the build system there's even a comment related to the issue, but the workaround they implemented is incomplete. The attached patch replaces that with a solution that actually works (here, at least).
Comment 1 Andreas Sturmlechner gentoo-dev 2018-03-14 15:58:20 UTC
Please try to upstream your patch.
Comment 2 Alexander Miller 2018-03-15 23:33:21 UTC
Does it really make sense to upstream this patch? I see no activity in the 5.7 branch of qtwebengine in the last 14 months. Since 5.9, gyp is no longer used to build the affected module, so the patch doesn't apply to newer versions. I guess the issue is still there and can be fixed in a similar way, but the patch has to be ported to GN. (I haven't looked at GN yet, and I'm not running Qt 5.9, so I'm not gonna do this right now.)
Comment 3 Davide Pesavento gentoo-dev 2018-03-15 23:55:05 UTC
No, it doesn't. In fact, I doubt upstream will accept such a patch even for the 5.9 branch, which is now in "strict" mode. The best course of action, I think, is to port/rewrite the patch so that it applies to either the 5.11 or the dev branch and get it merged upstream.
Comment 4 Alexander Miller 2018-04-01 23:23:10 UTC
Created attachment 526280 [details, diff]

I've updated to Qt 5.9, so I had a look at the gn based buildsystem and created a patch for dev-qt/qtwebengine-5.9.4 (and maybe newer versions). Note that it is not needed for that version at the moment since the package doesn't respect *FLAGS anyway (bug 652172), but it will be needed when that's fixed.

For this patch I have split the problematic from the seccomp_bpf component into its own source_set, so it's the only file where -fno-lto gets added. (I have an alternative version where I don't do that and the whole seccomp_bpf component gets compiled with -fno-lto, if you prefer that.)

I guess somebody should test whether this patch still applies to 5.11 and the dev branch before we try to upstream. (If anybody with ties to the Qt project wants to push this forward, feel free to act and don't wait for me.)