未定义对符号'dlsym @@ GLIBC_2.4'的引用 [英] undefined reference to symbol 'dlsym@@GLIBC_2.4'

查看:1040
本文介绍了未定义对符号'dlsym @@ GLIBC_2.4'的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,请记住,我是linux新手. 我在编译项目时遇到问题.我不断收到以下错误:

/usr/bin/ld:CMakeFiles/Robot.dir/source/ModuleHandler.cpp.o:对符号'dlsym @@ GLIBC_2.4'的未定义引用 //lib/arm-linux-gnueabihf/libdl.so.2:添加符号时出错:命令行缺少DSO collect2:ld返回1个退出状态

首先正确的目录是:/usr/lib/arm-linux-gnueabihf/libdl.so 而不是://lib/arm-linux-gnueabihf/libdl.so

我尝试使用ldd -r更新我的ldconfig.conf文件,设置LD_LIBRARY_PATH 无济于事.

CMAKE用于创建Make文件.

我以前编译时没有问题.它是在我进行了apt-get升级时或从VS尝试进行交叉编译后开始的.

任何建议将不胜感激!

//内森

解决方案

通常,找不到的符号的手册页会告诉您需要链接到哪些库.

http://linux.die.net/man/3/dlsym

请注意以下行:

-ldl 链接.

First off, please keep in mind that I'm new to linux. I'm having problems compiling my project. I keep get the following error:

/usr/bin/ld: CMakeFiles/Robot.dir/source/ModuleHandler.cpp.o: undefined reference to symbol 'dlsym@@GLIBC_2.4' //lib/arm-linux-gnueabihf/libdl.so.2: error adding symbols: DSO missing from command line collect2: ld returned 1 exit status

First off the correct directory is: /usr/lib/arm-linux-gnueabihf/libdl.so Rather than: //lib/arm-linux-gnueabihf/libdl.so

I've tried updating my ldconfig.conf file, setting LD_LIBRARY_PATH, using ldd -r to no avail.

CMAKE is used to create the make file.

I've previously had no problems compiling. It started either when I did a apt-get upgrade or after a tried cross-compiling from VS.

Any suggestions would be greatly appreciated!

//Nathan

解决方案

In general, the man page for the symbol you can't find tells you what libraries you need to link in. In your case:

http://linux.die.net/man/3/dlsym

Note the line:

Link with -ldl.

这篇关于未定义对符号'dlsym @@ GLIBC_2.4'的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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