Skip to content

Compile error on Windows on Arm #4714

Closed
@TsengSR

Description

@TsengSR

For the last 4 days I've been trying to compile the OpenBLAS library on WIndows on Arm (for Windows on Arm) using Build OpenBLAS static library with BLAS and LAPACK routines with Make.

After installing LLVM, Visual Studio and the required build tools I made some kind of progress, but I kept getting this error

make: [Makefile:310: lapack_prebuild] Error -1073741569 (ignored)
expr: syntax error
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE  -UTRANSA -UCONJ -UXCONJ gemv_thread.c -o sgemv_thread_n.obj
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE  -DTRANSA -UCONJ -UXCONJ gemv_thread.c -o sgemv_thread_t.obj
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE  -UCONJ -UXCONJ ger_thread.c -o sger_thread.obj
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE -ULOWER symv_thread.c -o ssymv_thread_U.obj
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE -DLOWER symv_thread.c -o ssymv_thread_L.obj
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE -ULOWER syr_thread.c -o ssyr_thread_U.obj
clang-cl -c -O2 -w -I../.. -UDOUBLE  -UCOMPLEX -UCOMPLEX -UDOUBLE -DLOWER syr_thread.c -o ssyr_thread_L.obj
gemv_thread.c(163,3): error: use of undeclared identifier 'blas_queue_t'
  163 |   blas_queue_t queue[MAX_CPU_NUMBER];
      |   ^
gemv_thread.c(226,5): error: use of undeclared identifier 'queue'
  226 |     queue[num_cpu].mode    = mode;
      |     ^
gemv_thread.c(226gemv_thread.c,30(163): ,3): error: error: use of undeclared identifier 'mode'; did you mean 'modf'?use of
  226undeclared |      qidentifierueue[ n'blas_queue_t'um
_  c163 | pu] .mode   b  = las_qmode;ueu
      e| _t                              ^~~~queue[M
AX_C      PU_N| UMBE                             modfR
];make:C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h(529,44) [: Makefil
note: e:311      'modf': la declared herepac
| k_pr  529 |     _e  ^Cb
huield]ck_ reEturn_ _rArCRTIoMPr  dou-ble __c10decl modf(_7In37_ 4do1uble _5X, _6Ou9t_  do(uble* i_Ygnore);d)

|                                            ^
gemv_thread.c(226,5): error: use of undeclared identifier 'queue'
  226 |     queue[num_cpu].mode    = mode;
      |     ^
gemv_thread.c(227,5): error: use of undeclared identifier 'queue'
  227 |     queue[num_cpu].routine = gemv_kernel;gemv_thread.c(226,30):
      | error:     ^
use of undeclared identifier 'mode'; did you meangemv_thread.c(228,5):  'modf'?
  error: 226 |     queuuse of undeclarede[nu identifierm_c 'queue'pu
  ].228mode    =  |   mo  queude;e[num_cpu]
      .ar| gs                                 ^~~~
= &      | arg                             modf
s;
      | C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math.h(529,44):     ^

using the Documentations

make CC="clang-cl" HOSTCC="clang-cl" AR="llvm-ar" BUILD_WITHOUT_LAPACK=0 NOFORTRAN=0 DYNAMIC_ARCH=0 TARGET=ARMV8 
    ARCH=arm64 BINARY=64 USE_OPENMP=0 PARALLEL=1 RANLIB="llvm-ranlib" MAKE=make F_COMPILER=FLANG
    FC=FLANG FFLAGS_NOOPT="-march=armv8-a -cpp" FFLAGS="-march=armv8-a -cpp" NEED_PIC=0 
    HOSTARCH=arm64 libs netlib

Build command. It's the "drivers/level2" which fail.

As far as I can tell, the "common_threads.h" is not being included inside "common.h"

#if defined(SMP_SERVER) || defined(SMP_ONDEMAND)
#include "common_thread.h"
#endif

After having a further look, I've seen that it's set when USE_THREAD=1 and NUM_THREADS > 1.

But even using

make CC="clang-cl" HOSTCC="clang-cl" AR="llvm-ar" BUILD_WITHOUT_LAPACK=0 NOFORTRAN=0 DYNAMIC_ARCH=0 TARGET=ARMV8 
    ARCH=arm64 BINARY=64 USE_OPENMP=0 PARALLEL=1 RANLIB="llvm-ranlib" MAKE=make F_COMPILER=FLANG 
    FC=FLANG FFLAGS_NOOPT="-march=armv8-a -cpp" FFLAGS="-march=armv8-a -cpp" NEED_PIC=0 HOSTARCH=arm64 
    USE_THREAD=1 NUM_THREADS=8 libs netlib

Still gives me the same error.

Additionally I also get lld-link errors at the begin of the compile process.

clang-cl: warning: unknown argument ignored in clang-cl: '-S' [-Wunknown-argument]
lld-link: error: subsystem must be defined
clang-cl: error: linker command failed with exit code 1 (use -v to see invocation)
clang-cl: warning: unknown argument ignored in clang-cl: '-S' [-Wunknown-argument]
lld-link: error: subsystem must be defined
clang-cl: error: linker command failed with exit code 1 (use -v to see invocation)
clang-cl: warning: unknown argument ignored in clang-cl: '-S' [-Wunknown-argument]
lld-link: error: subsystem must be defined
clang-cl: error: linker command failed with exit code 1 (use -v to see invocation)

As far as I got it so far, it requires to determine the subsystem (windows or console), but from what I've seen so far this isn't required for dlls, only for executables in Windows, so I am confused. The other thing I also found while searching for it is that the cclang uses "-S" flag while clang-cl is supposed to use "-Fa" flag instead to set the subsystem.

But I can't find a how to fix that or where to change it. Complete at loss here. Any ideas?

I'm using

  • LLVM 18.1.6
  • Visual Studio 2022 with (as per ARM LLVM Guide)
    • MSVC v143 - VS 2022C++ ARM build tools (latest)
    • MSVC v143 - VS 2022 C++ ARM64 build tools (latest)
    • C++ ATL for latest v143 build tools (ARM)
    • C++ ATL for latest v143 build tools (ARM64)
    • C++ MFC for latest v143 build tools (ARM)
    • C++ MFC for latest v143 build tools (ARM64)
  • Gnu Make 4.4.1
  • Latest w64devkit (was required for the actual thing I wanted to compile: Koboldcpp)

Any clues on how to fix some or both of these?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions