即使使用-ldl标志,g ++也不能链接到libdl [英] g++ cannot link to libdl even with -ldl flag

查看:384
本文介绍了即使使用-ldl标志,g ++也不能链接到libdl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Matrix Vision出售的USB摄像头(mvBlueFOX)编写一个示例应用程序。它们为我提供了应用程序的源代码,make文件和一组预编译的共享库。但是,make文件无法成功构建可执行文件。 make返回:

  carter @ carter-Lenovo-G780:〜/ mvimpact_acquire-x86-1.12.22.254 / apps / LiveSnap $ make $ b $ make [1]:进入目录`/home/carter/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap/x86'
/ usr / bin / g ++ -O2 -Wall -W -fPIC -D_REENTRANT -D_GNU_SOURCE -D_MAJOR_VERSION = 1 -D_MINOR_VERSION = 12 -D_BUILD_VERSION = 22 -D_BUILD2_VERSION = 254 -DMALLOC_TRACE -DNDEBUG -I ../../.. -o LiveSnap LiveSnap.o -L ../../ ../lib/x86 -lmvDeviceManager -lmvPropHandling -lm -lpthread -ldl
../../../lib/x86/libmvPropHandling.so:对dlsym的未定义引用
../ ../../lib/x86/libmvPropHandling.so:对`dlopen'的未定义引用
../../../lib/x86/libmvPropHandling.so:对`dlclose'的未定义引用
collect2:ld返回1退出状态
make [1]:*** [LiveSnap]错误1
make [1]:离开目录`/home/carter/mvimpact_acquire-x86-1.12.22.254/ apps / LiveSnap / x86'
make:*** [all] Error 2

link命令的简化版本:

  g ++ -o LiveSnap x86 / LiveSnap.o -lmvDeviceManager -ldl 

$ b

 ../../../ lib / x86 / libmvPropHandling.so:未定义对`dlsym'的引用
../../../lib/x86/libmvPropHandling.so:对` dlopen'
../../../lib/x86/libmvPropHandling.so:对'dlclose'的未定义引用



libdl.so被找到,但是该过程仍然失败。这是我的libdl版本的问题还是有另一个问题?

解决方案

对于那些有兴趣解决这个问题的人,我能够成功构建并运行从Movie-Matrix网站下载的更新版本的代码。用相机提供的CD版本是1.2.22,而网站版本是2.5.2。为什么旧版本无法构建仍然是未知的,但问题似乎可以在新版本的软件中解决。


I am attempting to compile an example application for a USB camera (mvBlueFOX) sold by Matrix Vision. They provide me with the source code for the application, a make file, and a set of pre-compiled shared libraries. However, the make file fails to successfully build an executable. A "make" returns:

carter@carter-Lenovo-G780:~/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap$ make
make[1]: Entering directory `/home/carter/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap/x86'
/usr/bin/g++     -O2 -Wall -W -fPIC -D_REENTRANT -D_GNU_SOURCE -D_MAJOR_VERSION=1 -D_MINOR_VERSION=12 -D_BUILD_VERSION=22 -D_BUILD2_VERSION=254  -DMALLOC_TRACE -DNDEBUG      -I../../..   -o LiveSnap LiveSnap.o     -L../../../lib/x86 -lmvDeviceManager -lmvPropHandling    -lm -lpthread   -ldl 
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlsym'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlopen'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlclose'
collect2: ld returned 1 exit status
make[1]: *** [LiveSnap] Error 1
make[1]: Leaving directory `/home/carter/mvimpact_acquire-x86-1.12.22.254/apps/LiveSnap/x86'
make: *** [all] Error 2

A simplified version of the link command:

g++ -o LiveSnap x86/LiveSnap.o -lmvDeviceManager -ldl

Still returns:

../../../lib/x86/libmvPropHandling.so: undefined reference to `dlsym'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlopen'
../../../lib/x86/libmvPropHandling.so: undefined reference to `dlclose'

libdl.so is being found, however the process still fails. Is this an issue with my version of libdl or is there another problem?

解决方案

For those interested in a work around to this problem, I was able to successfully build and run a newer version of the code that I downloaded from the Movie-Matrix website. The version provided on the CD with my camera was 1.2.22 while the version from the website was 2.5.2. Why the older version fails to build is still unknown, but the problem seems to be solved in newer versions of the software.

这篇关于即使使用-ldl标志,g ++也不能链接到libdl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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