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

intel compiler not found in Windows cmake project build #45

Open
praynaud opened this issue Oct 19, 2023 · 8 comments
Open

intel compiler not found in Windows cmake project build #45

praynaud opened this issue Oct 19, 2023 · 8 comments

Comments

@praynaud
Copy link

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!

@wpbonelli
Copy link
Contributor

wpbonelli commented Oct 19, 2023

Thanks for raising, ideally this could be tested (planned in #31).

Does anything here help? modflowpy/install-intelfortran-action#10 issues with cmake discovery have been reported before. See also #6

@praynaud
Copy link
Author

@wpbonelli Thank you for the links. It does seem like some people have found workarounds by using a different generator. I will investigate and report back if I find a solution.

In the meantime, I fully support the work planned in #31 !

@wpbonelli
Copy link
Contributor

@praynaud does your issue occur consistently, or only on cache restore? If the latter, perhaps #48 may resolve it

@praynaud
Copy link
Author

praynaud commented Dec 6, 2023

@wpbonelli It's been a minute since I looked into this. Let me give it a try with this new version. I will report back ASAP.

@praynaud
Copy link
Author

@wpbonelli Unfortunately, the cache restore still does not work. I used the action with @main instead of @v1 (see below). I will let you know tomorrow if a fresh install works, because unfortunately something downstream was wrong with my script upon the first run, so the cache was created but the script failed because of something unrelated. The cache should be 'gone' by tomorrow...

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

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

@praynaud
Copy link
Author

@wpbonelli The fresh install also fails, but I'm now looking into other generators. As mentioned above, the modflowpy/install-intelfortran-action@v1 action worked on fresh install (not cache restore), so there must be a difference between the two actions that causes the failure for fresh installations using the new action.

@praynaud
Copy link
Author

@zbeekman I am tagging because you might be able to help...

@rma-rripken
Copy link

I'm on Windows and using fortran-lang/setup-fortran@main and have a similar problem. When there isn't a cache the build will work but once the cache is hit cmake fails to find the fortran compiler. I briefly tried '-G Ninja' in my local environment and that caused my local build to fail in ways I didn't know how to solve. I was hopeful that #48 was going to fix my build issue but something in my setup still isn't quite right. I'd appreciate any suggestions or next steps I could try to improve the build configuration.
https://github.com/rma-rripken/AnnLineGen_RMA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants