Bug 255007 - www/qt5-webengine: 5.15.2 fails to build if 5.15.0 is installed (link error)
Summary: www/qt5-webengine: 5.15.2 fails to build if 5.15.0 is installed (link error)
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-kde (Team)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-12 15:49 UTC by John Hein
Modified: 2021-05-11 00:59 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (kde)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2021-04-12 15:49:34 UTC
If qt5-webengine-5.15.0 is already installed in LOCALBASE, the build of www/qt5-webengine for 5.15.2 fails:


/usr/local/bin/ld: .obj/qquickwebengineview.o: in function `QQuickWebEngineViewPrivate::runMouseLockP
ermissionRequest(QUrl const&)':
qquickwebengineview.cpp:(.text+0x250c): undefined reference to `QtWebEngineCore::WebContentsAdapter::grantMouseLockPermission(QUrl const&, bool)'
/usr/local/bin/ld: .obj/qquickwebengineview.o: in function `QQuickWebEngineView::grantFeaturePermission(QUrl const&, QQuickWebEngineView::Feature, bool)':
qquickwebengineview.cpp:(.text+0x4f55): undefined reference to `QtWebEngineCore::WebContentsAdapter::grantFeaturePermission(QUrl const&, QtWebEngineCore::ProfileAdapter::PermissionType, QtWebEngineCore::ProfileAdapter::PermissionState)'
/usr/local/bin/ld: qquickwebengineview.cpp:(.text+0x4f72): undefined reference to `QtWebEngineCore::WebContentsAdapter::grantFeaturePermission(QUrl const&, QtWebEngineCore::ProfileAdapter::PermissionType, QtWebEngineCore::ProfileAdapter::PermissionState)'


The offending link command (in .build/src/webengine) is:

c++ -B/usr/local/bin -Wl,--as-needed -fstack-protector-strong -Wl,--no-undefined -Wl,--version-script,QtWebEngine.version -pthread -Wl,-rpath,/usr/local/lib/qt5 -Wl,-rpath-link,/usr/local/lib/qt5 -shared -Wl,-Bsymbolic-functions -Wl,-soname,libQt5WebEngine.so.5 -o libQt5WebEngine.so.5.15.2 .obj/qquickwebengineaction.o  .obj/qquickwebenginecertificateerror.o  .obj/qquickwebengineclientcertificateselection.o  .obj/qquickwebenginecontextmenurequest.o  .obj/qquickwebenginedialogrequests.o  .obj/qquickwebenginedownloaditem.o  .obj/qquickwebenginehistory.o  .obj/qquickwebenginefaviconprovider.o  .obj/qquickwebengineloadrequest.o  .obj/qquickwebenginenavigationrequest.o  .obj/qquickwebenginenewviewrequest.o  .obj/qquickwebengineprofile.o  .obj/qquickwebenginescript.o  .obj/qquickwebenginesettings.o  .obj/qquickwebenginesingleton.o  .obj/qquickwebenginetouchhandleprovider.o  .obj/qquickwebengineview.o  .obj/qtwebengineglobal.o  .obj/render_widget_host_view_qt_delegate_quick.o  .obj/render_widget_host_view_qt_delegate_quickwindow.o  .obj/ui_delegates_manager.o  .obj/moc_qquickwebengineaction_p.o  .obj/moc_qquickwebenginecertificateerror_p.o  .obj/moc_qquickwebengineclientcertificateselection_p.o  .obj/moc_qquickwebenginecontextmenurequest_p.o  .obj/moc_qquickwebenginedialogrequests_p.o  .obj/moc_qquickwebenginedownloaditem_p.o  .obj/moc_qquickwebenginehistory_p.o  .obj/moc_qquickwebengineloadrequest_p.o  .obj/moc_qquickwebenginenavigationrequest_p.o  .obj/moc_qquickwebenginenewviewrequest_p.o  .obj/moc_qquickwebengineprofile.o  .obj/moc_qquickwebenginescript.o  .obj/moc_qquickwebenginesettings_p.o  .obj/moc_qquickwebenginesingleton_p.o  .obj/moc_qquickwebengineview_p.o  .obj/moc_render_widget_host_view_qt_delegate_quick.o  -L/z1/local/users/jhein/.nobak/wd/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/local/lib/qt5/libQt5WebEngineCore.so /usr/local/lib/qt5/libQt5Quick.so /usr/local/lib/qt5/libQt5Gui.so /usr/local/lib/qt5/libQt5QmlModels.so /usr/local/lib/qt5/libQt5WebChannel.so /usr/local/lib/qt5/libQt5Qml.so /usr/local/lib/qt5/libQt5Network.so /usr/local/lib/qt5/libQt5Positioning.so /usr/local/lib/qt5/libQt5Core.so /usr/local/lib/qt5/libQt5WebEngineCore.so /usr/local/lib/qt5/libQt5Quick.so /usr/local/lib/qt5/libQt5Gui.so /usr/local/lib/qt5/libQt5QmlModels.so /usr/local/lib/qt5/libQt5WebChannel.so /usr/local/lib/qt5/libQt5Qml.so /usr/local/lib/qt5/libQt5Network.so /usr/local/lib/qt5/libQt5Positioning.so /usr/local/lib/qt5/libQt5Core.so -lGL 


The important part is:

... -L/z1/local/users/jhein/.nobak/wd/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/local/lib/qt5/libQt5WebEngineCore.so ...

Note that we take care (if qt-dist.mk) to point to the work dir for linking before /usr/local/lib.  But then the build bypasses that and links with the absolute path to libQt5WebEngineCore.so

If we instead used -lQt5WebEngineCore, it works as desired.

I know that building outside poudriere has become something of a second class citizen these days, but it would be nice to support it if the fix is not too hard to implement.

Does anyone know where the absolute paths for libraries comes from?  Might there be a way to tell the build to use -l<lib> instead?

See also: bug 194088 (and probably bug 248585 and maybe others)
Comment 1 Adriaan de Groot freebsd_committer 2021-04-20 09:29:20 UTC
> I know that building outside poudriere has become something of a second class citizen these days, 

Yes, because it's hard to get "just right" in the face of a "dirty" build environment with old versions and mismatched dependencies installed. The return on investment is really small. 


> but it would be nice to support it if the fix is not too hard to implement.
>
> Does anyone know where the absolute paths for libraries comes from?  Might there be a way to tell the build to use -l<lib> instead?

Doing *anything* in the build of WebEngine is hard, because it's a seven-layer cake of buildsystems (make->qmake->gn->ninja .. ok, four-layer, along with .pri and .json frosting). We'd be happy to take patches, but chasing this for days is not something kde@ has time for.

So, after 45 minutes of dealing with this PR, if you `make configure` and the `make all` and break after the first bit of gn build:
- there's no link lines written yet, those are generated somewhere in the rest of the build
- libQt5WebEngineCore.prl might be relevant
Comment 2 John Hein 2021-04-21 15:51:14 UTC
Commenting out the QMAKEMODULES settings in qt.mk gets this working.  That is, the build for qt5-webengine now sets compile / link flags to look for things (like the locally built libQt5WebEngineCore.so) in the work dir [1].

Based on some early investifation, it looks like if you define QMAKEMODULES, mkspecs/features/qt_build_config.pri the QMAKEMODULES can override the build's decisions for things like library paths (QT_MODULE_LIB_BASE).  What we really wanted for the QMAKEMODULES stuff (I think) is to append to the default search so that it will look in the work dir then LOCALBASE if it doesn't find something.  But it seems that the current qmake infrastructure (at least as used in qt5-webengine) already will look in the work dir if QMAKEMODULES is not set to override that mechanism.  This explanation is a little hand wavy - I am inferring a lot of things I don't quite follow from beginning to end by looking at the end results.

I am investigating removing this from qt.mk altogether (and running a large build in poudriere to test).

Let me know what you think might break as a result, please.  Or any other useful hints / historical perspective.

[1]

before commenting out QMAKEMODULES in qt.mk, the link command is:

c++ ... -L/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/local/lib/qt5/libQt5WebEngineCore.so   ...

after:

c++ ... -L/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/ports/www/qt5-webengine/work/.build/lib/libQt5WebEngineCore.so  ...
Comment 3 John Hein 2021-04-21 15:53:59 UTC
(In reply to Adriaan de Groot from comment #1)
Adriaan, I understand and agree with your comments.  Thanks for the reply.  I'll investigate a little to increase understanding and to see if some simple improvement can be applied that is actually helpful.
Comment 4 John Hein 2021-04-21 16:27:52 UTC
(In reply to John Hein from comment #3)
As Adriaan pointed out and I also discovered, the Makefile.modules with the offending lib reference (/usr/local/lib/qt5/libWebEngineCore.so) is indeed created (by the twisty maze nearly opaque wall of qmake, make, and ninja, etc.) much nearer the end of the build stage than the beginning (and its long 20000+ compile/etc. actions).  This makes it harder to apply time-honored strategies that interpose fixes like patching generated Makefiles after the configure stage.
Comment 5 Adriaan de Groot freebsd_committer 2021-04-21 16:50:16 UTC
"If you enjoyed this twisty maze of passages, all alike, you may also like: porting WebEngine away from Python2"

In all seriousness, John, I appreciate your persistence in chasing this. It's a real pain in the butt to do (I recommend ccache and a large memory disk to alleviate it a little).

(Do drop in on #kde-freebsd on Freenode's IRC network if you want to do some interactive maybe-this-will-work? kind of stuff -- assuming the regulars are awake & around)
Comment 6 tech-lists 2021-05-09 13:19:59 UTC
(In reply to John Hein from comment #2)

context: poudriere-devel, amd64, haswell. stable/13-n245247-53c0fd84096

Hi, using ports of today (544832 - this value obtained by git -C /usr/ports rev-list --first-parent --count main) the port still will not compile although it seemingly fails in a different place. I've commented out QMAKEMODULES settings in qt.mk as per comment #2.

poudriere testport -j jailname -J32 www/qt5-webengine

[00:05:00] --- .obj/qquickwebengineview.o ---
[00:05:00] c++ -B/usr/local/bin -c -O2 -pipe -march=haswell -fstack-protector-strong -fno-strict-aliasing -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall 
-Wextra -Wdate-time -Winconsistent-missing-override -pthread -fPIC -DQT_NO_LINKED_LIST -DQT_BUILD_WEBENGINE_LIB -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_WEBENGINE_LIB -DQT_BUIL
DING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_DEPRECATED_WARNINGS_SI
NCE=0x060000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_
LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_CORE_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_POSITI
ONING_LIB -DQT_CORE_LIB -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/src/webengine -I. -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-
src-5.15.2/src/webengine -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/src/webengine/api -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere
-src-5.15.2/src/core -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/src/core/api -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15
.2/include -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/include/QtWebEngine -I../../include -I../../include/QtWebEngine -I/wrkdirs/usr/ports/www/qt5-weben
gine/work/qtwebengine-everywhere-src-5.15.2/include/QtWebEngine/5.15.2 -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/include/QtWebEngine/5.15.2/QtWebEngine
 -I../../include/QtWebEngine/5.15.2 -I../../include/QtWebEngine/5.15.2/QtWebEngine -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/include/QtWebEngineCore -I
../../include/QtWebEngineCore -I/usr/local/include/qt5 -I/usr/local/include/qt5/QtQuick -I/usr/local/include/qt5/QtGui -I/usr/local/include/qt5/QtQmlModels -I/usr/local/include/qt5/QtWebC
hannel -I/usr/local/include/qt5/QtQml -I/usr/local/include/qt5/QtNetwork -I/usr/local/include/qt5/QtPositioning -I/usr/local/include/qt5/QtCore -I/wrkdirs/usr/ports/www/qt5-webengine/work
/qtwebengine-everywhere-src-5.15.2/include/QtWebEngineCore/5.15.2 -I/wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/include/QtWebEngineCore/5.15.2/QtWebEngineC
ore -I../../include/QtWebEngineCore/5.15.2 -I../../include/QtWebEngineCore/5.15.2/QtWebEngineCore -I/usr/local/include/qt5/QtQuick/5.15.2 -I/usr/local/include/qt5/QtQuick/5.15.2/QtQuick -
I/usr/local/include/qt5/QtGui/5.15.2 -I/usr/local/include/qt5/QtGui/5.15.2/QtGui -I/usr/local/include/qt5/QtQmlModels/5.15.2 -I/usr/local/include/qt5/QtQmlModels/5.15.2/QtQmlModels -I/usr
/local/include/qt5/QtQml/5.15.2 -I/usr/local/include/qt5/QtQml/5.15.2/QtQml -I/usr/local/include/qt5/QtCore/5.15.2 -I/usr/local/include/qt5/QtCore/5.15.2/QtCore -I.moc -I/usr/local/includ
e/libdrm -I/usr/local/include -I/usr/local/lib/qt5/mkspecs/freebsd-clang -o .obj/qquickwebengineview.o /wrkdirs/usr/ports/www/qt5-webengine/work/qtwebengine-everywhere-src-5.15.2/src/webe
ngine/api/qquickwebengineview.cpp
[00:05:00] --- sub-process-make_first ---
[00:05:00] /usr/local/bin/ld: /wrkdirs/usr/ports/www/qt5-webengine/work/.build/lib/libQt5WebEngineCore.so: undefined reference to `blink::V8WindowPartial::InstallFileHandling(v8::Isolate*
, blink::DOMWrapperWorld const&, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>)'
[00:05:00] c++: error: linker command failed with exit code 1 (use -v to see invocation)
[00:05:00] *** [../../libexec/QtWebEngineProcess] Error code 1
[00:05:00] 
[00:05:00] make[3]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/process
[00:05:00] 1 error
[00:05:00] 
[00:05:00] make[3]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/process
[00:05:00] *** [sub-process-make_first] Error code 2
[00:05:00] 
[00:05:00] make[2]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src
[00:05:00] --- sub-webengine-make_first ---
[00:05:00] *** [sub-module-pro-make_first] Error code 6
[00:05:00] 
[00:05:00] make[3]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/webengine
[00:05:00] 1 error
[00:05:00] 
[00:05:00] make[3]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/webengine
[00:05:00] *** [sub-webengine-make_first] Error code 2
[00:05:00] 
[00:05:00] make[2]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src
[00:05:01] --- sub-tools-qwebengine_convert_dict-make_first ---
[00:05:01] *** [sub-tools-qwebengine_convert_dict-make_first] Error code 6
[00:05:01] 
[00:05:01] make[2]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src
[00:05:05] --- sub-pdf-make_first ---
[00:05:05] WARNING at the command-line "--args":1:2059: Build argument has no effect.
[00:05:05] use_qt=true init_stack_vars=false is_component_build=false is_shared=true enable_debugallocation=false enable_media_remoting=false enable_message_center=false enable_nacl=false
 enable_remoting=false enable_reporting=false enable_resource_whitelist_generation=false enable_swiftshader=false angle_enable_swiftshader=false enable_web_auth=true enable_web_speech=fal
