编译live555的时候遇到了这个问题,前面的编译没有问题,是在链接的时候出现的,在网上搜索说是缺少 libstdc++ 库。于是,安装之
#sudo apt-get install libstdc++-dev
shawn@ubuntu:~/work/live555-master_1$ sudo apt-get install libstdc++-dev [sudo] password for shawn: Reading package lists... Done Building dependency tree Reading state information... Done Package libstdc++-dev is a virtual package provided by: libstdc++-8-dev 8.2.0-1ubuntu2~18.04 libstdc++-7-dev 7.3.0-27ubuntu1~18.04 libstdc++-6-dev 6.4.0-17ubuntu1 libstdc++-5-dev 5.5.0-12ubuntu1 libstdc++-4.8-dev 4.8.5-4ubuntu8 libc++-dev 6.0-2 You should explicitly select one to install. E: Package 'libstdc++-dev' has no installation candidate
选择一个安装
#sudo apt-get install libstdc++-8-dev
安装完成,问题没有得到解决。。。。。。。。。。。
make[1]: Entering directory '/home/shawn/work/live555-master_1/testProgs' c++ -otestMP3Streamer -L. testMP3Streamer.o ../liveMedia/libliveMedia.a ../groupsock/libgroupsock.a ../BasicUsageEnvironment/libBasicUsageEnvironment.a ../UsageEnvironment/libUsageEnvironment.a /usr/bin/x86_64-linux-gnu-ld: ../groupsock/libgroupsock.a(inet.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status Makefile:99: recipe for target 'testMP3Streamer' failed make[1]: *** [testMP3Streamer] Error 1 make[1]: Leaving directory '/home/shawn/work/live555-master_1/testProgs' Makefile:33: recipe for target 'all' failed make: *** [all] Error 2
可能这次报的错和上次不一样吧,意思是在编译选项上加上-fPIC ,于是在 COMPILE_OPTS 和 CONSOLE_LINK_OPTS 都加上 -fPIC ,
#./genMakefile linux
#make
编译成功!