On 2023-10-08 18:20, Stefano Crocco wrote:
Hello to everyone,
I successfully ported Konqueror to KF6, at least to the point that, on
my
system, it compiles correctly. However, when the CI tries to build it
on
linux, it fails with the following error:
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld:
../../lib/libkcm_konqhtml_static.a(mocs_compilation.cpp.o): relocation
R_X86_64_32S against `.rodata' can not be used when making a shared
object;
recompile with -fPIC
The full build log is in the attachment; the error is on line 1674.
This error doesn't happen when I try to compile Konqueror on my system,
which
seems to have the same gcc version as the CI and doesn't happen on the
CI with
freebsd and with the KF5 version, despite the fact that the, as far as
I can
tell, involved code hasn't changed.
It seems that the error comes from the attempt to link several plugins
(actually KCMs) to a static library (kcm_konqhtml_static).
Searching on Google, I found that the suggested solution for this kind
of
error is to add the -fPIC compilation flag when building the static
library. I
tried to do so and it worked but I'd like to understand whether this
actually
is the correct solution and why the issue only happens on the CI linux
build
for KF6 and not on the CI builds for KF5, on the CI freebsd build for
KF6 and
on my system. Can anyone give me some hints about this?
Hi,
I would propose to add
set_target_properties(katepch PROPERTIES POSITION_INDEPENDENT_CODE ON)
to the static lib target, we need that in Kate, too.
Greetings
Christoph
Thanks in advance
Stefano