Bug 218547

Summary: math/openblas: fails to build on aarch64 (blocking 302 ports)
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Jan Beich <jbeich>
Status: Closed FIXED    
Severity: Affects Only Me CC: Andrew, emaste, linimon, phd_kimberlite
Priority: --- Keywords: needs-patch
Version: LatestFlags: phd_kimberlite: maintainer-feedback+
jbeich: merge-quarterly+
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 201763    
Attachments:
Description Flags
Limit DYNAMIC_ARCH to x86 archs (partial fix)
none
Full patch none

Description Jan Beich freebsd_committer 2017-04-10 17:40:15 UTC
===>  openblas-0.2.19_1,1 has to be built manually: Optimizes for the build
machine..
*** Error code 1

http://thunderx1.nyi.freebsd.org/data/110arm64-default/437513/logs/openblas-0.2.19_1,1.log

but disabling DYNAMIC_ARCH doesn't help

getarch_2nd.c:12:35: error: use of undeclared identifier 'SGEMM_DEFAULT_UNROLL_M'
    printf("SGEMM_UNROLL_M=%d\n", SGEMM_DEFAULT_UNROLL_M);
                                  ^
getarch_2nd.c:13:35: error: use of undeclared identifier 'SGEMM_DEFAULT_UNROLL_N'
    printf("SGEMM_UNROLL_N=%d\n", SGEMM_DEFAULT_UNROLL_N);
                                  ^
getarch_2nd.c:14:35: error: use of undeclared identifier 'DGEMM_DEFAULT_UNROLL_M'
    printf("DGEMM_UNROLL_M=%d\n", DGEMM_DEFAULT_UNROLL_M);
                                  ^
getarch_2nd.c:15:35: error: use of undeclared identifier 'DGEMM_DEFAULT_UNROLL_N'
    printf("DGEMM_UNROLL_N=%d\n", DGEMM_DEFAULT_UNROLL_N);
                                  ^
getarch_2nd.c:19:35: error: use of undeclared identifier 'CGEMM_DEFAULT_UNROLL_M'
    printf("CGEMM_UNROLL_M=%d\n", CGEMM_DEFAULT_UNROLL_M);
                                  ^
getarch_2nd.c:20:35: error: use of undeclared identifier 'CGEMM_DEFAULT_UNROLL_N'
    printf("CGEMM_UNROLL_N=%d\n", CGEMM_DEFAULT_UNROLL_N);
                                  ^
getarch_2nd.c:21:35: error: use of undeclared identifier 'ZGEMM_DEFAULT_UNROLL_M'
    printf("ZGEMM_UNROLL_M=%d\n", ZGEMM_DEFAULT_UNROLL_M);
                                  ^
getarch_2nd.c:22:35: error: use of undeclared identifier 'ZGEMM_DEFAULT_UNROLL_N'
    printf("ZGEMM_UNROLL_N=%d\n", ZGEMM_DEFAULT_UNROLL_N);
                                  ^
getarch_2nd.c:29:37: error: use of undeclared identifier 'SGEMM_DEFAULT_UNROLL_M'
    printf("CGEMM3M_UNROLL_M=%d\n", SGEMM_DEFAULT_UNROLL_M);
                                    ^
getarch_2nd.c:35:37: error: use of undeclared identifier 'SGEMM_DEFAULT_UNROLL_N'
    printf("CGEMM3M_UNROLL_N=%d\n", SGEMM_DEFAULT_UNROLL_N);
                                    ^
getarch_2nd.c:41:37: error: use of undeclared identifier 'DGEMM_DEFAULT_UNROLL_M'
    printf("ZGEMM3M_UNROLL_M=%d\n", DGEMM_DEFAULT_UNROLL_M);
                                    ^
getarch_2nd.c:47:37: error: use of undeclared identifier 'DGEMM_DEFAULT_UNROLL_N'
    printf("ZGEMM3M_UNROLL_N=%d\n", DGEMM_DEFAULT_UNROLL_N);
                                    ^
12 errors generated.


gemm.c:402:37: error: use of undeclared identifier 'GEMM_DEFAULT_OFFSET_A'
  sa = (XFLOAT *)((BLASLONG)buffer +GEMM_OFFSET_A);
                                    ^
../common_param.h:971:23: note: expanded from macro 'GEMM_OFFSET_A'
#define GEMM_OFFSET_A   GEMM_DEFAULT_OFFSET_A
                        ^
