How to eliminate ld errors in ubuntu

时间:2016-04-04 18:55:59

标签: c++ ubuntu

I'm getting following errors after running make command:

/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lepoxy
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lepoxy
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -lGLESv2
/usr/bin/ld: cannot find -lepoxy
/usr/bin/ld: cannot find -lEGL
/usr/bin/ld: cannot find -laio
/usr/bin/ld: cannot find -lcurl
/usr/bin/ld: cannot find -lssh2
/usr/bin/ld: cannot find -lncursesw
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status
main/CMakeFiles/esesc.dir/build.make:163: recipe for target 'main/esesc' failed
make[2]: *** [main/esesc] Error 1
CMakeFiles/Makefile2:1041: recipe for target 'main/CMakeFiles/esesc.dir/all' failed
make[1]: *** [main/CMakeFiles/esesc.dir/all] Error 2
Makefile:75: recipe for target 'all' failed
make: *** [all] Error 2

I have tried to search online in these links: ld cannot find an existing library

usr/bin/ld: cannot find -l<nameOfTheLibrary>

Here I see that every library has to be linked symbolically with the existing library but I'm unsure of doing that. Can anyone please suggest me any technique for doing this?

I know locate <library> and ln commands. Now how to eliminate the above errors using this? Can anyone please elaborate on this? Thanks in advance.

2 个答案:

答案 0 :(得分:0)

这意味着您没有安装所需的依赖项。 你从这本手册安装了至少libs吗? https://github.com/masc-ucsc/esesc/blob/master/docs/Usage.md

 sudo apt-get install libepoxy0 libepoxy-dev

应删除环氧树脂警告,例如

答案 1 :(得分:0)

您的链接命令可能需要在-l之前使用-L。

在系统中搜索这些libnames,例如GLESv2。

我使用&#34;找到GLESv2&#34;。 (注意:locate使用什么&#34; sudo updatedb&#34;更新)

在我的Unbuntu上,由locate报告以下行。

> /usr/lib/x86_64-linux-gnu/libGLESv2.so
> /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so
> /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2
> /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2.0.0

对于第一个目录中的so(共享对象库),您可以尝试将以下内容添加到构建命令中。

-L/usr/lib/x86_64-linux-gnu

并重复任何尚未解决的图书馆名称。

以下是我的Makefile中的一个示例 - 请注意我在目录中编写的库集合的相对路径&#34; bag&#34;

R01: dtb_acs.cc 
rm -f dtb_acs 
g++ -m64 -O3 -ggdb -std=c++14 -Wall-Wextra -Wshadow -Wnon-virtual-dtor
 -pedantic -Wcast-align -Wcast-qual -Wconversion -Wpointer-arith -Wunused
 -Woverloaded-virtual   
  -O0   dtb_acs.cc  -o dtb_acs  
 -L../../bag -lbag_i686 -lposix_i686 -lrt -pthread
 ^^^^^^^^^^^ three -l<libname> are in the -L dir

如果需要(因为努力没有解决任何问题),请尝试添加-l和特定的库,例如-llibGLESv2.so(或.a,视情况而定)

祝你好运。