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

Error in libmutation++_fortran.dylib. #176

Closed
1 of 2 tasks
anfuso1193 opened this issue Sep 13, 2021 · 12 comments
Closed
1 of 2 tasks

Error in libmutation++_fortran.dylib. #176

anfuso1193 opened this issue Sep 13, 2021 · 12 comments

Comments

@anfuso1193
Copy link

anfuso1193 commented Sep 13, 2021

My OS is:
MacBook Pro 2018

OS Version:
Catalina 10.15.7

Cmake Version:
3.21.0

uname -a output

Darwin MacBook-Pro-di-Enrico.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64

env output

TERM_PROGRAM_VERSION=433
TMPDIR=/var/folders/93/y0zzpfzj5pldqkpyldw0qyjr0000gn/T/
XPC_FLAGS=0x0
LANG=it_IT.UTF-8
TERM_PROGRAM=Apple_Terminal
XPC_SERVICE_NAME=0
DISPLAY=/private/tmp/com.apple.launchd.gDkaxCGN8v/org.xquartz:0
TERM_SESSION_ID=50072EF3-177C-4C5E-8BA0-FA001A0FE177
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.cux2KAVo1B/Listeners
TERM=xterm-256color
SHELL=/bin/zsh
HOME=/Users/enricoanfuso
LOGNAME=enricoanfuso
USER=enricoanfuso
PATH=/Users/enricoanfuso/.rvm/gems/ruby-2.6.3/bin:/Users/enricoanfuso/.rvm/gems/ruby-2.6.3@global/bin:/Users/enricoanfuso/.rvm/rubies/ruby-2.6.3/bin:/Users/enricoanfuso/opt/anaconda3/condabin:/usr/local/texlive/2017/bin/x86_64-darwin:/Users/enricoanfuso/Documents/Enrico/VKI/Codes/stagline/bin:/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/install/bin:/Users/enricoanfuso/Documents/Enrico/VKI/Codes/CodeRTE/RTE/rte1d_enrico//install/bin:/Users/enricoanfuso/Documents/Enrico/VKI/Codes/NEQAIR/NEQAIR-v15.0-update/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/enricoanfuso/.rvm/bin
SHLVL=1
PWD=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/stagline/build
OLDPWD=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/stagline
CLICOLOR=1export
LSCOLORS=GxFxCxDxBxegedabagaced
PS1=$ 
NEQAIR_DIRECTORY=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/NEQAIR/NEQAIR-v15.0-update
RAD_DIRECTORY=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/CodeRTE/RTE/rte1d_enrico/
HTGR_DATA_DIRECTORY=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/CodeRTE/RTE/rte1d_enrico//data
MPP_DIRECTORY=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp
MPP_DATA_DIRECTORY=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/data
ABLA_DATA_DIR=/Users/enricoanfuso/Documents/Enrico/VKI/Codes/stagline/src/ablation_modules/ablation_data
SPyICP_DIRECTORY=/Users/enricoanfuso/Documents/Enrico/VKI/Project/Python/CodesClean/RtePlasmatron
CONDA_EXE=/Users/enricoanfuso/opt/anaconda3/bin/conda
_CE_M=
_CE_CONDA=
CONDA_PYTHON_EXE=/Users/enricoanfuso/opt/anaconda3/bin/python
CONDA_SHLVL=0
rvm_prefix=/Users/enricoanfuso
rvm_path=/Users/enricoanfuso/.rvm
rvm_bin_path=/Users/enricoanfuso/.rvm/bin
rvm_version=1.29.9 (latest)
GEM_HOME=/Users/enricoanfuso/.rvm/gems/ruby-2.6.3
GEM_PATH=/Users/enricoanfuso/.rvm/gems/ruby-2.6.3:/Users/enricoanfuso/.rvm/gems/ruby-2.6.3@global
MY_RUBY_HOME=/Users/enricoanfuso/.rvm/rubies/ruby-2.6.3
IRBRC=/Users/enricoanfuso/.rvm/rubies/ruby-2.6.3/.irbrc
RUBY_VERSION=ruby-2.6.3
rvm_alias_expanded=
rvm_bin_flag=
rvm_docs_type=
rvm_gemstone_package_file=
rvm_gemstone_url=
rvm_niceness=
rvm_nightly_flag=
rvm_only_path_flag=
rvm_pretty_print_flag=
rvm_proxy=
rvm_quiet_flag=
rvm_ruby_bits=
rvm_ruby_file=
rvm_ruby_make=
rvm_ruby_make_install=
rvm_ruby_mode=
rvm_script_name=
rvm_sdk=
rvm_silent_flag=
rvm_use_flag=
rvm_hook=
_=/usr/bin/env

