Bug 236855 - www/qt5-webengine: fails to build on aarch64 and armv7 after 5.12 update
Summary: www/qt5-webengine: fails to build on aarch64 and armv7 after 5.12 update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Some People
Assignee: freebsd-kde (Team)
URL: http://thunderx1.nyi.freebsd.org/data...
Keywords: patch, regression
Depends on: 228603
Blocks: 238701
  Show dependency treegraph
 
Reported: 2019-03-28 16:38 UTC by Jan Beich
Modified: 2019-06-19 04:52 UTC (History)
4 users (show)

See Also:
tcberner: maintainer-feedback+
jbeich: merge-quarterly+


Attachments
patch (967 bytes, patch)
2019-04-01 09:59 UTC, Mikael Urankar
no flags Details | Diff
patch2 (689 bytes, patch)
2019-04-01 10:35 UTC, Jan Beich
no flags Details | Diff
patch (1.18 KB, patch)
2019-04-01 14:22 UTC, Mikael Urankar
no flags Details | Diff
patch (1.60 KB, patch)
2019-04-01 16:14 UTC, Mikael Urankar
no flags Details | Diff
aarch64 fixes (7.54 KB, patch)
2019-04-03 14:47 UTC, Jan Beich
no flags Details | Diff
aarch64 + armv7 fixes (14.70 KB, patch)
2019-04-03 21:08 UTC, Jan Beich
tcberner: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2019-03-28 16:38:49 UTC
11.2 aarch64:

  In file included from ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/crc32c/src/src/crc32c.cc:11:
  ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/crc32c/src/src/./crc32c_arm64_linux_check.h:20:10: fatal error: 'sys/auxv.h' file not found
  #include <sys/auxv.h>
	   ^~~~~~~~~~~~
  1 error generated.

12.0 aarch64:

  ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/zlib/arm_features.c:16:10: fatal error: 'asm/hwcap.h' file not found
  #include <asm/hwcap.h>
	   ^~~~~~~~~~~~~
  1 error generated.


12.0 armv7

  In file included from ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/device/gamepad/public/cpp/gamepad.cc:5:
  ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/device/gamepad/public/cpp/gamepad.h:9:10: fatal error: 'cstdint' file not found
  #include <cstdint>
	   ^~~~~~~~~
  1 error generated.
Comment 1 Jan Beich freebsd_committer 2019-03-28 17:12:10 UTC
13.0 aarch64:

  In file included from ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/skia/src/core/SkOpts.cpp:43:
  ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h:683:19: error: functional-style cast from 'neon::F' (aka 'V<float>') to '__fp16' is not allowed
      __fp16 fp16 = __fp16(f);
		    ^~~~~~~~
  1 error generated.

13.0 armv7:

  In file included from ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_extension.cc:33:
  In file included from ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/compiler/javanano/javanano_extension.h:38:
  ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/protobuf/src/google/protobuf/stubs/common.h:38:10: fatal error: 'algorithm' file not found
  #include <algorithm>
	   ^~~~~~~~~~~
  1 error generated.
Comment 2 Tobias C. Berner freebsd_committer 2019-03-30 20:31:58 UTC
Hmmm, I don't have any sensible way to test armv7/aarch64 stuff... 

mfg Tobias
Comment 3 Jan Beich freebsd_committer 2019-03-30 21:29:07 UTC
(In reply to Tobias C. Berner from comment #2)
Why not cross-compile? On -CURRENT amd64 you can build a very large set of release/architecture tuples.

# NOTE: -x (native-xtools) for < 12.0 targets requires /usr/src to match requested version
$ poudriere jail -cj 112aarch64 -x -a arm64.aarch64 -v 11.2-RELEASE
$ poudriere jail -cj 120aarch64 -x -a arm64.aarch64 -v 12.0-RELEASE
$ poudriere jail -cj head-aarch64 -x -a arm64.aarch64 -v 13.0-CURRENT

$ poudriere jail -cj 120armv7 -x -a arm.armv7 -v releng/12.0 -m svn+https
$ poudriere jail -cj head-armv7 -x -a arm.armv7 -v head -m svn+https

More details:
https://wiki.freebsd.org/QemuUserModeHowTo
https://wiki.freebsd.org/Ports/BuildingPackagesThroughEmulation
https://www.youtube.com/watch?v=2J9Lz3pgnbA
https://www.youtube.com/watch?v=JfZIoyQhly4
Comment 4 Tobias C. Berner freebsd_committer 2019-03-30 21:35:58 UTC
Yes, I know about that. What I meant is, without wasting CPU cycles on my good machine for that :)
Comment 5 Jan Beich freebsd_committer 2019-03-30 21:47:50 UTC
(In reply to Tobias C. Berner from comment #4)
On my i7-6700k building qt5-webengine 5.9.5 for aarch64 took ~9 minutes more than for amd64 (53 min vs. 44 min). Is that much? Or did you build jails without -x (native-xtools) which provides major speedup?

If you don't want to I can test for you. OTOH, I'm not gonna waste time on amd64/i386 instead as that would be your job. ;)
Comment 6 Tobias C. Berner freebsd_committer 2019-03-30 21:56:52 UTC
Patches are always welcome :D 

