Skip to content

intel compiler not found in Windows cmake project build #45

Open
@praynaud

Description

@praynaud

Summary

This is for a Windows fortran project that uses cmake to build and test and uses Visual Studio 17 2022 as the generator. I need to install the intel-classic compiler, preferably the latest version, which is 2021.10. The compiler seemingly installs, but then cmake does not know the Fortran compiler identification and the build fails.

Details

My CI script (relevant parts):

jobs:
  CI_Windows:
    runs-on: [windows-latest]
    strategy:
      fail-fast: true

    - name: Setup Fortran
      uses: fortran-lang/setup-fortran@v1
      with:
        compiler: intel-classic
        version: '2021.10'

    - name: Check Compilers and Versions
      run: |
        echo $env:FC
        cmake --version
        python --version

    - name: Build and Test
      run: |
        .\build_and_test.bat

My build_and_test.bat script is as follows:

cmake -S . -B build
cmake --build build --config Debug -j %NUMBER_OF_PROCESSORS%

The output/error in the GitHub CI is:

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 6.2.9200.
-- The Fortran compiler identification is unknown
-- The C compiler identification is MSVC 19.35.32217.1
-- The CXX compiler identification is MSVC 19.35.32217.1
CMake Error at CMakeLists.txt:96 (project):
  No CMAKE_Fortran_COMPILER could be found.

I tried other GitHub Actions and the modflowpy/install-intelfortran-action@v1 action works for my project by takes a very long time. It appears this action is an ancestor of the current fortran-lang/setup-fortran action, so I'm hoping there is something in that older action that could be added to the current action to properly set environment variables such that cmake can correctly detect the Fortran compiler.

For information, here is the output of my successful CI when using the older Action:

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 6.2.9200.
-- The Fortran compiler identification is Intel 2021.7.0.20220726
-- The C compiler identification is MSVC 19.35.32217.1
-- The CXX compiler identification is MSVC 19.35.32217.1

Thanks for helping and for creating these great tools!

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