Mutation++ origin

Build from source
  • Package manager
  • Build from source

Mutation++ build steps

  1. Step
    git clone github.com/mutationpp/Mutationpp
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX:PATH=$(realpath ../install) ..
    make -j4 install

  2. Step: modify the ~/.zshrc profile
    export MPP_DIRECTORY='/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp'
    export MPP_DATA_DIRECTORY=$MPP_DIRECTORY/data
    export PATH=$MPP_DIRECTORY/install/bin:$PATH
    export LD_LIBRARY_PATH=$MPP_DIRECTORY/install/lib:$LD_LIBRARY_PATH

  3. Step
    ccmake ..
    BUILD_FORTRAN_WRAPPER --> ON

  4. Step
    cd Mutationpp
    cd build
    make -j4 install

  5. Step
    In "Mutationpp/install/include" I have drag&drop the "mutationpp.mod" file inside the "mutation++" folder

Mutation++ cmake output

 CMake Warning (dev):
   Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
   --help-policy CMP0042" for policy details.  Use the cmake_policy command to
   set the policy and suppress this warning.

   MACOSX_RPATH is not specified for the following targets:

    mutation++_fortran

 This warning is for project developers.  Use -Wno-dev to suppress it.
 Generating done

Mutation++ make output

/usr/local/Cellar/cmake/3.21.0/bin/cmake -S/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp -B/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_progress_start /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/CMakeFiles /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build//CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make  -f src/CMakeFiles/mutation++.dir/build.make src/CMakeFiles/mutation++.dir/depend
cd /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build && /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/src /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/CMakeFiles/mutation++.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f src/CMakeFiles/mutation++.dir/build.make src/CMakeFiles/mutation++.dir/build
make[2]: Nothing to be done for `src/CMakeFiles/mutation++.dir/build'.
[ 87%] Built target mutation++
/Library/Developer/CommandLineTools/usr/bin/make  -f interface/fortran/CMakeFiles/mutation++_fortran.dir/build.make interface/fortran/CMakeFiles/mutation++_fortran.dir/depend
cd /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build && /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/interface/fortran /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/interface/fortran /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/interface/fortran/CMakeFiles/mutation++_fortran.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f interface/fortran/CMakeFiles/mutation++_fortran.dir/build.make interface/fortran/CMakeFiles/mutation++_fortran.dir/build
make[2]: Nothing to be done for `interface/fortran/CMakeFiles/mutation++_fortran.dir/build'.
[ 90%] Built target mutation++_fortran
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/mppshock.dir/build.make src/apps/CMakeFiles/mppshock.dir/depend
cd /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build && /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps/CMakeFiles/mppshock.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/mppshock.dir/build.make src/apps/CMakeFiles/mppshock.dir/build
make[2]: Nothing to be done for `src/apps/CMakeFiles/mppshock.dir/build'.
[ 93%] Built target mppshock
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/bprime.dir/build.make src/apps/CMakeFiles/bprime.dir/depend
cd /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build && /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps/CMakeFiles/bprime.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/bprime.dir/build.make src/apps/CMakeFiles/bprime.dir/build
make[2]: Nothing to be done for `src/apps/CMakeFiles/bprime.dir/build'.
[ 95%] Built target bprime
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/mppequil.dir/build.make src/apps/CMakeFiles/mppequil.dir/depend
cd /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build && /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps/CMakeFiles/mppequil.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/mppequil.dir/build.make src/apps/CMakeFiles/mppequil.dir/build
make[2]: Nothing to be done for `src/apps/CMakeFiles/mppequil.dir/build'.
[ 97%] Built target mppequil
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/checkmix.dir/build.make src/apps/CMakeFiles/checkmix.dir/depend
cd /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build && /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/src/apps/CMakeFiles/checkmix.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f src/apps/CMakeFiles/checkmix.dir/build.make src/apps/CMakeFiles/checkmix.dir/build
make[2]: Nothing to be done for `src/apps/CMakeFiles/checkmix.dir/build'.
[100%] Built target checkmix
/usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_progress_start /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/build/CMakeFiles 0

