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...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2018-03-14 14:43 UTC by Alexander Miller
Modified: 2023-12-12 13:04 UTC (History)
1 user (show)

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


Attachments
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]
qtwebengine-fix-lto-build.patch

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

rm -f libQt5WebEngineCore.so.5.7.1 libQt5WebEngineCore.so libQt5WebEngineCore.so.5 libQt5WebEngineCore.so.5.7
x86_64-pc-linux-gnu-g++ [...] -Wl,-soname,libQt5WebEngineCore.so.5 -o libQt5WebEngineCore.so.5.7.1 [...]
[...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/libQt5WebEngineCore.so.5.7.1] 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/syscall.cc 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 (RETIRED) 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]
qtwebengine-5.9.4-fix-lto-build.patch

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 syscall.cc 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.)
Comment 5 Larry the Git Cow gentoo-dev 2023-12-12 13:04:21 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d51131e1ec7aa03f22a2f2864237fdc3d4dc146

commit 2d51131e1ec7aa03f22a2f2864237fdc3d4dc146
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2023-12-07 17:56:50 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2023-12-12 12:56:01 +0000

    qt5-build.eclass: filter-lto
    
    Closes: https://bugs.gentoo.org/650488
    Closes: https://bugs.gentoo.org/692078
    Closes: https://bugs.gentoo.org/713850
    Closes: https://bugs.gentoo.org/908419
    Closes: https://bugs.gentoo.org/652158
    Closes: https://bugs.gentoo.org/919043
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 eclass/qt5-build.eclass | 3 +++
 1 file changed, 3 insertions(+)