2017-04-04 63 views
4

當試圖修復一些installation problemsQtCore4時出現此問題。在某些時候make試圖運行下面的命令:如何用-fPIC標誌重新編譯libperl.a目標文件?

/usr/bin/c++ -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong \ 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG \ 
-shared -Wl,-soname,QtCore4.so -o ../../blib/arch/auto/QtCore4/QtCore4.so \ 
CMakeFiles/perlqtcore4.dir/binding.cpp.o \ 
CMakeFiles/perlqtcore4.dir/handlers.cpp.o \ 
CMakeFiles/perlqtcore4.dir/marshall_types.cpp.o \ 
CMakeFiles/perlqtcore4.dir/util.cpp.o \ 
CMakeFiles/perlqtcore4.dir/QtCore4.c.o \ 
-lQtCore -lQtGui -lQtNetwork \ 
/home/hakon/perlbrew/perls/perl-5.24.1/lib/5.24.1/x86_64-linux/CORE/libperl.a \ 
../../smokeqt/qtgui/libsmokeqtgui.so.3.0.0 \ 
../../smokeqt/qtnetwork/libsmokeqtnetwork.so.3.0.0 \ 
-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lQtGui -lQtNetwork \ 
../../smokeqt/qtcore/libsmokeqtcore.so.3.0.0 -lQtCore \ 
../../smokegen/bin/libsmokebase.so.3.0.0 \ 
-Wl,-rpath,/home/hakon/Qt4-0.99.0/smokeqt/qtgui:/home/hakon/Qt4-0.99.0/smokeqt/qtnetwork:/home/hakon/Qt4-0.99.0/smokeqt/qtcore:/home/hakon/Qt4-0.99.0/smokegen/bin: 

失敗並從鏈接器的以下錯誤消息:

/usr/bin/ld: /home/hakon/perlbrew/perls/perl-5.24.1/lib/5.24.1/x86_64-linux/CORE/libperl.a(toke.o): 
    relocation R_X86_64_PC32 against symbol `PL_curcop' can not be used when making 
    a shared object; recompile with -fPIC 
/usr/bin/ld: final link failed: Bad value 
collect2: error: ld returned 1 exit status 

從錯誤信息,在我看來,該目標文件(這裏:toke.olibperl.a編譯時沒有設置-fPIC標誌。

我有這些問題現在:

  • 我怎樣才能重新編譯-fPIClibperl.a目標文件?
  • 難道這重新編譯導致其他問題沒有涉及到 QtCore4(因爲很可能libperl.a將使用(由不涉及QtCore4其他應用程序/項目鏈接 用))?

我使用的是Ubuntu 16.10和perl版本5.24.1。

+1

[This](https://groups.google.com/forum/#!topic/perl.perl5.porters/-znN8wINCUI)可能會引起人們的興趣,雖然它指的是HPUX,而不是Linux版本。 – hlt

回答

1

我怎樣才能重新編譯libperl.a目標文件與-fPIC

通過與-fPIC標誌重新編譯libperl.a。

./Configure -des -Accflags=-fPIC ... 

難道這重新編譯的原因不涉及QtCore4其他問題(因爲很可能libperl.a將使用(由不涉及QtCore4其他應用程序/項目含)鏈接)?

是的。選擇一個共享的libperl。 -Duseshrplib

將perl嵌入到共享庫中時需要哪一個。您可以避免使用ELF所需的-fPIC技巧,但共享libperl使其更容易。

+0

謝謝,這工作得很好。我使用了以下命令:'perlbrew install perl-5.24.1 --as perl-5.24.1 -PIC -Accflags = -fPIC'爲測試目的保留單獨的安裝。 –

相關問題