Your software build steps

  1. Step
    cd stagline
    mkdir build
    cd build
    ccmake ../
    MPP_INSTALL_DIR /Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/install (press 'c' and 'g')
    make -j 4 install

Steps to reproduce

When I try to run a test case of 'stagline' I get the following errors

"
dyld: Library not loaded: libmutation++_fortran.dylib
Referenced from: /Users/enricoanfuso/Documents/Enrico/VKI/Codes/stagline/bin/stagline
Reason: image not found
zsh: abort stagline
"

Comments
I checked in "/Users/enricoanfuso/Documents/Enrico/VKI/Codes/Mutationpp/install/lib" and both the files libmutation++_fortran.dylib, libmutation++.dylib are there

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 13, 2021

Ehi @anfuso1193, the problem might be related to the cmake script of stagline. Could you please provide a link to the code such that I can inspect it?

@anfuso1193
Copy link
Author

Hi Ruben, have you recieved my email with all the info you asked for?

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 15, 2021

@anfuso1193 I don't think I have. But I'd very much prefer you to put that info here in the issue such that everybody in the future could eventually stumble on this issue and learn something.

@anfuso1193
Copy link
Author

anfuso1193 commented Sep 15, 2021

Yeah sure, sorry for that. Here's the file:

# Basic setup of project and minimum required CMake version
cmake_minimum_required(VERSION 2.6)
project(VKI_Stagnation_Line)
enable_language(Fortran)

# Library options
option(GOTO_BLAS "compile the GOTO BLAS library" OFF)
option(NITROGEN_PARK "include support for the Nitrogen chemistry library of Park" OFF)
option(NITROGEN_NASA "include support for the Nitrogen chemistry library of NASA" OFF)
option(NITROGEN_BARI "include support for the Nitrogen chemistry library of Bari" OFF)
option(NITROGEN_FHO  "include support for the Nitrogen FHO chemistry library" OFF)
option(NITROGEN_TTLTH "include support for the Nitrogen TTLTH chemistry library" OFF)
option(NITROGEN_DSMC "include support for the Nitrogen DSMC chemistry library" OFF)
option(ARGON_CR "include support for the Argon CR library" OFF)
option(POLYAT_GAS_WCU "include support for the POLYAT_GAS_WCU chemistry library" OFF)
option(MUTATIONPP "include support for the Mutation++ library" ON)
option(CARBONABLA "include support for the ablative boundary conditions" ON)

# Descend into the src directory to build all targets and libraries
add_subdirectory(src)
# Mutation++ directories
set(MPP_INSTALL_DIR "" CACHE PATH "Mutation++ installation directory")
if (${MUTATIONPP} MATCHES "ON")
#    if (NOT ${MPP_INSTALL_DIR} MATCHES "")
        include_directories(${MPP_INSTALL_DIR}/include/mutation++)
        include_directories(${MPP_INSTALL_DIR}/include/)
        link_directories(${MPP_INSTALL_DIR}/lib)