That being said, I will order an SSD and dig out my old computer ^^


mfg Tobias
Comment 7 Mikael Urankar freebsd_committer 2019-04-01 09:59:01 UTC
Created attachment 203288 [details]
patch

qemu-user hangs on my system, can you test the attached patch on aarch64 and revert https://github.com/qt/qtwebengine-chromium/commit/b2de8e8046dc1c558465f74b4afe11d57cbc6cf3 ?
Comment 8 Jan Beich freebsd_committer 2019-04-01 10:35:13 UTC
Created attachment 203289 [details]
patch2

> revert https://github.com/qt/qtwebengine-chromium/commit/b2de8e8046dc1c558465f74b4afe11d57cbc6cf3

Doesn't revert cleanly. __ARM_FP16_FORMAT_IEEE shenanigans remind me of bug 231293.
Comment 9 Jan Beich freebsd_committer 2019-04-01 10:40:26 UTC
Comment on attachment 203289 [details]
patch2

Indeed. The old version also builds with Clang.
Comment 10 Jan Beich freebsd_committer 2019-04-01 12:33:49 UTC
Comment on attachment 203288 [details]
patch

(In reply to mikael.urankar from comment #7)
> can you test the attached patch on aarch64 and revert ...?

11.2/12.0/13.0 aarch64 fails in the same place:

  ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/zlib/arm_features.c:16:10: fatal error: 'asm/hwcap.h' file not found
  #include <asm/hwcap.h>
	   ^~~~~~~~~~~~~
  1 error generated.
Comment 11 Raphael Kubo da Costa freebsd_committer 2019-04-01 13:09:25 UTC
The fp16 thing on ARM reminds me of something I had to fix at work a while ago (I had to make the GCC case work though). My fix was https://github.com/OSSystems/meta-browser/blob/master/recipes-browser/chromium/files/aarch64-skia-build-fix.patch, and I assume the webengine guys needed a GCC fix as well. It's weird that their change breaks our clang build because it should also break their clang builds (unless they're not testing clang+arm64). In any case, it'd be good to file a bug in Qt's bug tracker about this.

The arm_features.c error could be solved by adjusting patch-src_3rdparty_chromium_third__party_zlib_arm__features.c and only including those headers when we're not building on BSD (the patch came from www/chromium, but I'm not sure if the chromium port enables OS_LINUX in builds like we do for webengine).
Comment 12 Mikael Urankar freebsd_committer 2019-04-01 14:22:03 UTC
Created attachment 203292 [details]
patch

and with this patch for arm_features.c? Not tested on my side, it takes ages to build on my jetson.
Comment 13 Mikael Urankar freebsd_committer 2019-04-01 16:14:11 UTC
Created attachment 203301 [details]
patch

this one compiles
Comment 15 Raphael Kubo da Costa freebsd_committer 2019-04-03 13:21:53 UTC
AFAIU we still don't have one single patch with all fixes, right? If that's indeed the case can someone take care of doing that?
Comment 16 Jan Beich freebsd_committer 2019-04-03 14:47:54 UTC
Created attachment 203348 [details]
aarch64 fixes

The version tested in comment 14. I've updated build logs since ports r497572.
Comment 17 Jan Beich freebsd_committer 2019-04-03 15:53:39 UTC
Comment on attachment 203348 [details]
aarch64 fixes

