源码编译 openblas for windows on arm
参考 https://github.com/OpenMathLib/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Windows-on-ARM64
这里有已经编译的,直接下载使用
https://github.com/turingevo/OpenBLAS-build/releases
环境
os: win11
cpu: arm64
llvm 编译器
https://github.com/llvm/llvm-project/releases/
我下载的是 LLVM 18.1.8 : https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/LLVM-18.1.8-woa64.exe
运行LLVM-18.1.8-woa64.exe安装到路径 C:\workspace\tools\LLVM
flang
https://github.com/kaadam/flang/releases
我下载这个压缩包 v0.3 版本: https://github.com/kaadam/flang/releases/download/v0.3/flang_woa_2021_11_30.zip
解压到路径 C:\workspace\tools\flang_woa

编译
- 配置环境变量
在openblas源码目录下
打开powershell ,输入:
$env:Path += ";C:\workspace\tools\LLVM\bin;C:\workspace\tools\flang_woa\bin"
- cmake 编译
# 创建构建目录
mkdir build
cd build
# 配置 CMake
cmake .. `
-G "Ninja" `
-DCMAKE_INSTALL_PREFIX=C:\workspace\program\openblas `
-DCMAKE_C_COMPILER=clang `
-DBUILD_WITHOUT_LAPACK=1 `
-DNOFORTRAN=1 `
-DDYNAMIC_ARCH=0 `
-DTARGET=ARMV8 `
-DARCH=arm64 `
-DBINARY=64 `
-DUSE_OPENMP=0 `
-DCMAKE_SYSTEM_PROCESSOR=ARM64 `
-DCMAKE_CROSSCOMPILING=1 `
-DCMAKE_SYSTEM_NAME=Windows
# 构建 OpenBLAS
cmake --build . --config Release
# 安装 OpenBLAS
cmake --build . --target install --config Release

308

被折叠的 条评论
为什么被折叠?



