Bug 236441 - www/chromium: stops with unknown type name '__uint128_t' on arm64
Summary: www/chromium: stops with unknown type name '__uint128_t' on arm64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Carlos J. Puga Medina
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-10 05:58 UTC by Bob Prohaska
Modified: 2019-04-17 20:49 UTC (History)
3 users (show)

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


Attachments
patch (6.89 KB, patch)
2019-04-04 13:03 UTC, Mikael Urankar
no flags Details | Diff
patch (6.82 KB, patch)
2019-04-14 21:22 UTC, Carlos J. Puga Medina
no flags Details | Diff
patch (7.37 KB, patch)
2019-04-15 06:48 UTC, Mikael Urankar
no flags Details | Diff
patch (17.90 KB, patch)
2019-04-17 07:26 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Prohaska 2019-03-10 05:58:04 UTC
On an rpi3 running FreeBSD 13.0-CURRENT r344791 GENERIC  arm64
with ports at Revision: 495224

attempts to compile www/chromium using
make -DBATCH MAKE_UNSAFE_JOBS=yes DISABLE_VULNERABILITIES=yes > make.log &

result in make stopping with /usr/include/machine/ucontext.h:46:2: error: unknown type name '__uint128_t'
        __uint128_t     fp_q[32];
        ^
1 error generated.
Comment 1 John F. Carr 2019-04-04 12:34:45 UTC
The underlying problem appears to be these compiler flags: --target=arm-linux-gnueabihf -march=armv7-a -mfloat-abi=hard -mtune=generic-armv7-a -mfpu=neon -mthumb

It's trying to compile for 32 bit ARM on a 64 bit system.
Comment 2 Mikael Urankar freebsd_committer freebsd_triage 2019-04-04 13:03:05 UTC
Created attachment 203376 [details]
patch

