cmake 和 opencv 对符号“gzclose"的未定义引用 [英] Undefined reference to symbol 'gzclose' with cmake and opencv

查看:52
本文介绍了cmake 和 opencv 对符号“gzclose"的未定义引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试构建项目,doppia,但发生链接错误.我想这是一个链接器错误,但我花了很多时间还没有找到有效的答案.

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.

我之前试过,没有错误.但是我还有其他关于 CUDA 的错误,所以我重新安装了 opencv.之后,发生此链接错误.

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.

所以,我认为这是与opencv相关的问题,例如路径错误等

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

命令:

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . && make

路径.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

输出

/usr/bin/ld:/home/matterd/Documents/Python/imra/code/opencv-2.4.11/release/installed/lib/libopencv_core.a(persistence.cpp.o):对符号gzclose"的未定义引用/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libz.so:添加符号时出错:命令行中缺少 DSO collect2:错误:ld 返回 1 退出状态 make[2]: * [ground_estimation] 错误 1make1: * [CMakeFiles/ground_estimation.dir/all

/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

] 错误 2制作:*** [全部] 错误 2

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

一些信息:

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

推荐答案

我找到了解决方案.错误是由链接文件的顺序引起的.

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

ZLIB 的编译问题

这篇关于cmake 和 opencv 对符号“gzclose"的未定义引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