克服cmake中的 "未定义引用 "错误--cmake正在请求一个包,而我有可用的包。

0 人关注

cmake说我有一个对 gzopen64@ZLIB_1.2.3.3 的未定义引用。我从源代码构建了zlib 1.2.3.3,将include目录添加到 CPATH ,将lib目录添加到 LD_LIBRARY_PATH ,并将 libz.so.1.2.3.3 粘贴到我的构建目录。我还是卡在这个错误上。有什么其他方法可以让cmake进入zlib 1.2.3.3版本吗?

好的,这里是完整的错误信息。

$ 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