se enable_widevine=true forbid_non_component_debug_builds=false has_native_accessibility=false safe_browsing_mode=0 toolkit_views=false treat_warnings_as_errors=false use_allocator_shim=f
alse use_allocator="none" use_custom_libcxx=false closure_compile=false optimize_webui=false v8_use_external_startup_data=false strip_absolute_paths_from_debug_symbols=false use_jumbo_bui
ld=true jumbo_file_merge_limit=8 jumbo_build_excluded=["browser"] enable_precompiled_headers=false is_official_build=true is_debug=false symbol_level=0 blink_symbol_level=0 remove_v8base_
debug_symbols=true use_cups=false use_gio=false use_gnome_keyring=false linux_use_bundled_binutils=false use_udev=true use_bundled_fontconfig=false use_sysroot=false enable_session_servic
e=false is_cfi=false use_ozone=true ozone_auto_platforms=false ozone_platform_headless=false ozone_platform_external=true ozone_platform="qt" ozone_extra_path="/wrkdirs/usr/ports/www/qt5-
webengine/work/qtwebengine-everywhere-src-5.15.2/src/core/ozone/ozone_extra.gni" use_gold=false use_lld=false is_clang=true clang_use_chrome_plugins=false clang_use_default_sample_profile
=false clang_base_path="/ccache/libexec -B/usr" custom_toolchain="/wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/toolchain:target" host_toolchain="/wrkdirs/usr/ports/www/qt5-webengi
ne/work/.build/src/toolchain:host" host_cpu="x64" pkg_config="pkg-config" host_pkg_config="/usr/local/bin/pkg-config" pdfium_use_system_zlib=true use_system_libpng=true pdfium_use_system_
libpng=true use_system_libjpeg=true use_system_freetype=true use_system_harfbuzz=true use_glib=false enable_basic_printing=true enable_print_preview=true use_dbus=true use_udev=false use_
system_yasm=true pdf_enable_v8=false pdf_enable_xfa=false pdf_enable_xfa_bmp=false pdf_enable_xfa_gif=false pdf_enable_xfa_png=false pdf_enable_xfa_tiff=false qtwebengine_target="/wrkdirs
/usr/ports/www/qt5-webengine/work/.build/src/pdf/release:QtPdf"
[00:05:05] ^--
[00:05:05] The variable "use_system_yasm" was set as a build argument
[00:05:05] but never appeared in a declare_args() block in any buildfile.
[00:05:05] 
[00:05:05] To view all possible args, run "gn args --list <out_dir>"
[00:05:05] 
[00:05:05] The build continued as if that argument was unspecified.
[00:05:05] 
[00:05:05] Done. Made 12715 targets from 2024 files in 5123ms
[00:05:05] *** [sub-gn_run-pro-make_first] Error code 6
[00:05:05] 
[00:05:05] make[3]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/pdf
[00:05:05] 1 error
[00:05:05] 
[00:05:05] make[3]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src/pdf
[00:05:05] *** [sub-pdf-make_first] Error code 2
[00:05:05] 
[00:05:05] make[2]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src
[00:05:05] 4 errors
[00:05:05] 
[00:05:05] make[2]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build/src
[00:05:05] *** [sub-src-make_first] Error code 2
[00:05:05] 
[00:05:05] make[1]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build
[00:05:05] 1 error
[00:05:05] 
[00:05:05] make[1]: stopped in /wrkdirs/usr/ports/www/qt5-webengine/work/.build
[00:05:05] ===> Compilation failed unexpectedly.
[00:05:05] Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
[00:05:05] the maintainer.
[00:05:05] *** Error code 1
[00:05:05] 
[00:05:05] Stop.
[00:05:05] make: stopped in /usr/ports/www/qt5-webengine
Comment 7 tech-lists 2021-05-09 13:25:40 UTC
(In reply to tech-lists from comment #6)
also, what's installed is 5.15.2_2

maybe this needs to go into another ticket?
Comment 8 John Hein 2021-05-11 00:59:21 UTC
Yes, that seems like a different problem.

I don't know where that reference might be coming from.  I don't see it referenced in the qtwebengine code with a quick grep of that source code.