Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8236979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:18:55+00:00 2026-06-07T19:18:55+00:00

I have a fortran code build that uses cmake to build. This is currently

  • 0

I have a fortran code build that uses cmake to build. This is currently working on Mac OS X, but when I try to build it on Linux, it fails. Cmake generates the makefile successfully but when I try to run the makefile it fails when trying to copy the modules.

The top level cmake file is:

cmake_minimum_required (VERSION 2.8)

# Start Project and note the language used.
project (v3fit_suite Fortran)

# Set a directories to build all binary files.
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/lib)

# Fortran specific settings. The first setting tells the compiler to use the C preprocessor. The second places a common directory to place all of the module files.
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
set (CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build/modules)

# List all the subdirectories these are in library dependancy order.
add_subdirectory (LIBSTELL)
add_subdirectory (VMEC2000)
add_subdirectory (V3FITA)
add_subdirectory (MAKEGRID)
add_subdirectory (V3POST)
add_subdirectory (V3RFUN)

All the modules should be copied to to build/modules. When I run the Makefile with VERBOSE=1 on Linux I get:

/usr/bin/cmake -H/home/user/reconstruction -B/home/user/reconstruction --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/user/reconstruction/CMakeFiles /home/user/reconstruction/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/user/reconstruction'
make -f LIBSTELL/CMakeFiles/stell.dir/build.make LIBSTELL/CMakeFiles/stell.dir/depend
make[2]: Entering directory `/home/user/reconstruction'
cd /home/user/reconstruction && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/user/reconstruction /home/user/reconstruction/LIBSTELL /home/user/reconstruction /home/user/reconstruction/LIBSTELL /home/user/reconstruction/LIBSTELL/CMakeFiles/stell.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/user/reconstruction'
make -f LIBSTELL/CMakeFiles/stell.dir/build.make LIBSTELL/CMakeFiles/stell.dir/requires
make[2]: Entering directory `/home/user/reconstruction'
make -f LIBSTELL/CMakeFiles/stell.dir/build.make LIBSTELL/CMakeFiles/stell.dir/Sources/Modules/stel_kinds.f.o.provides.build
make[3]: Entering directory `/home/user/reconstruction'
/usr/bin/cmake -E cmake_progress_report /home/user/reconstruction/CMakeFiles 
[  0%] Building Fortran object LIBSTELL/CMakeFiles/stell.dir/Sources/Modules/stel_kinds.f.o
cd /home/user/reconstruction/LIBSTELL && /usr/bin/f95  -o CMakeFiles/stell.dir/Sources/Modules/stel_kinds.f.o  -cpp  -J../build/modules   -c /home/user/reconstruction/LIBSTELL/Sources/Modules/stel_kinds.f
/usr/bin/cmake -E cmake_copy_f90_mod build/modules/stel_kinds LIBSTELL/CMakeFiles/stell.dir/stel_kinds.mod.stamp GNU
Error copying Fortran module "build/modules/stel_kinds".  Tried "build/modules/STEL_KINDS.mod" and "build/modules/stel_kinds.mod".
make[3]: *** [LIBSTELL/CMakeFiles/stell.dir/Sources/Modules/stel_kinds.f.o.provides.build] Error 1
make[3]: Leaving directory `/home/user/reconstruction'
make[2]: *** [LIBSTELL/CMakeFiles/stell.dir/Sources/Modules/stel_kinds.f.o.provides] Error 2
make[2]: Leaving directory `/home/user/reconstruction'
make[1]: *** [LIBSTELL/CMakeFiles/stell.dir/all] Error 2
make[1]: Leaving directory `/home/user/reconstruction'
make: *** [all] Error 2

I’m having the same problem when using the gfortran as my compiler instead of f95. Why is this working on Mac OS X but failing on Linux? On Mac OS X I have version 2.8.8 of cmake installed and on Linux version 2.8.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:18:57+00:00Added an answer on June 7, 2026 at 7:18 pm

    Turns out there was a seemingly unrelated error that was causing the problem. I had some statements to add an include path that was being empty.

    find_library (NETCDF_F netcdff PATHS ${NETCDF_LIB_PATH})
    find_file (NETCDF_I netcdf.inc ${NETCDF_INC_PATH})
    if (NETCDF_C AND NETCDF_F AND NETCDF_I)
        message (STATUS "Using netcdf")
        set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D NETCDF -I ${NETCDF_INC_PATH}")
    endif ()
    

    The if statement was always coming up true even when ‘NETCDF_INC_PATH’ was empty. This was causing an extra -I in the compiler command line that was screwing everything up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working with Fortran for years, but the file I/O is still
I have a simple piece of code that extracts a float from a FORTRAN-generated
I have a library that contains a significant amount of fortran code in it,
I'm working with some Fortran code (which I'd never used until this project...) and
I would like to compile fortran code on mac such that it does not
I have the following FORTRAN code which I need to convert to C or
I have a fortran (unmanaged code) dll as the calculation engine, and a C#
I have a legacy fortran code with many statements like 'goto 50'. I was
I have a fortran dll, and I want to know the assemblies that it
I would have dared say that the numeric values computed by Fortran and C++

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.