Bug 243653

Summary: www/firefox: fix build on aarch64
Product: Ports & Packages Reporter: Mikael Urankar <mikael>
Component: Individual Port(s)Assignee: freebsd-gecko (Nobody) <gecko>
Status: Closed FIXED    
Severity: Affects Some People CC: w.schwarzenfeld
Priority: ---    
Version: Latest   
Hardware: arm64   
OS: Any   
URL: http://thunderx1.nyi.freebsd.org/data/head-arm64-default/p521042_s356139/logs/errors/firefox-71.0_6,1.log
Attachments:
Description Flags
patch
none
patch
none
patch jbeich: maintainer-approval+

Description Mikael Urankar freebsd_committer freebsd_triage 2020-01-27 16:09:07 UTC
Created attachment 211106 [details]
patch

The interface has changed a bit on -current:

In file included from Unified_cpp_gfx_skia1.cpp:137:
/wrkdirs/usr/ports/www/firefox/work/firefox-71.0/gfx/skia/skia/src/core/SkCpu.cpp:81:13: error: use of undeclared identifier 'ID_AA64ISAR0_CRC32'
        if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2020-02-16 17:00:04 UTC
Is it ok to commit?
Comment 2 Jan Beich freebsd_committer freebsd_triage 2020-02-16 17:07:02 UTC
Comment on attachment 211106 [details]
patch

Sorry, I've missed this patch. Can you propagate the same fix to www/cliqz, www/firefox-esr and mail/thunderbird?

> +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__)
>++#ifndef ID_AA64ISAR0_CRC32_VAL
>++#define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
>++#endif
> +    #include <machine/armreg.h>

Move #ifndef after #include or it won't have effect.
Comment 3 Mikael Urankar freebsd_committer freebsd_triage 2020-02-16 18:11:54 UTC
Created attachment 211696 [details]
patch

Updated patch for firefox and firefox-esr


cliqz seems broken:
===>  Extracting for cliqz-1.32.1_1
=> SHA256 Checksum mismatch for cliqz/adult-domains.bin.
=> SHA256 Checksum OK for cliqz/cliqz@cliqz.com.xpi.
=> SHA256 Checksum OK for cliqz/gdprtool@cliqz.com.xpi.
=> SHA256 Checksum OK for cliqz/https-everywhere@cliqz.com.xpi.
=> SHA256 Checksum OK for cliqz/cliqz-oss-browser-f-1.32.1_GH0.tar.gz.
===>  Refetch for 1 more times files:  cliqz/adult-domains.bin 
===>  License MPL20 accepted by the user
===>   cliqz-1.32.1_1 depends on file: /usr/local/sbin/pkg - found
===>   cliqz-1.32.1_1 depends on package: ca_root_nss>=0 - found
=> adult-domains.bin doesn't seem to exist in /usr/ports/distfiles/cliqz.
=> Attempting to fetch https://s3.amazonaws.com/cdn.cliqz.com/browser-f/APT/adult-domains.bin
adult-domains.bin                                      516 kB 1193 kBps    00s
===> Fetching all distfiles required by cliqz-1.32.1_1 for building
===>  License MPL20 accepted by the user
===>   cliqz-1.32.1_1 depends on file: /usr/local/sbin/pkg - found
===>   cliqz-1.32.1_1 depends on package: ca_root_nss>=0 - found
===> Fetching all distfiles required by cliqz-1.32.1_1 for building
=> SHA256 Checksum mismatch for cliqz/adult-domains.bin.
=> SHA256 Checksum OK for cliqz/cliqz@cliqz.com.xpi.
=> SHA256 Checksum OK for cliqz/gdprtool@cliqz.com.xpi.
=> SHA256 Checksum OK for cliqz/https-everywhere@cliqz.com.xpi.
=> SHA256 Checksum OK for cliqz/cliqz-oss-browser-f-1.32.1_GH0.tar.gz.
===>  Giving up on fetching files:  cliqz/adult-domains.bin 
Make sure the Makefile and distinfo file (/usr/ports/www/cliqz/distinfo)
are up to date.  If you are absolutely sure you want to override this
check, type "make NO_CHECKSUM=yes [other args]".
Comment 4 Jan Beich freebsd_committer freebsd_triage 2020-02-16 20:09:40 UTC
Comment on attachment 211696 [details]
patch

