Bug 271228

Summary: www/qt6-webengine: fix build on armv7
Product: Ports & Packages Reporter: Robert Clausecker <fuz>
Component: Individual Port(s)Assignee: Robert Clausecker <fuz>
Status: Closed FIXED    
Severity: Affects Only Me CC: kai, kde
Priority: --- Flags: kai: maintainer-feedback+
Version: Latest   
Hardware: arm   
OS: Any   
Attachments:
Description Flags
www/qt6-webengine: fix build on armv7
none
www/qt6-webengine: fix build on armv7 kai: maintainer-approval+

Description Robert Clausecker freebsd_committer freebsd_triage 2023-05-03 15:03:27 UTC
Created attachment 241954 [details]
www/qt6-webengine: fix build on armv7

The attached patch improved some existing patches so they also work on armv7 (taken from devel/electron19).  Unfortunately the build then fails in a later stage due to a crash in node.
Comment 1 Kai Knoblich freebsd_committer freebsd_triage 2023-06-02 15:06:03 UTC
(In reply to Robert Clausecker from comment #0)

Hi Robert,

thanks for the patch. Regarding the node crash you mentioned: Would it help to get a successful build by expanding the conditional in the Makefile to include armv7 as well, e.g.:

> .if ${ARCH} == i386 || ${ARCH} == armv7
> EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-i386-compress_files_js
> .endif

If this helps then we should rename "extra-patch-i386-compress_files_js" to a more generic name, e.g. "extra-patch-32bit-compress_files_js" and update its boiler plate as well.
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2023-06-02 23:01:30 UTC
This indeed gets us further, but now the build fails here:

[ 72% 21685/30031] LINK host/root_store_tool                                                                           
FAILED: host/root_store_tool                                                                                           
/usr/local/bin/python3.9 "../../../../../qtwebengine-everywhere-src-6.4.2/src/3rdparty/chromium/build/toolchain/gcc_lin
k_wrapper.py" --output="host/root_store_tool" -- /usr/local/libexec/ccache/c++ -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecs
tack -Wl,-z,relro -Wl,-z,now -no-canonical-prefixes -Wl,-O2 -Wl,--gc-sections -rdynamic -pie -Wl,--disable-new-dtags -L
/usr/local/lib  -fstack-protector-strong -L/usr/local/lib  -o "host/root_store_tool" -Wl,--start-group @"host/root_stor
e_tool.rsp"  -Wl,--end-group  -lpthread -lkvm -lexecinfo -lutil -levent -lnss3 -lsmime3 -lnssutil3 -lplds4 -lplc4 -lnsp
r4 -ldl -lz                                                                                                            
ld: error: undefined symbol: OPENSSL_cpuid_setup                                                                       
>>> referenced by crypto.c                                                                                             
>>>               boringssl/crypto.o:(.text+0x0) in archive host/obj/third_party/boringssl/libboringssl.a              
c++: error: linker command failed with exit code 1 (use -v to see invocation)                                          

This looks like something I can patch though.  Will investigate and report back when I'm done.
Comment 3 Robert Clausecker freebsd_committer freebsd_triage 2023-06-03 21:20:12 UTC
Created attachment 242586 [details]
www/qt6-webengine: fix build on armv7

Got it!  Patch now fixes the build successfully.  Will commit with my next batch.
Comment 4 Kai Knoblich freebsd_committer freebsd_triage 2023-06-04 05:31:18 UTC
Comment on attachment 242586 [details]
www/qt6-webengine: fix build on armv7

(In reply to Robert Clausecker from comment #3)

That's great! The updated patch LGTM (with KDE hat on), only the PORTREVISION needs to be adjusted, as qt6-webengine is already at 6.4.2_5 as this time of writing.

NB: Perhaps a brief explanation in the commit message of why the PORTREVISION gets bumped, would make sense as well to avoid unnecessary questions.
Comment 5 Robert Clausecker freebsd_committer freebsd_triage 2023-06-04 10:44:14 UTC
(In reply to Kai Knoblich from comment #4)

I bumped portrevision due to nontrivial changes in the code which should not but may impact other architectures.

Unfortunately once I transfered the patch from my development tree to the current ports tree, it now no longer clears the node.js error from earlier:

/usr/local/bin/python3.9 ../../../../../qtwebengine-everywhere-src-6.4.2/src/3rdparty/chromium/third_party/node/node.py ../../../../../qtwebengine-everywhere-src-6.4.2/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/compress_files.js --file_list __third_party_devtools-frontend_src_compress__wrkdirs_usr_ports_www_qt6-webengine_work_.build_src_core_target_toolchain_target__rule..rsp
Traceback (most recent call last):
  File "/wrkdirs/usr/ports/www/qt6-webengine/work/.build/src/core/Release/armv7/../../../../../qtwebengine-everywhere-src-6.4.2/src/3rdparty/chromium/third_party/node/node.py", line 58, in <module>
    RunNode(sys.argv[1:])
  File "/wrkdirs/usr/ports/www/qt6-webengine/work/.build/src/core/Release/armv7/../../../../../qtwebengine-everywhere-src-6.4.2/src/3rdparty/chromium/third_party/node/node.py", line 53, in RunNode
    raise RuntimeError('Command \'%s\' failed\n%s' % (' '.join(cmd), err))
RuntimeError: Command '/usr/local/bin/node ../../../../../qtwebengine-everywhere-src-6.4.2/src/3rdparty/chromium/third_party/devtools-frontend/src/scripts/build/compress_files.js --file_list __third_party_devtools-frontend_src_compress__wrkdirs_usr_ports_www_qt6-webengine_work_.build_src_core_target_toolchain_target__rule..rsp' failed

...

My development tree is based on an older ports tree, so there might have been an update inbetween causing the extra patch from i386 to no longer suffice.
Comment 6 Robert Clausecker freebsd_committer freebsd_triage 2023-06-04 12:36:54 UTC
I managed to fix the build by changing the BROTLI_PARAM_QUALITY to 4 in the extra patch.  Do you approve of this change?
Comment 7 Kai Knoblich freebsd_committer freebsd_triage 2023-06-04 13:25:08 UTC
(In reply to Robert Clausecker from comment #6)

If a successful build of qt6-webengine on i386 with this change can be confirmed as well: Ship it!
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-06-05 16:54:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=dd2c7b778901a7b310d37f044c0018de1603c37f

commit dd2c7b778901a7b310d37f044c0018de1603c37f
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-05-03 14:59:15 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-06-05 16:53:00 +0000

    www/qt6-webengine: fix build on armv7

    Improve two patches with more complete variants from devel/electron19.
    Patch bundled boringssl with additional patches from the same port.
    Avoid an OOM condition by using the same extra patch previously only
    used on i386.  In that patch, decreate BROTLI_PARAM_QUALITY further
    to 4 to avoid flakiness on armv7.

    Obtained from:  devel/electron19
    Approved by:    kai (with hat: kde, maintainer)
    PR:             271228

 www/qt6-webengine/Makefile                         |  6 +--
 ...iles_js => extra-patch-32bit-compress_files_js} |  2 +-
 ...mium_third__party_boringssl_BUILD.generated.gni |  9 ++--
 ..._boringssl_src_crypto_cpu__arm__freebsd.c (new) | 55 ++++++++++++++++++++++
 ...y_chromium_third__party_skia_src_core_SkCpu.cpp | 25 +++++++++-
 ...romium_v8_src_base_platform_platform-freebsd.cc |  2 +-
 6 files changed, 90 insertions(+), 9 deletions(-)