0

cmake says I have an undefined reference to gzopen64@ZLIB_1.2.3.3. I built zlib 1.2.3.3 from source, added the include directory to CPATH, added the lib directory to LD_LIBRARY_PATH, and pasted libz.so.1.2.3.3 into my build directory. I am still stuck on this error. Is there any other way I can lead cmake to the zlib 1.2.3.3 build?

Edit OK here's the full error message:

$ make
Scanning dependencies of target utilscore
[  4%] Building CXX object src/core/CMakeFiles/utilscore.dir/CFDMesh.cpp.o    
[  8%] Linking CXX static library libutilscore.a
[  8%] Built target utilscore
Scanning dependencies of target nalu_preprocess
[ 13%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/PreProcessingTask.cpp.o
[ 17%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/NDTW2D.cpp.o
[ 21%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/SamplingPlanes.cpp.o
[ 26%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/ABLFields.cpp.o
[ 30%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/ChannelFields.cpp.o
[ 34%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/RotateMesh.cpp.o
[ 39%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/BdyIOPlanes.cpp.o
[ 43%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/PreProcessDriver.cpp.o
[ 47%] Building CXX object src/preprocessing/CMakeFiles/nalu_preprocess.dir/nalu_preprocess.cpp.o
[ 52%] Linking CXX executable nalu_preprocess
CMakeFiles/nalu_preprocess.dir/BdyIOPlanes.cpp.o: In function `stk::mesh::Bucket::begin_nodes(unsigned long) const':
/projects/windsim/exawind/SharedSoftwareA/spack/opt/spack/linux-centos6-x86_64/gcc-5.2.0/trilinos-develop-aeyspdjmeoo5inhcb7cpaojmrds7f6tt/include/stk_mesh/base/Bucket.hpp:306: undefined reference to `stk::mesh::Bucket::check_for_invalid_connectivity_request(stk::mesh::ConnectivityType const*) const'
/projects/windsim/exawind/SharedSoftwareA/spack/opt/spack/linux-centos6-x86_64/gcc-5.2.0/libxml2-2.9.4-ek3x27doaf3vg2izm363k755zy7nd67z/lib/libxml2.so.2: undefined reference to `gzopen64@ZLIB_1.2.3.3'
collect2: error: ld returned 1 exit status
make[2]: *** [src/preprocessing/nalu_preprocess] Error 1
make[1]: *** [src/preprocessing/CMakeFiles/nalu_preprocess.dir/all] Error 2

I understand there are similar questions about undefined reference errors. I'm not convinced this is a duplicate question. This answer nicely lays out all the possible causes of an undefined reference. I didn't find one that matched my specific situation, where a package is being requested by cmake and I have the package available.

kilojoules
  • 9,768
  • 18
  • 77
  • 149
  • Can you paste the full error message? – 0x5453 Jan 05 '18 at 18:57
  • did you check the file read permissions when you copied over the directory? – Dash Winterson Jan 05 '18 at 18:58
  • @0x5453 I posted it – kilojoules Jan 05 '18 at 19:01
  • @DashWinterson I ran `chmod -R 777` on the `zlib` directory and in the build directory, after rerunning my `cmake` workflow, right before running make. I get the same error. – kilojoules Jan 05 '18 at 19:03
  • can we see where in the makefile you define ld lib path as well? sorry just trying to get all the info – Dash Winterson Jan 05 '18 at 19:05
  • @DashWinterson Thanks for your questions. I don't do that in the make file. I added the paths with `export CPATH=/path/to/zlib/include:$CPATH` and `export LD_LIBRARY_PATH =/path/to/zlib/lib:$LD_LIBRARY_PATH ` – kilojoules Jan 05 '18 at 19:08
  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Jesper Juhl Jan 05 '18 at 19:09
  • 1
    when you echo the LD_LIBRARY_PATH from inside the makefile does it spit out the correct path? – Dash Winterson Jan 05 '18 at 19:11
  • " I ran `chmod -R 777`" - why on earth would you set such broad permissions? And why set the execute (on files) bit (which is search for directories) so indiscriminately? For all users none the less. – Jesper Juhl Jan 05 '18 at 19:11
  • @DashWinterson Yes. I used this technique to do that https://stackoverflow.com/a/25817631/3474956 – kilojoules Jan 05 '18 at 19:15
  • 1
    I found evidence that the lxml and zlib libs might conflict here: https://github.com/lukeroth/gdal/issues/15 – Dash Winterson Jan 05 '18 at 19:22

0 Answers0