Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lapack-reference] build failure for triplet arm64-linux when cross-compiling from x64-linux #44605

Open
stemann opened this issue Mar 25, 2025 · 8 comments
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.

Comments

@stemann
Copy link
Contributor

stemann commented Mar 25, 2025

Package: lapack-reference[blas-select,core,noblas]:[email protected]#5

Host Environment

  • Host: x64-linux
  • Compiler: GNU 12.3.0 (both gcc and aarch64-linux-gnu-gcc)
  • vcpkg-tool version: 2024-12-09-1005b78fa1bf1dde1a20c2734cba4ea61ca94d9a
    vcpkg-scripts version: b322364 2024-12-16

Operating system

Linux

Compiler

GCC

Steps to reproduce the behavior

./vcpkg install --triplet arm64-linux

Using vcpkg.json (manifest) which contains mlpack (package which have lapack-reference as a dependency):

$ vcpkg/vcpkg depend-info mlpack lapack-reference --triplet arm64-linux --format=tree
mlpack
+-- armadillo
|   +-- blas
|   |   +-- openblas
|   |   |   +-- openblas:host
|   |   |   |   +-- pthread:host
|   |   |   |   |   +-- pthreads:host
|   |   |   |   |       +-- vcpkg-cmake-config:host
|   |   |   |   +-- vcpkg-cmake:host
|   |   |   |   +-- vcpkg-cmake-config:host
|   |   |   +-- pthread
|   |   |   |   +-- pthreads
|   |   |   |       +-- vcpkg-cmake-config:host
|   |   |   +-- vcpkg-cmake:host
|   |   |   +-- vcpkg-cmake-config:host
|   |   +-- vcpkg-cmake:host
|   +-- lapack
|   |   +-- lapack-reference
|   |   |   +-- blas
|   |   |   |   +- ...
|   |   |   +-- vcpkg-cmake:host
|   |   |   +-- vcpkg-cmake-config:host
|   |   +-- vcpkg-cmake:host
|   +-- vcpkg-cmake:host
|   +-- vcpkg-cmake-config:host
+-- cereal
|   +-- vcpkg-cmake:host
|   +-- vcpkg-cmake-config:host
+-- ensmallen
|   +-- armadillo
|   |   +- ...
|   +-- blas
|   |   +- ...
|   +-- lapack
|   |   +- ...
|   +-- vcpkg-cmake:host
|   +-- vcpkg-cmake-config:host
+-- stb

Failure logs

