1. 程式人生 > >final link failed: Nonrepresentable section on output

final link failed: Nonrepresentable section on output

4.0 file linux pts soc bst uil 。。 pack

編譯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

編譯成功!

final link failed: Nonrepresentable section on output