microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.27k stars 6.41k forks source link

[armadillo] build failure #38093

Closed shaojunjie0912 closed 7 months ago

shaojunjie0912 commented 7 months ago

Operating system

Linux

Compiler

GCC

Steps to reproduce the behavior

`vcpkg new --application`
`vcpkg add port armadillo`

add some files like CMakeLists.txt, main.cpp...

`cmake --preset=default`

Failure logs

Preset CMake variables:

  CMAKE_TOOLCHAIN_FILE="/opt/vcpkg/scripts/buildsystems/vcpkg.cmake"

-- Running vcpkg install
Detecting compiler hash for triplet x64-linux...
Compiler found: /usr/sbin/c++
The following packages will be built and installed:
    armadillo:x64-linux@12.6.6
  * blas:x64-linux@2023-03-25
  * lapack:x64-linux@2022-02-22#2
  * lapack-reference[blas-select,core,noblas]:x64-linux@3.11.0#2
  * openblas:x64-linux@0.3.26#3
  * pthread:x64-linux@3.0.0#2
  * pthreads:x64-linux@3.0.0#14
  * vcpkg-cmake:x64-linux@2023-05-04
  * vcpkg-cmake-config:x64-linux@2022-02-06#1
Additional packages (*) will be modified to complete this operation.
Restored 6 package(s) from /home/olioolii/.cache/vcpkg/archives in 84.6 ms. Use --debug to see more details.
Installing 1/9 vcpkg-cmake-config:x64-linux@2022-02-06#1...
Elapsed time to handle vcpkg-cmake-config:x64-linux: 466 us
vcpkg-cmake-config:x64-linux package ABI: 49ad0cd6a7940645e5d23a5ff430ec635809b643920acdc4bd1881c3853bd0db
Installing 2/9 vcpkg-cmake:x64-linux@2023-05-04...
Elapsed time to handle vcpkg-cmake:x64-linux: 222 us
vcpkg-cmake:x64-linux package ABI: e25d4f83bebb2f875d1558903ae17bbf5c61f29df2ca70da2d33e6aac16976f2
Installing 3/9 pthreads:x64-linux@3.0.0#14...
Elapsed time to handle pthreads:x64-linux: 192 us
pthreads:x64-linux package ABI: c5f5f65e1fa7d4265daa9d863af8343e9fa96fe07ad4616cb68056be7740f009
Installing 4/9 pthread:x64-linux@3.0.0#2...
Elapsed time to handle pthread:x64-linux: 197 us
pthread:x64-linux package ABI: 7961449c8a107bef496b1b853da579a9e222943d09f28f17de36600b78df3a68
Installing 5/9 openblas:x64-linux@0.3.26#3...
Elapsed time to handle openblas:x64-linux: 943 us
openblas:x64-linux package ABI: 380a254c69f09dbf3c1bc893e03ae18b642f0f282970b565160af7581b34a86d
Installing 6/9 blas:x64-linux@2023-03-25...
Elapsed time to handle blas:x64-linux: 204 us
blas:x64-linux package ABI: 6bf4243424a1442e2403c072594ba295b66d4002a4d5ef06756d213e3acd8b9d
Installing 7/9 lapack-reference[blas-select,core,noblas]:x64-linux@3.11.0#2...
Building lapack-reference[blas-select,core,noblas]:x64-linux@3.11.0#2...
-- Using cached Reference-LAPACK-lapack-v3.11.0.tar.gz.
-- Cleaning sources at /opt/vcpkg/buildtrees/lapack-reference/src/v3.11.0-5e6de67bfb.clean. Use --editable to skip cleaning for t
he packages you specify.
-- Extracting source /var/cache/vcpkg/Reference-LAPACK-lapack-v3.11.0.tar.gz
-- Applying patch cmake-config.patch
-- Applying patch lapacke.patch
-- Using source at /opt/vcpkg/buildtrees/lapack-reference/src/v3.11.0-5e6de67bfb.clean
-- The Fortran compiler identification is unknown
CMake Error at scripts/cmake/vcpkg_find_fortran.cmake:62 (message):
  Unable to find a Fortran compiler using 'CMakeDetermineFortranCompiler'.
  Please install one (e.g.  gfortran) and make it available on the PATH!
Call Stack (most recent call first):
  ports/lapack-reference/portfile.cmake:54 (vcpkg_find_fortran)
  scripts/ports.cmake:175 (include)

error: building lapack-reference:x64-linux failed with: BUILD_FAILED
Elapsed time to handle lapack-reference:x64-linux: 1.7 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+lapack-reference
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[lapack-reference]+Build+error+on+x64-linux&body=Copy+issue+body+from+%2Fho
me%2Folioolii%2FProjects%2Fuim-copy%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

-- Running vcpkg install - failed
CMake Error at /opt/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  /home/olioolii/Projects/uim-copy/build/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:3 (project)

CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably nee
d to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

Additional context

Here are my source files and configuration files.

main.cpp:

#include <armadillo>

int main() {
    arma::mat matrix{{1, 2, 3}, {4, 5, 6}};
    matrix.print();
    return 0;
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.20)

project(test)

find_package(Armadillo CONFIG REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE ${ARMADILLO_LIBRARIES})

CMakePresets.json

{
  "version": 2,
  "configurePresets": [
    {
      "name": "default",
      "generator": "Ninja",
      "binaryDir": "${sourceDir}/build",
      "cacheVariables": {
        "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
      }
    }
  ]
}

vcpkg.json

{
  "dependencies": [
    "armadillo"
  ]
}

I think it's an issue with this package armadillo, as I was able to build the project properly when I switched to other package like fmt.

Here are tools installed.

image

shaojunjie0912 commented 7 months ago

Sorry. I found that I forgot to install gfortran with sudo pacman -S gcc-fortran.