2025-03-25T14:25:39.7750910Z Installing 95/118 openblas:[email protected]...
2025-03-25T14:25:39.7751061Z Building openblas:[email protected]...
2025-03-25T14:25:39.7751271Z /root/.cache/vcpkg/registries/git-trees/653ab9ede4c3c8b556b5d1b8b7d98d6abab8ef9d: info: installing overlay port from here
2025-03-25T14:25:39.7982719Z Downloading OpenMathLib-OpenBLAS-v0.3.27.tar.gz
2025-03-25T14:25:43.8721400Z Successfully downloaded OpenMathLib-OpenBLAS-v0.3.27.tar.gz.
2025-03-25T14:25:44.1446770Z -- Extracting source /azp/_work/1/s/vcpkg/downloads/OpenMathLib-OpenBLAS-v0.3.27.tar.gz
2025-03-25T14:25:45.0275819Z -- Applying patch uwp.patch
2025-03-25T14:25:45.0326017Z -- Applying patch fix-redefinition-function.patch
2025-03-25T14:25:45.0369331Z -- Applying patch install-tools.patch
2025-03-25T14:25:45.0415194Z -- Using source at /azp/_work/1/s/vcpkg/buildtrees/openblas/src/v0.3.27-b066c33329.clean
2025-03-25T14:25:45.0512306Z -- Configuring x64-linux
2025-03-25T14:25:47.6683544Z -- Building x64-linux-dbg
2025-03-25T14:27:14.8392380Z -- Building x64-linux-rel
2025-03-25T14:29:34.9800722Z -- Fixing pkgconfig file: /azp/_work/1/s/vcpkg/packages/openblas_x64-linux/lib/pkgconfig/openblas.pc
2025-03-25T14:29:34.9857151Z -- Fixing pkgconfig file: /azp/_work/1/s/vcpkg/packages/openblas_x64-linux/debug/lib/pkgconfig/openblas.pc
2025-03-25T14:29:34.9924719Z -- Installing: /azp/_work/1/s/vcpkg/packages/openblas_x64-linux/share/openblas/copyright
2025-03-25T14:29:35.0050109Z -- Adjusted RPATH of '/azp/_work/1/s/vcpkg/packages/openblas_x64-linux/tools/openblas/getarch' (From '' -> To '$ORIGIN:$ORIGIN/../../lib')
2025-03-25T14:29:35.0098711Z -- Adjusted RPATH of '/azp/_work/1/s/vcpkg/packages/openblas_x64-linux/tools/openblas/getarch_2nd' (From '' -> To '$ORIGIN:$ORIGIN/../../lib')
2025-03-25T14:29:35.0157995Z -- Performing post-build validation
2025-03-25T14:29:35.0221332Z Elapsed time to handle openblas:x64-linux: 3.9 min
2025-03-25T14:29:35.0222505Z openblas:x64-linux package ABI: 5fd57cdbc85279845fa4392a092dd5c12ba35c52385007256b8fabed304fc8e6
2025-03-25T14:29:35.0223004Z Installing 96/118 openblas:[email protected]...
2025-03-25T14:29:35.0223477Z Building openblas:[email protected]...
2025-03-25T14:29:35.0224002Z /azp/_work/1/s/vcpkg/triplets/community/arm64-linux.cmake: info: loaded community triplet from here. Community triplets are not built in the curated registry and are thus less likely to succeed.
2025-03-25T14:29:35.0224309Z /root/.cache/vcpkg/registries/git-trees/653ab9ede4c3c8b556b5d1b8b7d98d6abab8ef9d: info: installing overlay port from here
2025-03-25T14:29:35.1683883Z -- Using cached OpenMathLib-OpenBLAS-v0.3.27.tar.gz.
2025-03-25T14:29:35.2316625Z -- Cleaning sources at /azp/_work/1/s/vcpkg/buildtrees/openblas/src/v0.3.27-b066c33329.clean. Use --editable to skip cleaning for the packages you specify.
2025-03-25T14:29:35.5906915Z -- Extracting source /azp/_work/1/s/vcpkg/downloads/OpenMathLib-OpenBLAS-v0.3.27.tar.gz
2025-03-25T14:29:36.5277436Z -- Applying patch uwp.patch
2025-03-25T14:29:36.5332913Z -- Applying patch fix-redefinition-function.patch
2025-03-25T14:29:36.5379402Z -- Applying patch install-tools.patch
2025-03-25T14:29:36.5428261Z -- Using source at /azp/_work/1/s/vcpkg/buildtrees/openblas/src/v0.3.27-b066c33329.clean
2025-03-25T14:29:36.5521886Z -- Configuring arm64-linux
2025-03-25T14:29:38.5231846Z -- Building arm64-linux-dbg
2025-03-25T14:31:13.5942283Z -- Building arm64-linux-rel
2025-03-25T14:33:51.7276091Z -- Fixing pkgconfig file: /azp/_work/1/s/vcpkg/packages/openblas_arm64-linux/lib/pkgconfig/openblas.pc
2025-03-25T14:33:51.7352471Z -- Fixing pkgconfig file: /azp/_work/1/s/vcpkg/packages/openblas_arm64-linux/debug/lib/pkgconfig/openblas.pc
2025-03-25T14:33:51.7470606Z -- Installing: /azp/_work/1/s/vcpkg/packages/openblas_arm64-linux/share/openblas/copyright
2025-03-25T14:33:51.7488579Z -- Performing post-build validation
2025-03-25T14:33:51.7585097Z Elapsed time to handle openblas:arm64-linux: 4.3 min
2025-03-25T14:33:51.7592411Z openblas:arm64-linux package ABI: 4b2ef634d166d0b2321b8d4738ad119cf3b2ba426fa6e5c753b4b3314517ac4c
2025-03-25T14:33:51.7599167Z Installing 97/118 blas:arm64-linux@2023-04-14...
2025-03-25T14:33:51.7605671Z Building blas:arm64-linux@2023-04-14...
2025-03-25T14:33:51.7611372Z /azp/_work/1/s/vcpkg/triplets/community/arm64-linux.cmake: info: loaded community triplet from here. Community triplets are not built in the curated registry and are thus less likely to succeed.
2025-03-25T14:33:51.7617163Z /root/.cache/vcpkg/registries/git-trees/02dbca6ca7e22e44f5445b10f74e63644779eefd: info: installing overlay port from here
2025-03-25T14:33:51.7872002Z -- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
2025-03-25T14:33:51.7970936Z Elapsed time to handle blas:arm64-linux: 35.7 ms
2025-03-25T14:33:51.7971176Z blas:arm64-linux package ABI: cd2022c65c73b1df8136c790231402dfb3b153acf34ad2e15a2ec020aff68b82
2025-03-25T14:33:51.7971389Z Installing 98/118 lapack-reference[blas-select,core,noblas]:[email protected]#5...
2025-03-25T14:33:51.7971669Z Building lapack-reference[blas-select,core,noblas]:[email protected]#5...
2025-03-25T14:33:51.7971935Z /azp/_work/1/s/vcpkg/triplets/community/arm64-linux.cmake: info: loaded community triplet from here. Community triplets are not built in the curated registry and are thus less likely to succeed.
2025-03-25T14:33:51.7972244Z /root/.cache/vcpkg/registries/git-trees/27fda0472d5bfb11fef0264ba62681f6d6b4b1d2: info: installing overlay port from here
2025-03-25T14:33:51.8276040Z Downloading Reference-LAPACK-lapack-v3.11.0.tar.gz
2025-03-25T14:33:52.5334984Z Successfully downloaded Reference-LAPACK-lapack-v3.11.0.tar.gz.
2025-03-25T14:33:52.7830639Z -- Extracting source /azp/_work/1/s/vcpkg/downloads/Reference-LAPACK-lapack-v3.11.0.tar.gz
2025-03-25T14:33:53.2197190Z -- Applying patch cmake-config.patch
2025-03-25T14:33:53.2253779Z -- Applying patch lapacke.patch
2025-03-25T14:33:53.2311239Z -- Applying patch fix_prefix.patch
2025-03-25T14:33:53.2418416Z -- Using source at /azp/_work/1/s/vcpkg/buildtrees/lapack-reference/src/v3.11.0-6ae738f586.clean
2025-03-25T14:33:53.3459574Z -- The Fortran compiler identification is GNU 12.3.0
2025-03-25T14:33:53.3787427Z -- Configuring arm64-linux
2025-03-25T14:33:57.7057368Z CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
2025-03-25T14:33:57.7058088Z     Command failed: /azp/_work/1/s/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja -v
2025-03-25T14:33:57.7108129Z     Working Directory: /azp/_work/1/s/vcpkg/buildtrees/lapack-reference/arm64-linux-rel/vcpkg-parallel-configure
2025-03-25T14:33:57.7108380Z     Error code: 1
2025-03-25T14:33:57.7108540Z     See logs for more information:
2025-03-25T14:33:57.7108883Z       /azp/_work/1/s/vcpkg/buildtrees/lapack-reference/config-arm64-linux-dbg-CMakeCache.txt.log
2025-03-25T14:33:57.7109148Z       /azp/_work/1/s/vcpkg/buildtrees/lapack-reference/config-arm64-linux-rel-CMakeCache.txt.log
2025-03-25T14:33:57.7109887Z       /azp/_work/1/s/vcpkg/buildtrees/lapack-reference/config-arm64-linux-out.log
2025-03-25T14:33:57.7110013Z 
2025-03-25T14:33:57.7110162Z Call Stack (most recent call first):
2025-03-25T14:33:57.7110410Z   /azp/_work/1/s/vcpkg_installed/x64-linux/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:252 (vcpkg_execute_required_process)
2025-03-25T14:33:57.7110654Z   /root/.cache/vcpkg/registries/git-trees/27fda0472d5bfb11fef0264ba62681f6d6b4b1d2/portfile.cmake:59 (vcpkg_cmake_configure)
2025-03-25T14:33:57.7110884Z   scripts/ports.cmake:196 (include)
2025-03-25T14:33:57.7110973Z 
2025-03-25T14:33:57.7111054Z 
2025-03-25T14:33:57.7111224Z error: building lapack-reference:arm64-linux failed with: BUILD_FAILED
2025-03-25T14:33:57.7111479Z See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
2025-03-25T14:33:57.7111699Z Elapsed time to handle lapack-reference:arm64-linux: 5.9 s
2025-03-25T14:33:57.7333450Z Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
2025-03-25T14:33:57.7334200Z Then check for known issues at:
2025-03-25T14:33:57.7334626Z   https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+lapack-reference
2025-03-25T14:33:57.7335291Z You can submit a new issue at:
2025-03-25T14:33:57.7362241Z   https://github.com/microsoft/vcpkg/issues/new?title=[lapack-reference]+Build+error+on+arm64-linux&body=Copy+issue+body+from+%2Fazp%2F_work%2F1%2Fs%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md
2025-03-25T14:33:57.7363013Z 
2025-03-25T14:33:57.9665896Z 
2025-03-25T14:33:57.9739296Z ##[error]Bash exited with code '1'.
2025-03-25T14:33:57.9849857Z ##[section]Finishing: Install packages

