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

Mac OS install issues: cmake error #189

Closed
tbainesUA opened this issue Jul 9, 2021 · 4 comments
Closed

Mac OS install issues: cmake error #189

tbainesUA opened this issue Jul 9, 2021 · 4 comments

Comments

@tbainesUA
Copy link

tbainesUA commented Jul 9, 2021

Hello, I am trying to install Multinest onto Mac OS, following the instructions on the documentation page. I made sure to install the library dependencies using mac ports.

I have even set the following, suggested by another that has previously help someone else setup multinest on mac os in the past by adding:

export FC=/opt/local/bin/mpif90-openmpi-gcc9
export CC=/opt/local/bin/mpicc-openmpi-gcc9
export CXX=/opt/local/bin/mpicxx-openmpi-gcc9
export FFLAGS="-O3 -DMPI -m64 -ffree-line-length-none -fbounds-check -Wsurprising -g"
export CFLAGS="-O3 -DMPI -m64"

I was succesfully able to down load the software via cloning the Multinest repo but when I attemped to install it and error occurred at the cmake .. step which resulted in the following:

CMake Error in src/CMakeLists.txt:
  A logical block opening on the line

    ~/software/MultiNest/src/CMakeLists.txt:35 (if)

  is not closed.

It looks like a syntax issue, however when inspecting the line at where the error occur, I was unable to identify the error.

lines 30 - 43 of src/CMakeList.txt:

# Find required packages
FIND_PACKAGE(LAPACK REQUIRED)

# If we are compiling with gfortran, add -ffree-line-length-none
foreach(lang C CXX Fortran)
    if(CMAKE_${lang}_COMPILER_ID STREQUAL GNU)
        MESSAGE(STATUS "Detected gfortran, adding -ffree-line-length-none compiler flag.")
        set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none")
        if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
            MESSAGE(STATUS "Detected gfortran >= 10, adding -std=legacy compiler flag.")
            set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy")
        break()
    endif()
endforeach()

Any help would be great, thanks for your time.

@JohannesBuchner
Copy link
Owner

This is caused by a recent pull request: JohannesBuchner/MultiNest#2

@tbainesUA
Copy link
Author

Follow up, did a git pull of the of the Multinest repo for the updated CMakeLists.txt then retried cmake .. and it no longer prompted the error above. However, i ran into an error as the following:

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):

  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Detected gfortran, adding -ffree-line-length-none compiler flag.
-- Found MPI_C: /opt/local/bin/mpicc-openmpi-gcc9 (found version "3.1") 
-- Found MPI_CXX: /opt/local/bin/mpicxx-openmpi-gcc9 (found version "3.1") 
-- Found MPI_Fortran: /opt/local/bin/mpif90-openmpi-gcc9 (found version "3.1") 
-- Found MPI: TRUE (found version "3.1")  
CMake Deprecation Warning at src/example_ackley/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Deprecation Warning at src/example_eggbox_C/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Error at src/example_eggbox_C/CMakeLists.txt:7 (FIND_LIBRARY):
  Could not find m using the following names:


-- Configuring incomplete, errors occurred!
See also "/Users/tbaines1/software/MultiNest/build/CMakeFiles/CMakeOutput.log".
See also "/Users/tbaines1/software/MultiNest/build/CMakeFiles/CMakeError.log".

The CMakeError.log file outputted the following:

Determining if the Fortran sgemm exists failed with the following output:
Change Dir: /Users/tbaines1/software/MultiNest/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_81dad/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_81dad.dir/build.make CMakeFiles/cmTC_81dad.dir/build
Building Fortran object CMakeFiles/cmTC_81dad.dir/testFortranCompiler.f.o
/opt/local/bin/mpif90-openmpi-gcc9   -O3 -DMPI -m64 -ffree-line-length-none -fbounds-check -Wsurprising -g  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -c /Users/tbaines1/software/MultiNest/build/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_81dad.dir/testFortranCompiler.f.o
Linking Fortran executable cmTC_81dad
/opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_81dad.dir/link.txt --verbose=1
/opt/local/bin/mpif90-openmpi-gcc9 -O3 -DMPI -m64 -ffree-line-length-none -fbounds-check -Wsurprising -g  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 CMakeFiles/cmTC_81dad.dir/testFortranCompiler.f.o -o cmTC_81dad 
Undefined symbols for architecture x86_64:
  "_sgemm_", referenced from:
      _main in testFortranCompiler.f.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [cmTC_81dad] Error 1
make: *** [cmTC_81dad/fast] Error 2



Determining if the Fortran sgemm exists failed with the following output:
Change Dir: /Users/tbaines1/software/MultiNest/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_cab6c/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_cab6c.dir/build.make CMakeFiles/cmTC_cab6c.dir/build
Building Fortran object CMakeFiles/cmTC_cab6c.dir/testFortranCompiler.f.o
/opt/local/bin/mpif90-openmpi-gcc9   -O3 -DMPI -m64 -ffree-line-length-none -fbounds-check -Wsurprising -g  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -c /Users/tbaines1/software/MultiNest/build/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_cab6c.dir/testFortranCompiler.f.o
Linking Fortran executable cmTC_cab6c
/opt/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_cab6c.dir/link.txt --verbose=1
/opt/local/bin/mpif90-openmpi-gcc9 -O3 -DMPI -m64 -ffree-line-length-none -fbounds-check -Wsurprising -g  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 CMakeFiles/cmTC_cab6c.dir/testFortranCompiler.f.o -o cmTC_cab6c  -Wl,-rpath,/Users/tbaines1/opt/anaconda3/lib /Users/tbaines1/opt/anaconda3/lib/libmkl_intel_lp64.dylib /Users/tbaines1/opt/anaconda3/lib/libmkl_intel_thread.dylib /Users/tbaines1/opt/anaconda3/lib/libmkl_core.dylib /Users/tbaines1/opt/anaconda3/lib/libiomp5.dylib -lm -ldl 
ld: file not found: @rpath/libiomp5.dylib for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [cmTC_cab6c] Error 1
make: *** [cmTC_cab6c/fast] Error 2

Thanks

@JohannesBuchner
Copy link
Owner

Be sure to clean your build/ folder completely whenever you change something.

@tbainesUA
Copy link
Author

After cleaning the build folder, I was able to successfully execute cmake .. and make with no issues.

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

2 participants