Trying to build libgfortran.a with -fPIC

Thomas Koenig tkoenig@netcologne.de
Wed Dec 19 16:45:00 GMT 2018


Am 18.12.18 um 15:47 schrieb Toon Moene:
> This is probably better asked on the GNU Fortran mailing list (cc'd).
> 
> On 12/18/18 11:16 AM, Ricardo Telichevesky wrote:
>> Hello,
>>
>>      Can't find anywhere how to do it .... I've built the gcc compiler 
>> many times, in many different machines, and many versions ... However, 
>> now I need to compile it in such way that libgfortran.a and 
>> libquadmath.a with -fPIC flags, so that I can statically link them 
>> inside a shared object that contains lapack stuff ..
>>
>>      The problem with distributing shared objects that rely on other 
>> shared objects is that quite often the target machine doesn't have the 
>> right libraries libgfortran.so and libquadmath.so ... and if I 
>> distribute them have to deal with proper search paths, etc, it is a 
>> mess...
>>
>>      Any suggestions?  - perhaps there is a simple way to force the 
>> entire build of gcc  to compile with -fPIC ...
This may not be the best way, and it is indeed a bit hackish.
Furthermore, I haven't tried it, so it may or may not work...

Have you tried what happens if you edit
<build-dir>/x86_64-pc-linux-gnu/libgfortran/Makefile and
<build-dir>/trunk-bin/x86_64-pc-linux-gnu/libquadmath/Makefile
by hand and add -fPIC to the CFLAGS and FCFLAGS variables,
remove all *.o and *.lo files and recompile?

Regards

	Thomas



More information about the Fortran mailing list