config-arm64-linux-out.log

[1/2] "/azp/_work/1/s/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake" -E chdir "../../arm64-linux-dbg" "/azp/_work/1/s/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake" "/azp/_work/1/s/vcpkg/buildtrees/lapack-reference/src/v3.11.0-6ae738f586.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=/azp/_work/1/s/vcpkg/packages/lapack-reference_arm64-linux/debug" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DUSE_OPTIMIZED_BLAS=ON" "-DCMAKE_REQUIRE_FIND_PACKAGE_BLAS=ON" "-DCBLAS=OFF" "-DTEST_FORTRAN_COMPILER=OFF" "-DCMAKE_MAKE_PROGRAM=/azp/_work/1/s/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja" "-DCMAKE_SYSTEM_NAME=Linux" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/azp/_work/1/s/vcpkg/scripts/toolchains/linux.cmake" "-DVCPKG_TARGET_TRIPLET=arm64-linux" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/azp/_work/1/s/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=arm64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/azp/_work/1/s/vcpkg" "-D_VCPKG_INSTALLED_DIR=/azp/_work/1/s/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
...
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - not found
CMake Error at /azp/_work/1/s/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
  /azp/_work/1/s/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /azp/_work/1/s/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/share/cmake-3.30/Modules/FindBLAS.cmake:1417 (find_package_handle_standard_args)
  /azp/_work/1/s/vcpkg_installed/arm64-linux/share/blas/vcpkg-cmake-wrapper.cmake:7 (_find_package)
  /azp/_work/1/s/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
  CMakeLists.txt:321 (find_package)