gemm.c:403:37: error: use of undeclared identifier 'SGEMM_DEFAULT_P'
  sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_A...
                                    ^
../common_param.h:1117:18: note: expanded from macro 'GEMM_P'
#define GEMM_P                  SGEMM_P
                                ^
../common_param.h:981:18: note: expanded from macro 'SGEMM_P'
#define SGEMM_P         SGEMM_DEFAULT_P
                        ^
gemm.c:403:46: error: use of undeclared identifier 'SGEMM_DEFAULT_Q'
  sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_A...
                                             ^
../common_param.h:1118:18: note: expanded from macro 'GEMM_Q'
#define GEMM_Q                  SGEMM_Q
                                ^
../common_param.h:982:18: note: expanded from macro 'SGEMM_Q'
#define SGEMM_Q         SGEMM_DEFAULT_Q
                        ^
gemm.c:403:73: error: use of undeclared identifier 'GEMM_DEFAULT_ALIGN'
  sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_A...
                                                                        ^
../common_param.h:973:20: note: expanded from macro 'GEMM_ALIGN'
#define GEMM_ALIGN      GEMM_DEFAULT_ALIGN
                        ^
gemm.c:403:88: error: use of undeclared identifier 'GEMM_DEFAULT_ALIGN'
  ...*)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_O...
                                                                             ^
../common_param.h:973:20: note: expanded from macro 'GEMM_ALIGN'
#define GEMM_ALIGN      GEMM_DEFAULT_ALIGN
                        ^
gemm.c:403:103: error: use of undeclared identifier 'GEMM_DEFAULT_OFFSET_B'
  ...+ ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
                                                                           ^
../common_param.h:972:23: note: expanded from macro 'GEMM_OFFSET_B'
#define GEMM_OFFSET_B   GEMM_DEFAULT_OFFSET_B
                        ^
6 errors generated.
Comment 1 Jan Beich freebsd_committer 2017-04-10 17:40:35 UTC
To reproduce you may need full environment:

  # pkg install qemu-user-static
  # poudriere jail -cj 110aarch64 -v 11.0-RELEASE -a arm64.aarch64
  # poudriere bulk -Ctj 110aarch64 math/openblas
Comment 2 Jan Beich freebsd_committer 2017-04-10 17:52:53 UTC
Created attachment 181661 [details]
Limit DYNAMIC_ARCH to x86 archs (partial fix)
Comment 3 Andrew Turner freebsd_committer 2017-06-26 09:29:59 UTC
Created attachment 183800 [details]
Full patch

The previous patch was missing an update to cpuid_arm64.c. I've attached an updated patch that includes this fix.

I can now build this on a ThunderX, however Poudriere doesn't seem to like building patched ports so can't use it to test how many of the 200 ports it unblocks.
Comment 4 commit-hook freebsd_committer 2017-06-30 04:28:32 UTC
A commit references this bug:

Author: jbeich
Date: Fri Jun 30 04:28:09 UTC 2017
New revision: 444694
URL: https://svnweb.freebsd.org/changeset/ports/444694

Log:
  math/openblas: unblock on Tier2 architectures

  - Limit DYNAMIC_ARCH to i386 and amd64
  - Fix build on aarch64 [1]

  PR:		218547
  Submitted by:	andrew [1]
  Approved by:	portmgr blanket [1], phd_kimberlite@yahoo.co.jp (maintainer)

Changes:
  head/math/openblas/Makefile
  head/math/openblas/files/patch-cpuid__arm64.c
Comment 5 commit-hook freebsd_committer 2017-06-30 04:30:37 UTC
A commit references this bug:

Author: jbeich
Date: Fri Jun 30 04:30:13 UTC 2017
New revision: 444695
URL: https://svnweb.freebsd.org/changeset/ports/444695

Log:
  MFH: r444694

  math/openblas: unblock on Tier2 architectures

  - Limit DYNAMIC_ARCH to i386 and amd64
  - Fix build on aarch64 [1]

  PR:		218547
  Submitted by:	andrew [1]
  Approved by:	portmgr blanket [1], phd_kimberlite@yahoo.co.jp (maintainer)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q2/
  branches/2017Q2/math/openblas/Makefile
  branches/2017Q2/math/openblas/files/patch-cpuid__arm64.c