Giter Club home page Giter Club logo

Comments (11)

jschueller avatar jschueller commented on June 20, 2024
  • cmake will only find compilers in the PATH with default names, I think it will be fine if there was a gfortran symlink
  • there is already a cmake option PRIMA_ENABLE_C=ON/OFF to disable the C binding

from prima.

zaikunzhang avatar zaikunzhang commented on June 20, 2024
  • cmake will only find compilers in the PATH with default names, I think it will be fine if there was a gfortran symlink

I have sent this to @shahmoradi and invited him to join the conversation.

How does CMake decide the default name of a compiler (or tell whether something is a Fortran compiler in the first place?) Does it look up a list? Thanks.

Since @shahmoradi has five compilers installed in the system bin, there is a good chance that at least one of them is in the PATH with default names.

from prima.

jschueller avatar jschueller commented on June 20, 2024

I guess it looks through standard names, for example in the CI jobs I never had to specify the compiler location as it was always found.

from prima.

zaikunzhang avatar zaikunzhang commented on June 20, 2024

*there is already a cmake option PRIMA_ENABLE_C=ON/OFF to disable the C binding

I removed /usr/bin/gcc and some other C compilers on my computer. Doing

$git clone --depth 1 https://github.com/libprima/prima.git
cd prima
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=OFF -DPRIMA_ENABLE_C=OFF  
cmake --build build --target install

I got the following:

Cloning into 'prima'...
remote: Enumerating objects: 907, done.
remote: Counting objects: 100% (907/907), done.
remote: Compressing objects: 100% (733/733), done.
remote: Total 907 (delta 416), reused 464 (delta 154), pack-reused 0
Receiving objects: 100% (907/907), 6.20 MiB | 1.74 MiB/s, done.
Resolving deltas: 100% (416/416), done.
-- The C compiler identification is unknown
-- The Fortran compiler identification is GNU 13.1.0
CMake Error at CMakeLists.txt:5 (project):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/f95 - skipped
-- Configuring incomplete, errors occurred!
See also "/home/zaikunzhang/tmp/prima/build/CMakeFiles/CMakeOutput.log".
See also "/home/zaikunzhang/tmp/prima/build/CMakeFiles/CMakeError.log".
gmake: Makefile: No such file or directory
gmake: *** No rule to make target 'Makefile'.  Stop.

If did not misunderstand, even with -DPRIMA_ENABLE_C=OFF, cmake still looks for a C compiler, and fails if no such compiler exists. Is this reasonable?

from prima.

jschueller avatar jschueller commented on June 20, 2024

I guess we could defer the detection of the C compiler, but ihmo its hard to find a machine with a Fortran compiler but without C compiler :]

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0916733..c8c0d92c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.13)
 
 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
 
-project (prima C Fortran)
+project (prima Fortran)
 
 option (BUILD_SHARED_LIBS "shared/static" ON)
 if (WIN32)
@@ -45,6 +45,7 @@ add_subdirectory(fortran)
 
 option (PRIMA_ENABLE_C "C binding" ON)
 if (PRIMA_ENABLE_C)
+  enable_language(C)
   add_subdirectory(c)
   set(primac_target "primac")
 endif ()

from prima.

zaikunzhang avatar zaikunzhang commented on June 20, 2024

ihmo its hard to find a machine with a Fortran compiler but without C compiler :]

Agree. But logically, it is still better to check the C compiler only when needed. After your new PR, it works now.

BTW, I saw -- Performing Test HAVE_WARN_EXECSTACK - Failed. Should I worry?

from prima.

jschueller avatar jschueller commented on June 20, 2024

no, its probably just a bit too old

from prima.

zaikunzhang avatar zaikunzhang commented on June 20, 2024

no, its probably just a bit too old

Who is "it"?

from prima.

jschueller avatar jschueller commented on June 20, 2024

your compiler

from prima.

zaikunzhang avatar zaikunzhang commented on June 20, 2024

I modified README for this issue:

prima/README.md

Lines 217 to 219 in 7565f6f

In case CMake fails to find your Fortran compiler,
you can indicate it by specifying `-DCMAKE_Fortran_COMPILER=/path/to/your/Fortran/compiler`.
Similarly, set `-DCMAKE_C_COMPILER=/path/to/your/C/compiler` for your C compiler if needed.

Is it correct?

from prima.

jschueller avatar jschueller commented on June 20, 2024

yes

from prima.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.