Bug 14461

Summary: Qt5webenegine does not build due to fontconfig/freetype dependency problem
Product: buildroot Reporter: Wojciech Ziniewicz <wojciech.ziniewicz>
Component: OtherAssignee: unassigned
Status: RESOLVED MOVED    
Severity: major CC: buildroot, yann.morin.1998
Priority: P5    
Version: 2021.08.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Wojciech Ziniewicz 2021-12-16 14:47:15 UTC
Hello,
I'm experiencing the same qt5 webengine build problem on x86 64 bit architecture with following combinations of gcc and buildroot:
- gcc8, gcc9, gcc10
- 2021.08.2, 2021.08.3, 2021.11

It seems that qt5webengine requires freetype2.pc file which exists (parallel to other .pc files). Both pkg config/fontconfig and freetype are normally available.
The freetype/fontconfig pair is compiled prior to qt5webengine and it does not really matter whether I explicitly add them to the config file or not because they are included via FONTCONFIG dependency in qt5webengine.


-------------------------------- the error:
ERROR at //build/config/linux/pkg_config.gni:103:17: Script returned non-zero exit code.
    pkgresult = exec_script(pkg_config_script, args, "value")
                ^----------
Current dir: /common_cache/nerves/artifacts/rzjb_system_dev-portable-1.1.0/build/qt5webengine-5.15.2/src/core/release/
Command: /common_cache/nerves/artifacts/rzjb_system_dev-portable-1.1.0/host/bin/python2 /common_cache/nerves/artifacts/rzjb_system_dev-portable-1.1.0/build/qt5webengine-5.15.2/src/3rdparty/chromium/build/config/linux/pkg-config.py -p /common_cache/nerves/artifacts/rzjb_system_dev-portable-1.1.0/build/qt5webengine-5.15.2/host-bin/host-pkg-config freetype2
Returned 1.
stderr:
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'freetype2', required by 'virtual:world', not found
Could not run pkg-config.
See //build/linux/BUILD.gn:24:3: whence it was called.
  pkg_config("freetype_from_pkgconfig") {
  ^--------------------------------------
See //build/config/freetype/BUILD.gn:10:24: which caused the file to be included.
    public_configs = [ "//build/linux:freetype_from_pkgconfig" ]
                       ^--------------------------------------
Project ERROR: GN run error!
make[4]: *** [Makefile:82: sub-gn_run-pro-make_first] Error 3
make[3]: *** [Makefile:79: sub-core-make_first] Error 2
make[2]: *** [Makefile:49: sub-src-make_first] Error 2
make[1]: *** [package/pkg-generic.mk:270: /common_cache/nerves/artifacts/rzjb_system_dev-portable-1.1.0/build/qt5webengine-5.15.2/.stamp_built] Error 2
make: *** [Makefile:23: _all] Error 2
--------------
Comment 1 Peter Seiderer 2021-12-16 17:23:37 UTC
Known problem, see [1], [2], and [3] for workaround/hack for solving it (and [4] for more discussion of the problem)...

[1] https://bugs.busybox.net/show_bug.cgi?id=12131

[2] https://bugs.busybox.net/show_bug.cgi?id=11776

[3] http://lists.busybox.net/pipermail/buildroot/2020-December/601542.html

[4] http://lists.busybox.net/pipermail/buildroot/2021-January/301496.html
Comment 2 Wojciech Ziniewicz 2021-12-16 17:41:41 UTC
Hello Peter - thank you for the response. I think it still leads me to nowwhere but your memory of the issues is impressive.

[1] describes a problem that looks similar but it refers to problem with stdlib.h while I'm having a problem with pkg-config / freetype
[2] the problem from this one was already patched and I confirmed I'm using a patched version with QMAKE_ISYSTEM set to blank string
[3] this problem is _exactly_ what I'm seeing but still - the fix is in the main branch and I also explicitly added the `BR2_PACKAGE_QT5BASE_FONTCONFIG` in addition to the fact that qt5webengine requires is as a dependency itself now
[4] this is exeactly what I've done (actually my change is unnecessary as these dependencies are automatically sucked in after the changes)

So basically even after I explicitly add the deps for fontconfig, I still get the error.
Comment 3 Peter Seiderer 2021-12-16 17:53:41 UTC
(In reply to Wojciech Ziniewicz from comment #2)

I am pretty sure patch [3] is not in mainline ;-),
the trick is not the enabling of the target fontconfig/libjepeg but to
force host-fontconfig/host-libjpeg to be available to fullfill the
qt5webengine host-pkg-search for all/some libs enabled only for the target...
Comment 4 Peter Seiderer 2021-12-16 18:03:24 UTC
(In reply to Peter Seiderer from comment #3)

And finally the corresponding patchwork link [5]...

[5] https://patchwork.ozlabs.org/project/buildroot/patch/20201221203952.22168-3-ps.report@gmx.net/
Comment 5 Wojciech Ziniewicz 2021-12-16 21:18:37 UTC
Wonderful - Peter - let me try to use that in my build system and get back with comments.

What are the chances these patches are included in the mainline?
Comment 6 Yann E. MORIN 2024-06-15 15:00:21 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!