Additional context

Similar issue (I believe): Reference-LAPACK/lapack#1109

@stemann stemann added the category:port-bug The issue is with a library, which is something the port should already support label Mar 25, 2025
@stemann stemann changed the title lapack-reference build failure for triplet arm64-linux when cross-compiling from x64-linux [lapack-reference] build failure for triplet arm64-linux when cross-compiling from x64-linux Mar 25, 2025
@JonLiu1993 JonLiu1993 added category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. and removed category:port-bug The issue is with a library, which is something the port should already support labels Mar 26, 2025
@JonLiu1993 JonLiu1993 removed their assignment Mar 26, 2025
@stemann
Copy link
Contributor Author

stemann commented Mar 26, 2025

For reference, lapack-reference[blas-select,core,noblas]:[email protected]#5 configures (and builds) just fine on host arm64-linux:

[1/2] "/usr/bin/cmake" -E chdir "../../arm64-linux-dbg" "/usr/bin/cmake" "/workspaces/vcpkg_registry/vcpkg/buildtrees/lapack-reference/src/v3.11.0-6ae738f586.clean" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_INSTALL_PREFIX=/workspaces/vcpkg_registry/vcpkg/packages/lapack-reference_arm64-linux/debug" "-DFETCHCONTENT_FULLY_DISCONNECTED=ON" "-DUSE_OPTIMIZED_BLAS=ON" "-DCMAKE_REQUIRE_FIND_PACKAGE_BLAS=ON" "-DCBLAS=OFF" "-DTEST_FORTRAN_COMPILER=OFF" "-DCMAKE_MAKE_PROGRAM=/usr/bin/ninja" "-DCMAKE_SYSTEM_NAME=Linux" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/workspaces/vcpkg_registry/vcpkg/scripts/toolchains/linux.cmake" "-DVCPKG_TARGET_TRIPLET=arm64-linux" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=external" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=/workspaces/vcpkg_registry/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=dynamic" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=arm64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=/workspaces/vcpkg_registry/vcpkg" "-D_VCPKG_INSTALLED_DIR=/workspaces/vcpkg_registry/vcpkg_installed" "-DVCPKG_MANIFEST_INSTALL=OFF"
-- The Fortran compiler identification is GNU 12.3.0
-- The C compiler identification is GNU 12.3.0
...
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Found BLAS: /workspaces/vcpkg_registry/vcpkg_installed/arm64-linux/lib/libopenblas.a  
-- Using supplied NETLIB LAPACK implementation
-- Build html documentation: OFF
-- Build man documentation: OFF
-- Configuring done
-- Generating done

