Skip to content

cmake No CMAKE_Fortran_COMPILER could be found. #6

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

Closed
afonari opened this issue Nov 17, 2022 · 7 comments
Closed

cmake No CMAKE_Fortran_COMPILER could be found. #6

afonari opened this issue Nov 17, 2022 · 7 comments

Comments

@afonari
Copy link

afonari commented Nov 17, 2022

(Sorry for spamming with issues)

CMakeLists.txt header:

cmake_minimum_required(VERSION 2.6)
project(packmol Fortran)

Step example:

 - name: Compile using cmake
      if: matrix.compiler == 'cmake'
      run: |
        cmake ./ && cmake --build ./
      shell: bash

Error:

-- The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_Fortran_COMPILER could be found.

See repo: https://github.com/afonari/packmol/

@awvwgk
Copy link
Member

awvwgk commented Nov 17, 2022

I don't see how this issue relates to the action in this repo. Please checkout the packmol documentation on the instructions for building with CMake.

@awvwgk awvwgk closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
@afonari
Copy link
Author

afonari commented Nov 17, 2022

project(XXX Fortran) is a standard cmake directive

https://cmake.org/cmake/help/latest/command/project.html

Also people looking for solutions here for example: https://groups.google.com/g/comp.lang.fortran/c/Jna-QAHCOpk
and here: fortran-lang/stdlib#328

@awvwgk
Copy link
Member

awvwgk commented Nov 17, 2022

I didn't found in the issue that you have a problem using this action on Windows. That you are using this action on a Windows runner for creating a CMake build would be the information I needed to help.

CMake compiler detection is another thing than being able to declare a Fortran project in CMake. The detection is platform specific and apparently different on Windows than on Unix platforms. Using -DCMAKE_Fortran_COMPILER=$FC seems like an easy to implement workaround in your pipeline to normalize the behavior for the different platforms.

@afonari
Copy link
Author

afonari commented Nov 17, 2022

Using -DCMAKE_Fortran_COMPILER=$FC seems like an easy to implement workaround in your pipeline to normalize the behavior for the different platforms.

Yeah, this didn't work (also noted in the links I've posted). The solution is to install some Visual Studio intel component, I guess I will just drop windows from testing.

@wpbonelli
Copy link
Contributor

@afonari might be worth trying a different CMake generator on Windows, e.g. MinGW Makefiles

see here

@afonari
Copy link
Author

afonari commented Nov 22, 2022

@w-bonelli thanks for the pointer. Can you provide an example of compiling on windows using Cmake in the test file?
Somewhere around here maybe: https://github.com/modflowpy/install-intelfortran-action/blob/main/.github/workflows/ci.yml#L67

@wpbonelli
Copy link
Contributor

wpbonelli commented Nov 22, 2022

@afonari see this comment, and passing Windows build here

Note, the build is not from a project I have any real familiarity with, and I'm pretty new to CMake — take with a grain of salt

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