cryptominisat icon indicating copy to clipboard operation
cryptominisat copied to clipboard

Cryptominisat dynamic linking to libmpi

Open snerligit opened this issue 3 years ago • 7 comments

Hi,

I use your cryptominsat library for my project. I have successfully built and used it several times from C++ and Python code.

Now, I am trying to get it going on another MacOS personal laptop. Building of the library goes fine. But when I try to run my program, I keep getting the following message:

dyld: Library not loaded: @rpath/libmpicxx.12.dylib
Referenced from: /usr/local/lib/libcryptominisat5.5.8.dylib
 Reason: image not found

I don't even need mpi on my personal laptop, could you please assist on what to do?

As per suggestion, I also tried to cmake cryptominisat using the following commands:

cd build
cmake -DNOMPI=ON ..
make

I face the same issue. I am not sure how to proceed. Please advise.

snerligit avatar Feb 04 '22 18:02 snerligit

Hi!

Sorry for my late response :( I think you simply have to remove everything in the build folder and then run the instructions as above. (Beware, if you have anything under build/, save it before!) Please do:

cd ..
rm -rf build
mkdir build
cd build
cmake -DNOMPI=ON ..
make

It should then work. If it still doesn't work, please let me know, I'll fix.

msoos avatar Feb 10 '22 07:02 msoos

Hi,

I tried the above mentioned steps and unfortunately I still face the same error.

snerligit avatar Feb 11 '22 06:02 snerligit

Hi,

Can you please run:

ldd cryptominisat5

and paste the output here? Also, please do what's above again, but this time, run with:

cd ..
rm -rf build
mkdir build
cd build
cmake -DNOMPI=ON ..
make VERBOSE=1

(note the VERBOSE=1) Paste EVERYTHING in here, from the beginning, to the end, of ALL the output you get for ALL the commands above. I need to see the cmake output, the build, the link, all. Then I can try to debug. Thanks,

Mate

msoos avatar Feb 11 '22 06:02 msoos

CMAKE: cmake -DNOMPI=ON .. -- The CXX compiler identification is AppleClang 12.0.0.12000032 -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- LIB directory is ‘’ -- BIN directory is ‘’ -- You can choose the type of build, options are:Debug;Release;RelWithDebInfo;MinSizeRel -- Doing a RelWithDebInfo build -- The C compiler identification is AppleClang 12.0.0.12000032 -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE
-- Building with GAUSS enabled at every level -- build type is RelWithDebInfo -- Performing Test HAVE_FLAG_-Wall -- Performing Test HAVE_FLAG_-Wall - Success -- Performing Test HAVE_FLAG_-Wextra -- Performing Test HAVE_FLAG_-Wextra - Success -- Performing Test HAVE_FLAG_-Wunused -- Performing Test HAVE_FLAG_-Wunused - Success -- Performing Test HAVE_FLAG_-Wsign-compare -- Performing Test HAVE_FLAG_-Wsign-compare - Success -- Performing Test HAVE_FLAG_-fno-omit-frame-pointer -- Performing Test HAVE_FLAG_-fno-omit-frame-pointer - Success -- Performing Test HAVE_FLAG_-Wtype-limits -- Performing Test HAVE_FLAG_-Wtype-limits - Success -- Performing Test HAVE_FLAG_-Wuninitialized -- Performing Test HAVE_FLAG_-Wuninitialized - Success -- Performing Test HAVE_FLAG_-Wno-deprecated -- Performing Test HAVE_FLAG_-Wno-deprecated - Success -- Performing Test HAVE_FLAG_-Wstrict-aliasing -- Performing Test HAVE_FLAG_-Wstrict-aliasing - Success -- Performing Test HAVE_FLAG_-Wpointer-arith -- Performing Test HAVE_FLAG_-Wpointer-arith - Success -- Performing Test HAVE_FLAG_-Wheader-guard -- Performing Test HAVE_FLAG_-Wheader-guard - Success -- Performing Test HAVE_FLAG_-Wformat-nonliteral -- Performing Test HAVE_FLAG_-Wformat-nonliteral - Success -- Performing Test HAVE_FLAG_-Winit-self -- Performing Test HAVE_FLAG_-Winit-self - Success -- Performing Test HAVE_FLAG_-Wparentheses -- Performing Test HAVE_FLAG_-Wparentheses - Success -- Performing Test HAVE_FLAG_-Wunreachable-code -- Performing Test HAVE_FLAG_-Wunreachable-code - Success -- Performing Test HAVE_FLAG_-g -- Performing Test HAVE_FLAG_-g - Success -- Performing Test HAVE_FLAG_-Wno-class-memaccess -- Performing Test HAVE_FLAG_-Wno-class-memaccess - Failed -- Performing Test HAVE_FLAG_-mpopcnt -- Performing Test HAVE_FLAG_-mpopcnt - Success -- Performing Test HAVE_FLAG_-msse4.2 -- Performing Test HAVE_FLAG_-msse4.2 - Success -- Performing Test HAVE_FLAG_-Wextra-semi-stmt -- Performing Test HAVE_FLAG_-Wextra-semi-stmt - Success -- Performing Test HAVE_FLAG_-Wweak-vtables -- Performing Test HAVE_FLAG_-Wweak-vtables - Success -- Performing Test HAVE_FLAG_-ggdb3 -- Performing Test HAVE_FLAG_-ggdb3 - Success -- Compiling for dynamic library use -- GIT hash found: 2afdb7c64b9970c44a90b11e59cf29c660bd74d0 -- PROJECT_VERSION: 5.8.0 -- PROJECT_VERSION_MAJOR: 5 -- PROJECT_VERSION_MINOR: 8 -- PROJECT_VERSION_PATCH: 0 -- Boost 1.46 found. -- Found Boost components: program_options -- Found SQLITE3: /usr/lib/libsqlite3.dylib
-- OK, Found SQLITE3! -- Not compiling detailed statistics. The system is faster without them -- Not on Linux, not creating manpage -- Found ZLIB: /usr/lib/libz.dylib (found version “1.2.11”) -- OK, Found ZLIB! -- Performing Test HAVE__FPU_SETCW -- Performing Test HAVE__FPU_SETCW - Failed -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Could NOT find M4RI (missing: M4RI_LIBRARIES M4RI_INCLUDE_DIRS) CMake Warning at CMakeLists.txt:617 (MESSAGE): Did not find M4RI, XOR detection&manipulation disabled CMake Warning at CMakeLists.txt:648 (find_package): By not providing “Findbreakid.cmake” in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by “breakid”, but CMake did not find one. Could not find a package configuration file provided by “breakid” with any of the following names: breakidConfig.cmake breakid-config.cmake Add the installation prefix of “breakid” to CMAKE_PREFIX_PATH or set “breakid_DIR” to a directory containing one of the above files. If “breakid” provides a separate development package or SDK, be sure it has been installed. CMake Warning at CMakeLists.txt:650 (message): BreakID NOT found -- Found MPI_C: /Users/sgourakisn/opt/anaconda3/lib/libmpi.dylib (found version “3.1") -- Found MPI_CXX: /Users/sgourakisn/opt/anaconda3/lib/libmpicxx.dylib (found version “3.1”) -- Found MPI: TRUE (found version “3.1")
-- In case your Python interpreter is not found, or a wrong one is found, please set it with ‘-DPYTHON_EXECUTABLE:FILEPATH=your path here’ -- Found PythonInterp: /Users/sgourakisn/opt/anaconda3/bin/python3 (found suitable version “3.9.7”, minimum required is “3") -- Found PythonLibs: /Users/sgourakisn/opt/anaconda3/lib/libpython3.9.dylib (found suitable version “3.9.7”, minimum required is “3") -- Python 3 -- PYTHON_EXECUTABLE=/Users/sgourakisn/opt/anaconda3/bin/python3 -- Python 3 -- PYTHON_LIBRARIES=/Users/sgourakisn/opt/anaconda3/lib/libpython3.9.dylib -- Python 3 -- PYTHON_INCLUDE_DIRS=/Users/sgourakisn/opt/anaconda3/include/python3.9 -- Python 3 -- PYTHONLIBS_VERSION_STRING=3.9.7 -- Boost -- found at library: Boost::program_options -- Boost -- adding ‘’ to link directories -- All defines at startup: -DEXTENDED_FEATURES -DUSE_GAUSS -DBOOST_TEST_DYN_LINK -DUSE_SQLITE3 -DUSE_ZLIB -DUSE_MPI -- Performing Test HAVE_FLAG_-Wno-bitfield-constant-conversion -- Performing Test HAVE_FLAG_-Wno-bitfield-constant-conversion - Success -- Performing Test HAVE_FLAG_-Wlogical-op -- Performing Test HAVE_FLAG_-Wlogical-op - Failed -- Performing Test HAVE_FLAG_-Wrestrict -- Performing Test HAVE_FLAG_-Wrestrict - Failed -- Performing Test HAVE_FLAG_-Wnull-dereference -- Performing Test HAVE_FLAG_-Wnull-dereference - Success -- Performing Test HAVE_FLAG_-Wdouble-promotion -- Performing Test HAVE_FLAG_-Wdouble-promotion - Success -- Performing Test HAVE_FLAG_-Wshadow -- Performing Test HAVE_FLAG_-Wshadow - Success -- Performing Test HAVE_FLAG_-Wformat=2 -- Performing Test HAVE_FLAG_-Wformat=2 - Success -- Performing Test HAVE_FLAG_-Wextra-semi -- Performing Test HAVE_FLAG_-Wextra-semi - Success -- Performing Test HAVE_FLAG_-pedantic -- Performing Test HAVE_FLAG_-pedantic - Success -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- GIT Subprojects not initialized, not building drat-trim CMake Warning at CMakeLists.txt:820 (message): Testing is disabled -- Found python interpreter, libs and header files -- Building python interface -- Python CFLAGS: ‘-Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/sgourakisn/opt/anaconda3/include -arch x86_64 -I/Users/sgourakisn/opt/anaconda3/include -fPIC -O2 -isystem /Users/sgourakisn/opt/anaconda3/include -arch x86_64 ’ -- Python LDFLAGS: ‘-ldl -framework CoreFoundation’ -- Python LINKFORSHARED flags: ‘-Wl,-stack_size,1000000 -framework CoreFoundation’ -- Python module installation prefix: --prefix=/usr/local -- OS X SDK path: ‘/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk’ -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: NOMPI -- Build files have been written to: /Users/sgourakisn/maus_v2/lib/cryptominisat/build Make Verbose=1 has a ginormous output let me rerun and redirect it 19 warnings generated. /Library/Developer/CommandLineTools/usr/bin/c++ -bundle -undefined dynamic_lookup -Wl,-rpath,/Users/sgourakisn/opt/anaconda3/lib -L/Users/sgourakisn/opt/anaconda3/lib -L/Users/sgourakisn/opt/anaconda3/lib -Wl,-rpath,/Users/sgourakisn/opt/anaconda3/lib -L/Users/sgourakisn/opt/anaconda3/lib -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 build/temp.macosx-10.9-x86_64-3.9/Users/sgourakisn/maus_v2/lib/cryptominisat/build/pycryptosat/src/pycryptosat.o -L. -L/Users/sgourakisn/maus_v2/lib/cryptominisat/build/lib -L/Users/sgourakisn/maus_v2/lib/cryptominisat/build/lib/RelWithDebInfo -L/usr/local/lib -L../lib -lcryptominisat5 -o /Users/sgourakisn/maus_v2/lib/cryptominisat/build/pycryptosat/pycryptosat.cpython-39-darwin.so -Wl,-rpath,/usr/local/lib ld: warning: directory not found for option ‘-L/Users/sgourakisn/maus_v2/lib/cryptominisat/build/lib/RelWithDebInfo’ ld: warning: dylib (/Users/sgourakisn/maus_v2/lib/cryptominisat/build/lib/libcryptominisat5.dylib) was built for newer macOS version (10.15) than being linked (10.9) [100%] Built target python_interface /Users/sgourakisn/opt/anaconda3/bin/cmake -E cmake_progress_start /Users/sgourakisn/maus_v2/lib/cryptominisat/build/CMakeFiles 0 3:07 make install make install [ 83%] Built target cryptominisat5 [ 91%] Built target cryptominisat5-bin [ 96%] Built target cryptominisat5_simple-bin Copying cryptominisat_c.h to /Users/sgourakisn/maus_v2/lib/cryptominisat/build/include/cryptominisat5 Copying cryptominisat.h to /Users/sgourakisn/maus_v2/lib/cryptominisat/build/include/cryptominisat5 Copying solvertypesmini.h to /Users/sgourakisn/maus_v2/lib/cryptominisat/build/include/cryptominisat5 Copying dimacsparser.h to /Users/sgourakisn/maus_v2/lib/cryptominisat/build/include/cryptominisat5 Copying streambuffer.h to /Users/sgourakisn/maus_v2/lib/cryptominisat/build/include/cryptominisat5 [ 96%] Built target CopyPublicHeaders [ 98%] Built target tablestruct [100%] Generating build/timestamp running build_ext [100%] Built target python_interface Install the project... -- Install configuration: “RelWithDebInfo” -- Installing: /usr/local/lib/cmake/cryptominisat5/cryptominisat5Config.cmake CMake Error at cmake_install.cmake:36 (file): file INSTALL cannot copy file “/Users/sgourakisn/maus_v2/lib/cryptominisat/build//CMakeFiles/cryptominisat5Config.cmake” to “/usr/local/lib/cmake/cryptominisat5/cryptominisat5Config.cmake”. make: *** [install] Error 1 ./run.sh dyld: Library not loaded: @rpath/libmpicxx.12.dylib Referenced from: /usr/local/lib/libcryptominisat5.5.8.dylib Reason: image not found

snerligit avatar Feb 12 '22 06:02 snerligit

https://github.com/msoos/cryptominisat/blob/02f53d1fc045fdba53671306964d3d094feb949e/CMakeLists.txt#L688

find_package(MPI) if (MPI_FOUND) add_definitions( -DUSE_MPI ) include_directories(${MPI_INCLUDE_PATH}) #set( CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER} ) else (MPI_FOUND) MESSAGE(STATUS "No suitable C++ MPI implementation found. CryptoMiniSat will not be distributed.") endif(MPI_FOUND)

With other parts it looks like this:

https://github.com/msoos/cryptominisat/blob/02f53d1fc045fdba53671306964d3d094feb949e/CMakeLists.txt#L653

if (NOT NOBREAKID) find_package(breakid) if (NOT BREAKID_LIBRARIES) message(WARNING "BreakID NOT found") else() message(STATUS "BreakID -- found version ${BREAKID_VERSION_MAJOR}.${BREAKID_VERSION_MINOR}") message(STATUS "BreakID -- libraries: ${BREAKID_LIBRARIES}") message(STATUS "BreakID -- include dirs: ${BREAKID_INCLUDE_DIRS}") add_definitions(-DUSE_BREAKID) endif() endif()

Can you try if you add

if (NOT NOMPI) ... endif()

around the MPI section and check if it then works?

(Sorry for bad formatting of this message)

capiman avatar Feb 12 '22 07:02 capiman

You can see suggested change here:

https://github.com/msoos/cryptominisat/pull/669/commits/979b80fc9f72c9f571e9db603c7d6c3ea3575528

capiman avatar Feb 12 '22 07:02 capiman

Ah, now I see! Thanks @capiman for helping out! Sorry, I had the NOMPI flag only in my development version. I now backported it to the master branch. This is now fixed in 8643beb3ecbfeba56b9be4be64a9c04955aa849e. Please let me know if it's fixed on your end :)

msoos avatar Feb 12 '22 11:02 msoos

Sorry again for the mess @snerligit . This issue should now be fixed :) I am closing this as I have verified that the released version has the correct NOMPI handling.

msoos avatar Oct 30 '22 10:10 msoos