This question arose when trying to fix some installation problems
with QtCore4
. At some point make
tried to run the following command:
/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:
which failed with the following error message from the linker:
/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
From the error message, it seems to me that the object files (here: toke.o
) in
libperl.a
was compiled without the -fPIC
flag set.
The questions I have now are:
libperl.a
with -fPIC
?QtCore4
(since it is likely that libperl.a
will be used (linked
with) by other applications/programs not related to QtCore4
)?I am using Ubuntu 16.10 and perl version 5.24.1.
How can I recompile the object files in libperl.a with -fPIC
By recompiling libperl.a with the -fPIC flag.
./Configure -des -Accflags=-fPIC ...
Could this recompilation cause other problems not related to QtCore4 (since it is likely that libperl.a will be used (linked with) by other applications/programs not related to QtCore4)?
Yes. Prefer a shared libperl. -Duseshrplib
Which is required when embedding perl into shared libs. You can do away with the -fPIC trick which is required on ELF, but a shared libperl makes it much easier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With