Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 583398

Summary: net-libs/gsoap should be compiled with -fPIC
Product: Gentoo Linux Reporter: Balint SZENTE <balint>
Component: [OLD] LibraryAssignee: Alessio Cassibba (X-Drum) <swapon>
Status: RESOLVED FIXED    
Severity: normal CC: jstein, patrick, polynomial-c, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch for building both static and shared libs (based on Debian)

Description Balint SZENTE 2016-05-18 11:04:44 UTC
Linking the libgsoapssl++.a into a shared library gives the following warning:

/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../lib/libgsoapssl++.a(libgsoapssl___a-stdsoap2_ssl_cpp.o): warning: relocation in readonly section `.rodata'.
/usr/lib/gcc/i686-pc-linux-gnu/4.8.3/../../../../i686-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in object.

The issue is that the object files in libgsoapssl++ are not compiled with -fPIC, thus they cannot be linked into a shared library. The issue is only x86 related, because on amd64 -fPIC is implicit.

See also:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=353724>
<https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/gsoap#n24>
Comment 1 Rafał Mużyło 2016-05-20 08:03:47 UTC
...I'd call that "works as intended".

Aren't you supposed to link the shared lib here or does libgsoapssl++ provide only the static lib ?

Full build log might be helpful.
Comment 2 Balint SZENTE 2016-05-20 08:38:59 UTC
Yes, normally the static libs are not linked into shared objects, I agree. But the net-libs/gsoap provides only static libs compiled *without* -fPIC. Thus you cannot link them into shared library as it is now. That's why guys from ArchLinux had to apply the "-fPIC fix" (see links in my previous comment).

$ equery f gsoap | grep libgsoap
/usr/lib/libgsoap++.a
/usr/lib/libgsoap.a
/usr/lib/libgsoapck++.a
/usr/lib/libgsoapck.a
/usr/lib/libgsoapssl++.a
/usr/lib/libgsoapssl.a

$ emerge -pv gsoap

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] net-libs/gsoap-2.8.23::gentoo  USE="ssl -debug -doc -examples -gnutls -ipv6" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB

As you can see there is no shared/static USE flag for this ebuild.

I see two possible solutions here:
1. Leave as it is with static libs only and just add the -fPIC option to the CFLAGS for this package (simple, easy solution).
2. Generate also the shared libs as well (complicated, it seems upstream does not support it, but probably the "correct" way to do it -- this is how the Debian package is)

I can provide you the build log, but it is a company project, without ebuild etc. So it is not a Gentoo Portage package. If you still think it could be useful, I can attach it.
Comment 3 Rafał Mużyło 2016-05-22 07:54:40 UTC
> But the net-libs/gsoap provides only static libs

OK, that's the important part.

The rest is for the maintainer to decide.

Many packages providing only static libs do add explicit '-fPIC' for x86, but the more invasive Debian approach might be valid too.
Comment 4 Roman Beránek 2017-01-10 14:27:13 UTC
Created attachment 459484 [details, diff]
Patch for building both static and shared libs (based on Debian)

This code adds shared libraries. Makes it possible to use static-libs flag.
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2017-04-28 07:45:47 UTC
commit ff57f004b947cea5023fd3f203e41e6312822fc4
Author: Lars Wendler <polynomial-c@gentoo.org>
Date:   Fri Apr 28 09:43:30 2017

    net-libs/gsoap: Bump to version 2.8.45

    Build shared libs (bug #583398).

    Package-Manager: Portage-2.3.5, Repoman-2.3.2