trilinos / Trilinos

Primary repository for the Trilinos Project
https://trilinos.org/
Other
1.17k stars 559 forks source link

Help with Installing to MacOSX (m1 Chip) #12942

Open bdas123 opened 2 months ago

bdas123 commented 2 months ago

Hello, here is my following compiling script:


cmake .. \
  -DCMAKE_INSTALL_PREFIX=~/projects/trilinos_install \
  -DCMAKE_BUILD_TYPE=Release \
  -D TPL_ENABLE_MPI=ON \
  -D MPI_BASE_DIR=$(brew --prefix open-mpi) \
  -D TPL_ENABLE_Boost=ON \
  -D Boost_INCLUDE_DIRS=$(brew --prefix boost)/include \
  -D TPL_ENABLE_HDF5=ON \
  -D HDF5_INCLUDE_DIRS=$(brew --prefix hdf5)/include \
  -D TPL_ENABLE_Netcdf=ON \
  -D Netcdf_INCLUDE_DIRS=$(brew --prefix netcdf)/include \
  -D CMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) \
  -D CMAKE_OSX_DEPLOYMENT_TARGET=10.15\

However, I get the following error:

-- Check for working Fortran compiler: /opt/homebrew/opt/open-mpi/bin/mpif90
-- Check for working Fortran compiler: /opt/homebrew/opt/open-mpi/bin/mpif90 - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.29.2/share/cmake/Modules/CMakeTestFortranCompiler.cmake:59 (message):
  The Fortran compiler

    "/opt/homebrew/opt/open-mpi/bin/mpif90"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/barundas/Desktop/Desktop - Barun’s MacBook Pro (2)/Ph.D. Folder/Research/Software/projects/Trilinos/build/CMakeFiles/CMakeScratch/TryCompile-Vao5Mp'

    Run Build Command(s): /opt/homebrew/Cellar/cmake/3.29.2/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_5f4a1/fast
    /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_5f4a1.dir/build.make CMakeFiles/cmTC_5f4a1.dir/build
    Building Fortran object CMakeFiles/cmTC_5f4a1.dir/testFortranCompiler.f.o
    /opt/homebrew/opt/open-mpi/bin/mpif90   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.15 -c "/Users/barundas/Desktop/Desktop - Barun’s MacBook Pro (2)/Ph.D. Folder/Research/Software/projects/Trilinos/build/CMakeFiles/CMakeScratch/TryCompile-Vao5Mp/testFortranCompiler.f" -o CMakeFiles/cmTC_5f4a1.dir/testFortranCompiler.f.o
    Linking Fortran executable cmTC_5f4a1
    /opt/homebrew/Cellar/cmake/3.29.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5f4a1.dir/link.txt --verbose=1
    /opt/homebrew/opt/open-mpi/bin/mpif90  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.15 CMakeFiles/cmTC_5f4a1.dir/testFortranCompiler.f.o -o cmTC_5f4a1
    ld: library not found for -ld_classic
    collect2: error: ld returned 1 exit status
    make[1]: *** [cmTC_5f4a1] Error 1
    make: *** [cmTC_5f4a1/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake:1482 (enable_language)
  cmake/tribits/core/package_arch/TribitsProjectImpl.cmake:189 (tribits_setup_env)
  cmake/tribits/core/package_arch/TribitsProject.cmake:92 (tribits_project_impl)
  CMakeLists.txt:103 (TRIBITS_PROJECT)

Even ChatGPT told me to post to the community forums to see what the problem is.

cgcgcg commented 2 months ago

It says

ld: library not found for -ld_classic

That's not something that Trilinos normally sets for the linker, so I guess it's your installation of OpenMPI. You could check with

mpif90 --showme:link

to see if that's indeed the case.