Bug 245946

Summary: [PATCH] www/qt5-webengine: devel/double-conversion missing in LIB_DEPENDS
Product: Ports & Packages Reporter: Andy Mender <andymenderunix>
Component: Individual Port(s)Assignee: freebsd-kde (Team) <kde>
Status: Closed FIXED    
Severity: Affects Only Me CC: adridg, kai, kde, tcberner
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Makefile diff none

Description Andy Mender 2020-04-26 19:30:09 UTC
Created attachment 213824 [details]
Makefile diff

QtWebEngine uses definitions found in libdouble-conversion.so, however does not declare the devel/double-conversion port in the LIB_DEPENDS array. As a result, the build fails. The attached Makefile diff fixes the issue.

This is a re-submission of bug #245922 to target the correct port. Since the behavior is similar to the one reported in bug #245495, they might show the same overall problem with www/qt5-webengine builds.
Comment 1 Tobias C. Berner freebsd_committer 2020-04-27 16:24:40 UTC
Moin moin 

Thanks for the report!

Kai, could you take a look at this?


mfg Tobias
Comment 2 Kai Knoblich freebsd_committer 2020-05-01 11:30:24 UTC
(In reply to Andy Mender from comment #0)
(In reply to Tobias C. Berner from comment #1)

At the outset two questions:

- Do you get the build errors with a non-poudriere build environment?

- If so, have you already tried to remove the previous version of qt5-webengine with "pkg delete -f" before building the new version?

Some more technical details:

In fact, www/qt5-webengine uses some header files that can also be found in devel/double-conversion. 

But it should rather use its own header files of the bundled copy of ICU, that are supplied via the tarball and can be found at the following locations: 

- "src/3rdparty/chromium/third_party/icu/source/i18n/"
- "src/3rdparty/chromium/base/third_party/double_conversion/double-conversion" 


Also I don't see "libdouble-conversion.so" listed as a (missing) dependency when examining the shared libraries of www/qt5-webengine (= 5.14.2):

> for i in `pkg info -l qt5-webengine | grep -e '\.so$'`; do readelf -d $i | grep conversion; done
Comment 3 Andy Mender 2020-05-02 18:23:20 UTC
> - Do you get the build errors with a non-poudriere build environment?

Yes, indeed. I build and install new ports via "make install clean" in the port dir and run regular updates via portmaster to have full control over the build process.

> - If so, have you already tried to remove the previous version of qt5-webengine with "pkg delete -f" before building the new version?

This I have not tried, but the first time I built it, it was a completely fresh install of both qt5-webegine and otter-browser.

> In fact, www/qt5-webengine uses some header files that can also be found in devel/double-conversion.
> But it should rather use its own header files of the bundled copy of ICU, that are supplied via the tarball and can be found at the following locations: 
> - "src/3rdparty/chromium/third_party/icu/source/i18n/"
> - "src/3rdparty/chromium/base/third_party/double_conversion/double-conversion" 

Yes, this is what I suspected as well, since the devel/double-conversion port was extracted from the Chromium source code.

> Also I don't see "libdouble-conversion.so" listed as a (missing) dependency when examining the shared libraries of www/qt5-webengine (= 5.14.2):
> for i in `pkg info -l qt5-webengine | grep -e '\.so$'`; do readelf -d $i | grep conversion; done

This I can't explain. I should've posted this earlier, but here is the end of the build log:
> c++ -B/usr/local/bin -Wl,--as-needed -fstack-protector-strong -pthread -Wl,-rpath,/usr/local/lib/qt5 -Wl,-rpath-link,/usr/local/lib/qt5 -o ../../libexec/QtWebEngineProcess .obj/main.o   -L/tmp/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/local/lib/qt5/libQt5Gui.so /usr/local/lib/qt5/libQt5Core.so -lGL /usr/local/lib/qt5/libQt5WebEngineCore.so /usr/local/lib/qt5/libQt5Quick.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/libQt5Gui.so /usr/local/lib/qt5/libQt5Positioning.so /usr/local/lib/qt5/libQt5Core.so
> /usr/local/bin/ld: warning: libdouble-conversion.so.3, needed by /usr/local/lib/qt5/libQt5Core.so, not found (try using -rpath or -rpath-link)
> /usr/local/bin/ld: .obj/main.o: in function `main':
> main.cpp:(.text+0xb4): undefined reference to `QtWebEngineCore::processMain(int, char const**)'
> /usr/local/bin/ld: /usr/local/lib/qt5/libQt5Core.so: undefined reference to `double_conversion::DoubleToStringConverter::DoubleToAscii(double, double_conversion::DoubleToStringConverter::DtoaMode, int, char*, int, bool*, int*, int*)'
> /usr/local/bin/ld: /usr/local/lib/qt5/libQt5Core.so: undefined reference to `double_conversion::StringToDoubleConverter::StringToDouble(char const*, int, int*) const'
> c++: error: linker command failed with exit code 1 (use -v to see invocation)
> *** [../../libexec/QtWebEngineProcess] Error code 1

The same error occurs even with qt5-webengine 5.14.2.
Comment 4 Andy Mender 2020-05-03 11:42:20 UTC
I realized that my qt5-core installation was somehow linked against libdouble-conversion and this affected more than just qt5-webengine. I rebuilt qt5-core and now the issue I reported has disappeared. I should probably use poudriere for my builds to avoid problems like this in the future.

Unfortunately, qt5-webengine still fails to build. This is the end of the build log:
> --- sub-process-make_first ---
> --- ../../libexec/QtWebEngineProcess ---
> c++ -B/usr/local/bin -Wl,--as-needed -fstack-protector-strong -pthread -Wl,-rpath,/usr/local/lib/qt5 -Wl,-rpath-link,/usr/local/lib/qt5 -o ../../libexec/QtWebEngineProcess .obj/main.o   -L/tmp/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/local/lib/qt5/libQt5Gui.so /usr/local/lib/qt5/libQt5Core.so -lGL /usr/local/lib/qt5/libQt5WebEngineCore.so /usr/local/lib/qt5/libQt5Quick.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/libQt5Gui.so /usr/local/lib/qt5/libQt5Positioning.so /usr/local/lib/qt5/libQt5Core.so
> /usr/local/bin/ld: .obj/main.o: in function `main':
> main.cpp:(.text+0xb4): undefined reference to `QtWebEngineCore::processMain(int, char const**)'
> c++: error: linker command failed with exit code 1 (use -v to see invocation)
> *** [../../libexec/QtWebEngineProcess] Error code 1
Comment 5 Andy Mender 2020-05-03 19:09:45 UTC
I tried building qt5-webengine in a 12.1-STABLE jail and it builds successfully. I think there might've been something polluting my system environment.

Since as you said, an external installation of libdouble-conversion is not necessary, I think this bug report can be closed.
Comment 6 Kai Knoblich freebsd_committer 2020-05-03 21:52:38 UTC
(In reply to Andy Mender from comment #5)

Thank you for the updates and no worries about the delayed info regarding the build logs. Meanwhile I also was able to reproduce the issue as reported above by upgrading www/qt5-webengine from 5.14.0 to 5.14.2 via portmaster.

My solution was then to remove the previous version of qt5-webengine via "pkg delete -f" and do a "make clean && make install" of the www/qt5-webengine port.

Some more technical details for the sake of completeness:

If we look at a recent poudriere build log (11.3-RELEASE amd64) [1] there's a small difference with the "-Wl,-rpath-link," parameter in comparison with the outputs from comment #3 and comment #4:

> --- ../../libexec/QtWebEngineProcess ---
> c++ -B/usr/local/bin -Wl,--as-needed -fstack-protector-strong -pthread -Wl,-rpath,/usr/local/lib/qt5 -Wl,-rpath-link,/wrkdirs/usr/ports/www/qt5-webengine/work/.build/lib -o ../../libexec/QtWebEngineProcess .obj/main.o   -L/wrkdirs/usr/ports/www/qt5-webengine/work/.build/lib -L/usr/local/lib /usr/local/lib/qt5/libQt5Gui.so /usr/local/lib/qt5/libQt5Core.so -lGL /wrkdirs/usr/ports/www/qt5-webengine/work/.build/lib/libQt5WebEngineCore.so /usr/local/lib/qt5/libQt5Quick.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/libQt5Gui.so /usr/local/lib/qt5/libQt5Positioning.so /usr/local/lib/qt5/libQt5Core.so

Within a poudriere build there's no prior version of www/qt5-webengine installed and hence no ldconfig(8) hints file in ${LOCALBASE}/libdata/ldconfig/qt5-webengine exists. The build process then uses its .build/lib/ directory as -rpath-link parameter instead of pointing to ${LOCALBASE}/lib/qt5 .

--
[1] http://beefy9.nyi.freebsd.org/data/113amd64-default/533597/logs/qt5-webengine-5.14.2.log
Comment 7 Adriaan de Groot freebsd_committer 2020-07-19 08:54:14 UTC
There's a similar PR 248020.

It comes down to this:
 - in a dirty build environment, Qt can pick up the library for double-conversion and use it.
 - clean, it builds its own bundled copy.

There is a configure flag for Qt parts as to what it should build, so I'm intending to add `-qt-doubleconversion` (I just don't quite know *where* yet) to sidestep the whole issue.
Comment 8 commit-hook freebsd_committer 2020-07-19 11:36:45 UTC
A commit references this bug:

Author: adridg
Date: Sun Jul 19 11:35:50 UTC 2020
New revision: 542563
URL: https://svnweb.freebsd.org/changeset/ports/542563

Log:
  Make qt5-core and qt5-webengine depend explicitly on double-conversion.

  In a dirty build-environment, double-conversion was being picked up
  automatically (as "system double-conversion"). We could bung in
  a configure flag to ignore it, so that Qt would always build its
  own copy. Or we could depend explicitly on it, dropping the build
  of the bundled copy.

  Do the latter, because:
  - it's the same code, but now extracted from V8 JS into a separate
    library by upstream (that is, by Chromium / Google),
  - the dependency package is only 168kB.
  - this reduces code-bundling and improves reuse when other things
    also use double-conversion.

  (This is the opposite of what I originally intended; using the flag
  is harder to implement, and since the dependency is small ..)

  I've taken the patch from Andy Mender and applied it in two cases.
  Perhaps adding it to qt5-core would have been enough, duplication
  here can't hurt.

  PR:		245946 248020
  Submitted by:	Andy Mender
  Reported by:	Andy Mender, yuri

Changes:
  head/devel/qt5-core/Makefile
  head/www/qt5-webengine/Makefile