Undefined reference to symbol 'gzclose' wi

2019-09-16 11:01发布

问题:

I try to build the project, doppia, but linking error occurs. I guess this is a linker error, but I've spent a lot of time and haven't find a working answer.

When I tried before, there is no error. But I have other error about CUDA, so I reinstalled opencv. After that, this linking error occurs.

So, I think this is opencv-related problem such as mistake of path, etc.

Command:

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . && make

path .bashrc

LD_LIBRARY_PATH=/home/username/Documents/Python/imra/code/opencv-2.4.11/release/lib:/home/username/Documents/Python/imra/code/opencv-2.4.11/release/3rdparty/lib/:$LD_LIBRARY_PATH

export LD_LIBRARY_PATH
PKG_CONFIG=$PKG_CONFIG_PATH:/home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/unix-install/
export PKG_CONFIG_PATH

Output

/usr/bin/ld: /home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/installed/lib/libopencv_core.a(persistence.cpp.o): undefined reference to symbol 'gzclose' /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libz.so: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: * [ground_estimation] error 1 make1: * [CMakeFiles/ground_estimation.dir/all

] error 2 make: *** [all] error 2

some info:

  • Ubuntu 14.04 LTS 64bit
  • OpenCV 2.4.11
  • ZLIB 1.2.8

回答1:

I found the solution. The error is caused by order of link file.

Compilation problems with ZLIB