>+--- src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h.orig	2019-01-16 10:59:47 UTC
>++++ src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h
>+@@ -658,9 +658,7 @@ SI F approx_powf(F x, F y) {
>+ 
>+ SI F from_half(U16 h) {
>+ #if defined(__ARM_FP16_FORMAT_IEEE)
>+-    __fp16 fp16;
>+-    memcpy(&fp16, &h, sizeof(U16));
>+-    return float(fp16);
>++    return vcvt_f32_f16(h);
>+ 
>+ #elif defined(JUMPER_IS_HSW) || defined(JUMPER_IS_AVX512)
>+     return _mm256_cvtph_ps(h);
>+@@ -680,10 +678,7 @@ SI F from_half(U16 h) {
>+ 
>+ SI U16 to_half(F f) {
>+ #if defined(__ARM_FP16_FORMAT_IEEE)
>+-    __fp16 fp16 = __fp16(f);
>+-    U16 u16;
>+-    memcpy(&u16, &fp16, sizeof(U16));
>+-    return u16;
>++    return vcvt_f16_f32(f);

armv7 didn't like this change:

In file included from ../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/skia/src/core/SkOpts.cpp:43:
../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h:661:12: error: use of undeclared identifier 'vcvt_f32_f16'
    return vcvt_f32_f16(h);
           ^
../../../../qtwebengine-everywhere-src-5.12.1/src/3rdparty/chromium/third_party/skia/src/opts/SkRasterPipeline_opts.h:681:12: error: use of undeclared identifier 'vcvt_f16_f32'
    return vcvt_f16_f32(f);
           ^
2 errors generated.
Comment 18 Jan Beich freebsd_committer 2019-04-03 21:08:44 UTC
Created attachment 203356 [details]
aarch64 + armv7 fixes

12.0 armv7 builds fine but 13.0 armv7 fails in what maybe a qemu-user-static issue.

https://people.freebsd.org/~jbeich/logs/120armv7/qt5-webengine-5.12.1_1.log
https://people.freebsd.org/~jbeich/logs/head-armv7/qt5-webengine-5.12.1_1.log
Comment 20 Tobias C. Berner freebsd_committer 2019-04-04 04:34:05 UTC
Comment on attachment 203356 [details]
aarch64 + armv7 fixes

ship it
Comment 21 commit-hook freebsd_committer 2019-04-04 23:29:56 UTC
A commit references this bug:

Author: jbeich
Date: Thu Apr  4 23:29:37 UTC 2019
New revision: 497877
URL: https://svnweb.freebsd.org/changeset/ports/497877

Log:
  www/qt5-webengine: unbreak on aarch64 and armv7 after r496989

  PR:		236855
  Reported by:	pkg-fallout
  Submitted by:	Mika?l Urankar
  Approved by:	kde (tcberner)

Changes:
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_build_config_compiler_BUILD.gn
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_crc32c_src_src_crc32c__arm64__linux__check.h
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_opts_SkRasterPipeline__opts.h
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_zlib_arm__features.c
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_v8_src_arm_cpu-arm.cc
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_v8_src_base_platform_platform-freebsd.cc
  head/www/qt5-webengine/files/patch-src_3rdparty_chromium_v8_src_libsampler_sampler.cc
Comment 22 Raphael Kubo da Costa freebsd_committer 2019-04-05 18:35:22 UTC
Thanks for the work here. Do you plan on MFHing this change?
Comment 23 commit-hook freebsd_committer 2019-04-05 19:24:40 UTC
A commit references this bug:

Author: jbeich
Date: Fri Apr  5 19:24:01 UTC 2019
New revision: 497980
URL: https://svnweb.freebsd.org/changeset/ports/497980

Log:
  MFH: r497877

  www/qt5-webengine: unbreak on aarch64 and armv7 after r496989

  PR:		236855
  Reported by:	pkg-fallout
  Submitted by:	Mika?l Urankar
  Approved by:	kde (tcberner)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2019Q2/
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_build_config_compiler_BUILD.gn
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_crc32c_src_src_crc32c__arm64__linux__check.h
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_core_SkCpu.cpp
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_skia_src_opts_SkRasterPipeline__opts.h
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_zlib_arm__features.c
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_v8_src_arm_cpu-arm.cc
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_v8_src_base_platform_platform-freebsd.cc
  branches/2019Q2/www/qt5-webengine/files/patch-src_3rdparty_chromium_v8_src_libsampler_sampler.cc
Comment 24 Jan Beich freebsd_committer 2019-04-05 19:25:12 UTC
(In reply to Raphael Kubo da Costa from comment #22)
I planned to and then forgot. Thanks for the reminder.