ngmlr
ngmlr copied to clipboard
Bug in CMakeLists.txt: cmake does not appropriately throw error if (or opt for dynamic libraries) when static ZLIB missing
Hi,
I was having trouble compiling ngmlr yesterday. I was getting a linker error because of ZLIB
:
ld: cannot find -lz
I was baffled that cmake
was finding zlib
, but the linker was failing. Essentially, the static zlib
libraries were not installed.
I posted to Stack Overflow to understand whether it's possible to force cmake
to throw an error if the static library is missing. Turns out you already have that, but it's being called after cmake
finds ZLIB
.
See Can CMake require static libraries (e.g., ZLIB)?
I was able to compile by commenting out
option(STATIC "Build static binary" ON)
Thank you for the feedback!
Instead of commenting out the line you could also run cmake as follows:
cmake -DSTATIC=OFF ..
This will give you a dynamically linked executable.
However, to avoid problems, starting with the next version dynamic linking will be the default.
Best, Philipp
Great.
We had the same issue!
On 6/27/17 3:04 AM, Philipp Rescheneder wrote:
Thank you for the feedback!
Instead of commenting out the line you could also run cmake as follows: |cmake -DSTATIC=OFF ..| This will give you a dynamically linked executable.
However, to avoid problems, starting with the next version dynamic linking will be the default.
Best, Philipp
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/philres/ngmlr/issues/22#issuecomment-311120677, or mute the thread https://github.com/notifications/unsubscribe-auth/AGLMhsoUI5J2IO04OfVXa4kd21o71HBmks5sH-SKgaJpZM4OEdLZ.
--
Benjamin Schwessinger PhD. Discovery Early Career Research Award Fellow Rathjen Lab Division of Plant Science Research School of Biology College of Medicine, Biology, and Environment Linnaeus Building (134), Linnaeus Way The Australian National University Canberra ACT 0200 Australia
M: +61 405 919 737 [email protected] lab webpage http://tinyurl.com/BenSchwessinger
twitter: @schwessinger http://twitter.com/schwessinger blog: http://blushgreengrassatafridayafternoon.wordpress.com/ google scholar: Benjamin Schwessinger http://scholar.google.com.au/citations?user=lEhYW3QAAAAJ&hl=en CRICOS Provider # 00120C
I also moved SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
in front of find_package( ZLIB REQUIRED )
as suggested on stackoverflow.
So when using -DSTATIC=ON
cmake should now throw an error.
Thanks again for the link.