From b251476af6095e600e227b659c06fb3393e82af5 Mon Sep 17 00:00:00 2001 From: "Andrew V. Jones" Date: Mon, 19 Jul 2021 08:06:53 +0100 Subject: [PATCH] 'CryptoMiniSat_LIBRARIES' should respect lib/lib64 (#6905) On 64-bit openSUSE (and maybe other distributions), the default install directory for static libraries is `lib64` *not* `lib`. This has an impact on cvc5 when it is automatically building CMS (e.g., with `./configure.sh --cryptominisat --auto-download`): CMS adheres to the default value of `CMAKE_INSTALL_LIBDIR` to work out where to install the library files (so `lib64` on openSUSE), which fails when cvc5 tries to find these in `lib`. Without this change, the build fails as follows: ``` src/CMakeFiles/cvc5.dir/theory/type_enumerator.cpp.o -Wl,-rpath,:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: deps/lib/libcadical.a deps/lib/libcryptominisat5.a ../deps/install/lib64/libglpk.a deps/lib/libpicpolyxx.a /usr/lib64/libgmp.so deps/lib/libpicpoly.a /usr/lib64/libgmp.so && : /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find deps/lib/libcryptominisat5.a: No such file or directory collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. ``` and where: ``` avj@platypus ~/clones/cvc5/master/build$ find . -iname "libcryptominisat5.a" ./deps/src/CryptoMiniSat-EP-build/lib/libcryptominisat5.a ./deps/lib64/libcryptominisat5.a ``` (notice: `lib64` in the second path!) This commit fixes this discrepancy to ensure that cvc5 checks for CMS on `CMAKE_INSTALL_LIBDIR` as well. **Note**: `CMAKE_INSTALL_LIBDIR` comes from `GNUInstallDirs`, and this is `include`'d in cvc5's top-level `CMakeLists.txt` Signed-off-by: Andrew V. Jones --- cmake/FindCryptoMiniSat.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindCryptoMiniSat.cmake b/cmake/FindCryptoMiniSat.cmake index 9599f645f..5b543aedc 100644 --- a/cmake/FindCryptoMiniSat.cmake +++ b/cmake/FindCryptoMiniSat.cmake @@ -66,7 +66,7 @@ if(NOT CryptoMiniSat_FOUND_SYSTEM) -DNOZLIB=ON -DONLY_SIMPLE=ON -DSTATICCOMPILE=ON - BUILD_BYPRODUCTS /lib/libcryptominisat5.a + BUILD_BYPRODUCTS /${CMAKE_INSTALL_LIBDIR}/libcryptominisat5.a ) # remove unused stuff to keep folder small ExternalProject_Add_Step( @@ -77,7 +77,7 @@ if(NOT CryptoMiniSat_FOUND_SYSTEM) ) set(CryptoMiniSat_INCLUDE_DIR "${DEPS_BASE}/include/") - set(CryptoMiniSat_LIBRARIES "${DEPS_BASE}/lib/libcryptominisat5.a") + set(CryptoMiniSat_LIBRARIES "${DEPS_BASE}/${CMAKE_INSTALL_LIBDIR}/libcryptominisat5.a") add_library(CryptoMiniSat STATIC IMPORTED GLOBAL) set_target_properties( -- 2.30.2