can you try this patch?
Comment 3 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-14 12:50:39 UTC
(In reply to mikael.urankar from comment #2)

Mikael,

patch-third__party_boringssl_src_crypto_cpu-aarch64-linux.c fails to apply cleanly.

Would you mind regenerating patches after r498279?

Thanks
Comment 4 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-14 21:22:15 UTC
Created attachment 203677 [details]
patch

Regenerate patch after r498279.
Comment 5 Mikael Urankar freebsd_committer freebsd_triage 2019-04-15 06:48:47 UTC
Created attachment 203682 [details]
patch

Regen patch.

I have this issue later in the build, does it build fine on amd64?

In file included from ../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Process.cpp:94:
In file included from ../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Unix/Process.inc:40:
/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
#error "<malloc.h> has been replaced by <stdlib.h>"
 ^
In file included from ../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Process.cpp:94:
../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Unix/Process.inc:89:19: error: variable has incomplete type 'struct mallinfo'
  struct mallinfo mi;
                  ^
../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Unix/Process.inc:89:10: note: forward declaration of 'mallinfo'
  struct mallinfo mi;
         ^
../../third_party/swiftshader/third_party/llvm-7.0/llvm/lib/Support/Unix/Process.inc:90:10: error: no member named 'mallinfo' in the global namespace
  mi = ::mallinfo();
       ~~^
3 errors generated.
Comment 6 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-15 10:39:10 UTC
(In reply to mikael.urankar from comment #5)

Try to tweak third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h

--- third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h.orig	2019-04-15 10:32:41 UTC
+++ third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/config.h
@@ -122,7 +122,7 @@
 /* #undef HAVE_MALLCTL */
 
 /* Define to 1 if you have the `mallinfo' function. */
-#define HAVE_MALLINFO 1
+/* #define HAVE_MALLINFO 1 */
 
 /* Define to 1 if you have the <malloc.h> header file. */
 #define HAVE_MALLOC_H 1
Comment 7 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-15 10:56:27 UTC
(In reply to Carlos J. Puga Medina from comment #6)

More patches to unbreak build on arm64

-- third_party/swiftshader/src/Reactor/BUILD.gn.orig	2019-04-15 10:31:54 UTC
+++ third_party/swiftshader/src/Reactor/BUILD.gn
@@ -170,9 +170,6 @@ config("swiftshader_reactor_private_config") {
     ]
   } else {
     cflags = [ "-Wno-unused-local-typedef" ]
-    if(target_cpu == "arm64") {
-      cflags += [ "-Wno-defaulted-function-deleted" ]
-    }
     defines = [
       "__STDC_CONSTANT_MACROS",
       "__STDC_LIMIT_MACROS",

--- third_party/swiftshader/third_party/llvm-7.0/BUILD.gn.orig	2019-04-15 10:31:14 UTC
+++ third_party/swiftshader/third_party/llvm-7.0/BUILD.gn
@@ -61,10 +61,6 @@ config("swiftshader_llvm_private_config") {
     }
   } 

-  if(target_cpu == "arm64") {
-    cflags += [ "-Wno-defaulted-function-deleted" ]
-  }
-
   cflags += [
     "-Wno-attributes",
     "-Wno-deprecated-declarations",
Comment 8 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-15 11:47:43 UTC
I started a new build on amd64, let's see what happens.
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2019-04-15 14:15:39 UTC
more patches are needed (third_party/zlib/arm_features.c),
java is also needed


What do you prefer for swiftshader (I still don't understand how it can compiles on amd64)
 - I patch third_party/swiftshader/third_party/llvm-7.0/configs/linux/include/llvm/Config/*
 - I create a new dir 'bsd' with our stuff in it:

--- third_party/swiftshader/third_party/llvm-7.0/BUILD.gn.orig  2019-04-15 16:11:25.681968000 +0200
+++ third_party/swiftshader/third_party/llvm-7.0/BUILD.gn       2019-04-15 12:02:01.926709000 +0200
@@ -98,7 +98,9 @@ llvm_include_dirs = [
   "configs/common/lib/Transforms/InstCombine/",
 ]
 
-if (is_linux) {
+if (is_bsd) {
+  llvm_include_dirs += [ "configs/bsd/include/" ]
+} else if (is_linux) {
   llvm_include_dirs += [ "configs/linux/include/" ]
 } else if (is_fuchsia) {
   llvm_include_dirs += [ "configs/fuchsia/include/" ]
Comment 10 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-15 15:34:32 UTC
(In reply to mikael.urankar from comment #9)

I prefer whatever is more comfortable to maintain these patches, but I leave the final decision in your hands :)
Comment 11 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-15 16:18:27 UTC
We can drop third_party/zlib/arm_features.c and patch third_party/zlib/BUILD.gn

https://codesearch.chromium.org/chromium/src/third_party/zlib/BUILD.gn?q=third_party/zlib/BUILD.gn&sq=package:chromium&dr&l=1
Comment 12 Mikael Urankar freebsd_committer freebsd_triage 2019-04-15 16:20:54 UTC
(In reply to Carlos J. Puga Medina from comment #10)
sure thing, here is an inline patch:
--- Makefile    (revision 498947)
+++ Makefile    (working copy)
@@ -66,6 +66,7 @@
                noto-basic>0:x11-fonts/noto-basic
 
 BROKEN_FreeBSD_11_aarch64=     components/safe_browsing_db/v4_rice.cc:120:18: use of overloaded operator '&' is ambiguous
+BROKEN_aarch64=                use www/firefox instead
 ONLY_FOR_ARCHS=                        aarch64 amd64 i386

:p
Comment 13 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-15 16:47:39 UTC
(In reply to Carlos J. Puga Medina from comment #11)

This should work :P

--- third_party/zlib/BUILD.gn.orig	2019-04-15 18:44:25.862148000 +0200
+++ third_party/zlib/BUILD.gn	2019-04-15 18:45:56.556127000 +0200
@@ -67,7 +67,7 @@
     #      implement the CRC32* instructions. These are optional in ARMv8.0."
     #  - Fuchsia just added a syscall for feature detection.
     # TODO(cavalcantii): crbug.com/810125.
-    if (!is_ios && !is_fuchsia) {
+    if (!is_ios && !is_fuchsia && !is_freebsd) {
       defines = [ "CRC32_ARMV8_CRC32" ]
       if (is_android) {
         defines += [ "ARMV8_OS_ANDROID" ]
@@ -80,7 +80,7 @@
   source_set("zlib_arm_crc32") {
     visibility = [ ":*" ]
 
-    if (is_clang && (!is_ios && !is_fuchsia)) {
+    if (is_clang && (!is_ios && !is_fuchsia && !is_freebsd)) {
       include_dirs = [ "." ]
 
       if (is_android) {
Comment 14 Mikael Urankar freebsd_committer freebsd_triage 2019-04-17 07:26:15 UTC
Created attachment 203732 [details]
patch
Comment 15 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-17 08:21:49 UTC
(In reply to mikael.urankar from comment #14)

Testing patch on FreeBSD 13.0-CURRENT/amd64.
Comment 16 commit-hook freebsd_committer freebsd_triage 2019-04-17 20:47:18 UTC
A commit references this bug:

Author: cpm
Date: Wed Apr 17 20:46:32 UTC 2019
New revision: 499210
URL: https://svnweb.freebsd.org/changeset/ports/499210

Log:
  www/chromium: Unbreak on arm64

  PR:		236441
  Submitted by:	Mikael Urankar <mikael.urankar@gmail.com>
  MFH:		2019Q2

Changes:
  head/www/chromium/Makefile
  head/www/chromium/files/patch-build_detect__host__arch.py
  head/www/chromium/files/patch-third__party_boringssl_src_crypto_cpu-aarch64-linux.c
  head/www/chromium/files/patch-third__party_crc32c_src_src_crc32c__arm64__linux__check.h
  head/www/chromium/files/patch-third__party_swiftshader_third__party_llvm-7.0_configs_linux_include_llvm_Config_config.h
  head/www/chromium/files/patch-third__party_swiftshader_third__party_llvm-7.0_configs_linux_include_llvm_Config_llvm-config.h
  head/www/chromium/files/patch-third__party_zlib_arm__features.c
  head/www/chromium/files/patch-tools_gn_util_sys__info.cc
Comment 17 Carlos J. Puga Medina freebsd_committer freebsd_triage 2019-04-17 20:49:28 UTC
Committed, thanks!