From 9780083d129c50aa4a093b47946126d9fa9dd3e5 Mon Sep 17 00:00:00 2001 From: "Andrew V. Jones" Date: Mon, 19 Jul 2021 07:55:35 +0100 Subject: [PATCH] 'ANTLR3_RUNTIME' should respect lib/lib64 (#6906) 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 ANTLR3: ANTLR3 follows the system-wide default of `lib64`, which fails when cvc5 tries to find these in `lib`. Without this change, the build fails as follows: ``` src/parser/CMakeFiles/cvc5parser.dir/smt2/Smt2Parser.c.o -Wl,-rpath,/home/avj/clones/cvc5/lib64_cms/build/src:::::::::::::::::::::::: src/libcvc5.so.1 deps/lib/libantlr3c.a && : /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: cannot find deps/lib/libantlr3c.a: No such file or directory collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. ``` and where: ``` avj@platypus ~/clones/cvc5/lib64_cms/build$ find . -iname "libantlr3c.a" ./deps/src/ANTLR3-EP-runtime/.libs/libantlr3c.a ./deps/lib64/libantlr3c.a ``` (notice: `lib64` in the second path!) This commit fixes this discrepancy to ensure that cvc5 checks for ANTLR3 on `CMAKE_INSTALL_LIBDIR`, which matches that `autotools` will use. **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/FindANTLR3.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindANTLR3.cmake b/cmake/FindANTLR3.cmake index 9d62924be..ea0c4131f 100644 --- a/cmake/FindANTLR3.cmake +++ b/cmake/FindANTLR3.cmake @@ -117,12 +117,12 @@ if(NOT ANTLR3_FOUND_SYSTEM) --enable-static ${64bit} --host=${TOOLCHAIN_PREFIX} - BUILD_BYPRODUCTS /lib/libantlr3c.a + BUILD_BYPRODUCTS /${CMAKE_INSTALL_LIBDIR}/libantlr3c.a ) set(ANTLR3_JAR "${DEPS_BASE}/share/java/antlr-3.4-complete.jar") set(ANTLR3_INCLUDE_DIR "${DEPS_BASE}/include/") - set(ANTLR3_RUNTIME "${DEPS_BASE}/lib/libantlr3c.a") + set(ANTLR3_RUNTIME "${DEPS_BASE}/${CMAKE_INSTALL_LIBDIR}/libantlr3c.a") endif() find_package(Java COMPONENTS Runtime REQUIRED) -- 2.30.2