构建openframeworks应用程序时,我遇到以下链接器错误:
/usr/bin/ld: /[...]/openframeworks/addons/ofxOpenCv/libs/opencv/lib/linux64/libopencv_core.a(persistence.o): undefined reference to symbol 'gzclose'
/usr/bin/ld: note: 'gzclose' is defined in DSO /lib/x86_64-linux-gnu/libz.so.1 so try adding it to the linker command line
/lib/x86_64-linux-gnu/libz.so.1: could not read symbols: Invalid operation
所以我将z添加到cmake文件中并出现了一个新错误:
/usr/bin/ld: /[...]/openframeworks/addons/ofxOpenCv/libs/opencv/lib/linux64/libopencv_core.a(persistence.o): undefined reference to symbol 'gzclose'
/usr/bin/ld: note: 'gzclose' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libz.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libz.so: could not read symbols: Invalid operation
就像链接器正在寻找一个不同的地方找不到gzclose ....有人可能会解释发生了什么,为什么以及如何解决它?
当我运行
时
我得到了$ ldconfig -v | grep libz
$ ldconfig -v | grep libz
并且在两个地方有一个libz.so.1.2.3.4:
libz.so.1 -> libz.so.1.2.3.4
我的/lib/i386-linux-gnu/libz.so.1.2.3.4
/lib/x86_64-linux-gnu/libz.so.1.2.3.4
是:
LD_LIBRARY_PATH
我正在运行64位Ubuntu 12.04 LTS,3.2.0-58-generic,gcc版本4.8.1(Ubuntu 4.8.1-2ubuntu1~12.04)
谢谢! 乙