config-arm64-linux-out.log

@martin-frbg
Copy link

Seems to me that the vcpkg script is trying to build Reference-LAPACK using an optimized BLAS like ATLAS or OpenBLAS (-DUSE_OPTIMIZED_BLAS=ON) but fails to find one already installed (likely due to this being a cross-compilation) ?

@stemann
Copy link
Contributor Author

stemann commented Mar 26, 2025

Yes, that is the issue: find_package(BLAS) fails - in spite of OpenBLAS having just been built (it's in the log above: openblas:[email protected]).

@stemann
Copy link
Contributor Author

stemann commented Mar 26, 2025

The strange thing is that I do have libopenblas.a right there in /workspaces/vcpkg_registry/vcpkg_installed/arm64-linux/lib/libopenblas.a.

I'm trying to

  1. Define BLAS_LIBRARIES, e.g. -DBLAS_LIBRARIES=/workspaces/vcpkg_registry/vcpkg_installed/arm64-linux/lib/libopenblas.a - but lapack-cmake does not find the dgemm-symbol - perhaps the Julia Yggdrasil hand-rolled magic approach is necessary, i.e., -DCMAKE_Fortran_FLAGS="-DDGEMM=DGEMM_64"...
  2. Define CMAKE_FIND_ROOT_PATH, e.g. -DCMAKE_FIND_ROOT_PATH=/workspaces/vcpkg_registry/vcpkg_installed/arm64-linux.

@stemann
Copy link
Contributor Author

stemann commented Mar 26, 2025

It seems the issue is that FindBLAS is not content with the sgemm in the found libopenblas.a:

-- Looking for Fortran sgemm - not found
$ grep -C 1 -i blas vcpkg/buildtrees/lapack-reference/config-arm64-linux-dbg-CMakeCache.txt.log 

//Path to a library.
BLAS_openblas_LIBRARY:FILEPATH=/workspaces/vcpkg_registry/vcpkg_installed/arm64-linux/debug/lib/libopenblas.a

--
//No help, variable specified on the command line.
CBLAS:UNINITIALIZED=OFF

--
//No help, variable specified on the command line.
CMAKE_REQUIRE_FIND_PACKAGE_BLAS:UNINITIALIZED=ON

--

//Whether or not to use an optimized BLAS library instead of included
// netlib BLAS
USE_OPTIMIZED_BLAS:BOOL=ON

--

//ADVANCED property for variable: BLAS_openblas_LIBRARY
BLAS_openblas_LIBRARY-ADVANCED:INTERNAL=1
//Have Fortran function sgemm
BLAS_openblas_WORKS:INTERNAL=
//Have Fortran function sgemm
BLAS_openblas_deps_WORKS:INTERNAL=
//ADVANCED property for variable: CMAKE_ADDR2LINE
$ grep -C 1 -i blas vcpkg/buildtrees/lapack-reference/config-arm64-linux-rel-CMakeCache.txt.log

//Path to a library.
BLAS_openblas_LIBRARY:FILEPATH=/workspaces/vcpkg_registry/vcpkg_installed/arm64-linux/lib/libopenblas.a

--
//No help, variable specified on the command line.
CBLAS:UNINITIALIZED=OFF

--
//No help, variable specified on the command line.
CMAKE_REQUIRE_FIND_PACKAGE_BLAS:UNINITIALIZED=ON

--

//Whether or not to use an optimized BLAS library instead of included
// netlib BLAS
USE_OPTIMIZED_BLAS:BOOL=ON

--

//ADVANCED property for variable: BLAS_openblas_LIBRARY
BLAS_openblas_LIBRARY-ADVANCED:INTERNAL=1
//Have Fortran function sgemm
BLAS_openblas_WORKS:INTERNAL=
//Have Fortran function sgemm
BLAS_openblas_deps_WORKS:INTERNAL=
//ADVANCED property for variable: CMAKE_ADDR2LINE

@stemann
Copy link
Contributor Author

stemann commented Mar 26, 2025

Solution: It seems to work by supplying -DBLA_PREFER_PKGCONFIG=1 (when targeting arm64-linux from x64-linux, using GCC 12 - from Ubuntu 22.04), cf. https://cmake.org/cmake/help/v3.30/module/FindBLAS.html#input-variables

@stemann
Copy link
Contributor Author

stemann commented Mar 26, 2025

… but vcpkg ended up producing an x86_64 liblapack.a …

@stemann
Copy link
Contributor Author

stemann commented Mar 27, 2025

To some extent, it seems to work by defining a custom arm64-linux triplet defining VCPKG_CHAINLOAD_TOOLCHAIN_FILE

$ cat triplets/arm64-linux.cmake 
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)

set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /opt/toolchains/arm64-linux-gnu.cmake)

where /opt/toolchains/arm64-linux-gnu.cmake contains:

set(CMAKE_HOST_SYSTEM_NAME Linux)
set(CMAKE_HOST_SYSTEM_PROCESSOR x86_64)
  
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(CMAKE_C_COMPILER   /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
set(CMAKE_Fortran_COMPILER /usr/bin/aarch64-linux-gnu-gfortran)

set(CMAKE_LINKER  /usr/bin/aarch64-linux-gnu-ld)
set(CMAKE_OBJCOPY /usr/bin/aarch64-linux-gnu-objcopy)

set(CMAKE_AR     /usr/bin/aarch64-linux-gnu-ar)
set(CMAKE_NM     /usr/bin/aarch64-linux-gnu-nm)
set(CMAKE_RANLIB /usr/bin/aarch64-linux-gnu-ranlib)

Notably to define CMAKE_Fortran_COMPILER, cf. #44653 .

Although icu (a further dependency in my case) is hard to build - seems to require export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.
Projects
None yet
Development

No branches or pull requests

3 participants