#    endif()
endif()
    

# Main executable
get_property(stagline_SRCS GLOBAL PROPERTY stagline_SRCS)
set_source_files_properties(${stagline_SRCS} PROPERTIES COMPILE_FLAGS -cpp)
add_executable(stagline ${stagline_SRCS})

if (${MUTATIONPP} MATCHES "ON")
    target_link_libraries(stagline -lmutation++_fortran)
endif()

# BLAS
set (BLASS_LIB_PATH "" CACHE FILEPATH "The BLAS library file")
if (${GOTO_BLAS} MATCHES "ON")
    target_link_libraries(stagline ${BLASS_LIB_PATH})
endif()

# Installation
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
install(TARGETS stagline DESTINATION bin)

# Doxygen generated documentation
option (BUILD_DOCUMENTATION 
    "Use Doxygen to create the HTML based API documentation" OFF)

if (BUILD_DOCUMENTATION)
    FIND_PACKAGE(Doxygen)
    
    if (NOT DOXYGEN_FOUND)
        message(FATAL_ERROR 
            "Doxygen is needed to build the documentation. Please install it 
             correctly")
    endif()
    # Configure the Template Doxyfile for our specific project
    configure_file(Doxyfile.in 
                    ${PROJECT_BINARY_DIR}/Doxyfile  @ONLY IMMEDIATE)
    # Add a custom target to run Doxygen when ever the project is built
    add_custom_target (docs
        COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
        SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
endif()

Let me know if you have any troubles with the drive.
I know other people didn’t have any problems installing and make it works. I think the problem is my machine.
Thanks a lot!

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 15, 2021

I took the liberty to edit your message and add the actual code in the message to make sure it stays there for future reference (the Google Drive will expire).

Anyway, the way Mutation is included is not as reported in the documentation. Did you check it?

https://github.com/mutationpp/Mutationpp/blob/master/docs/coupling.md

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 15, 2021

Here's an example for the Fortran interface: https://github.com/mutationpp/Mutationpp/blob/master/examples/fortran/CMakeLists.txt.shared

@anfuso1193
Copy link
Author

No, I didn't. I was following other instructions (Codes_101_BD.docs file inside the stagline folder). I will have a look at the documentation.

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 15, 2021

I guess that's historical for old versions of mutation. The new way is exactly aimed at avoid problems with wrong path because that information is included in the cmake target and doesn't have to be hard-coded by hand.

Let me know if you manage to make it work.😉

@anfuso1193
Copy link
Author

Hi Ruben,
sorry to bother you. I have tried to have a look at the docs but I am not familiar with the procedure so I guess I still need your help. Thanks a lot

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 20, 2021

Hello @anfuso1193, if you tell me what you tried and what problems you are encountering, I can help you troubleshoot. I'm afraid I have no time to support the build system of an external project right now, I'm sorry.

The starting point is this file: https://github.com/mutationpp/Mutationpp/blob/master/examples/fortran/CMakeLists.txt.shared. Adapt it to stagline cmake script file.

@anfuso1193
Copy link
Author

Thanks, Ruben. The code seems to work now but the problem was not the CMake. Apparently, it was on my .zshrc file.
Thanks for your time and help!

@rdbisme
Copy link
Collaborator

rdbisme commented Sep 20, 2021

Hello @anfuso1193, good to know. I still think that the cmake script should be adapted to use cmake targets (as shown in the script I shared before) instead of retrieving paths. Also, the build script should be adapted to be independent of user environment configuration (your .zshrc). One way to do that, in addition to switching to targets to reduce problems with non-existent paths), is to configure the RPATH accordingly. More info here: https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling. The RPATH allows to bake information on where to find shared libraries directly in the binary, avoiding the need to set LD_LIBRARY_PATH or similar things.

I'm closing this now, feel free to get back here if you need more help with building.

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