(In reply to Mikael Urankar from comment #3)
> +    #include <machine/armreg.h>
> +#ifndef ID_AA64ISAR0_CRC32_VAL
> +#define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
> +#endif

(cosmetic) Can you align whitespace so it looks like the following?

+    #include <machine/armreg.h>
+    #ifndef ID_AA64ISAR0_CRC32_VAL
+    #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
+    #endif

> Updated patch for firefox and firefox-esr

Without thunderbird? Also this version is broken:

  $ cc a.c
  a.c:15:13: warning: implicit declaration of function 'ID_AA64ISAR0_CRC32' is invalid in C99 [-Wimplicit-function-declaration]
	  if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
	      ^
  a.c:14:24: error: expected readable system register
	  id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
			 ^
  /usr/include/machine/armreg.h:61:19: note: expanded from macro 'READ_SPECIALREG'
	  __asm __volatile("mrs   %0, " __STRING(reg) : "=&r" (_val));    \
			   ^
  <inline asm>:1:10: note: instantiated into assembly here
	  mrs     x9, (((3) << 19) | ((0) << 16) | ((0) << 12) | ((6) << 8) | ((0) << 5))
		      ^
  1 warning and 1 error generated.

  $ cat a.c
  #include <stdint.h>
  #include <stdio.h>

  #include <machine/armreg.h>
  #ifndef ID_AA64ISAR0_CRC32_VAL
  #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
  #endif

  int main(void)
  {
      uint32_t features = 0;
      uint64_t id_aa64isar0;

      id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
      if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
	  printf("CRC32 found\n");
      }
  }

> cliqz seems broken:

Then its maintainer can pick up the fix on their own. ;)
Comment 5 Mikael Urankar freebsd_committer freebsd_triage 2020-02-16 20:43:49 UTC
Created attachment 211698 [details]
patch

this one includes thunderbird.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2020-02-17 11:01:15 UTC
Comment on attachment 211698 [details]
patch

Thanks.
Comment 7 Mikael Urankar freebsd_committer freebsd_triage 2020-03-29 09:38:06 UTC
Can we get this committed please?
Comment 8 Jan Beich freebsd_committer freebsd_triage 2020-03-29 11:53:28 UTC
I was expecting you to land since you have ports/ bit nowadays.
Comment 9 Mikael Urankar freebsd_committer freebsd_triage 2020-03-29 12:16:28 UTC
(In reply to Jan Beich from comment #8)
Ok, it wasn't very clear. How do you proceed usually, one commit for the three ports or one commit per port?
Comment 10 Jan Beich freebsd_committer freebsd_triage 2020-03-29 12:23:51 UTC
(In reply to Mikael Urankar from comment #9)
> How do you proceed usually, one commit for the three ports
> or one commit per port?

If the fix is the same across many ports then use one commit e.g., ports r509662.
Comment 11 commit-hook freebsd_committer freebsd_triage 2020-03-31 15:14:33 UTC
A commit references this bug:

Author: mikael
Date: Tue Mar 31 15:13:16 UTC 2020
New revision: 529979
URL: https://svnweb.freebsd.org/changeset/ports/529979

Log:
  www/firefox: fix build on aarch64

  The interface has changed a bit on -current:

  In file included from Unified_cpp_gfx_skia1.cpp:137:
  /wrkdirs/usr/ports/www/firefox/work/firefox-71.0/gfx/skia/skia/src/core/SkCpu.cpp:81:13: error: use of undeclared identifier 'ID_AA64ISAR0_CRC32'
          if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {

  PR:		243653
  Reviewed by:	jbeich
  Approved by:	jbeich , manu (mentor, implicit)

Changes:
  head/mail/thunderbird/files/patch-gfx_skia_skia_src_core_SkCpu.cpp
  head/www/firefox/files/patch-gfx_skia_skia_src_core_SkCpu.cpp
  head/www/firefox-esr/files/patch-gfx_skia_skia_src_core_SkCpu.cpp