Skip to content
Permalink
Browse files

MDEV-11753 Link failure on missing -L${LIBLZ4_LIBRARY_DIR}

On FreeBSD liblz4 is installed in /usr/local/lib.
Groonga uses pkg_check_modules to check for liblz4 (that is, pkg-config),
and then it used to set for libgroonga.a

  link_directories({$LIBLZ4_LIBRARY_DIRS})
  target_link_libraries(... ${LIBLZ4_LIBRARIES})

Now groonga is a static library, linked into ha_mroonga.so. CMake won't
link dynamic liblz4.so into libgroonga.a, instead it'll pass it as a
dependency and will link it into ha_mroonga.so. Fine so far. But it will
not pass link_directories from the static library as a dependency,
so ha_mroonga.so won't find liblz4.so

As suggested on cmake mailing list (e.g.
here: http://public.kitware.com/pipermail/cmake/2011-November/047468.html)
we switch to use the full path to liblz4.so, instead of the -l/-L pair.
  • Loading branch information...
vuvova committed Feb 23, 2017
1 parent 370cf70 commit cc413ce9a368b930aba5e63c0ab013f7b3ab3c04
Showing with 9 additions and 3 deletions.
  1. +9 −3 storage/mroonga/vendor/groonga/lib/CMakeLists.txt
@@ -22,8 +22,14 @@ include_directories(
${ONIGMO_INCLUDE_DIRS}
${MRUBY_INCLUDE_DIRS}
${LIBLZ4_INCLUDE_DIRS})
link_directories(
${LIBLZ4_LIBRARY_DIRS})
if (LIBLZ4_LIBRARY_DIRS)
find_library(LZ4_LIBS
NAMES ${LIBLZ4_LIBRARIES}
PATHS ${LIBLZ4_LIBRARY_DIRS}
NO_DEFAULT_PATH)
else()
set(LZ4_LIBS ${LIBLZ4_LIBRARIES})
endif()

read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/sources.am LIBGROONGA_SOURCES)
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/dat/sources.am LIBGRNDAT_SOURCES)
@@ -60,7 +66,7 @@ set(GRN_ALL_LIBRARIES
${RT_LIBS}
${PTHREAD_LIBS}
${Z_LIBS}
${LIBLZ4_LIBRARIES}
${LZ4_LIBS}
${DL_LIBS}
${M_LIBS}
${WS2_32_LIBS}

0 comments on commit cc413ce

Please sign in to comment.
You can’t perform that action at this time.