Howto add the -fPIC as a general option to FFLAGS

Discussion about building and installing Elmer
Post Reply
braunm
Posts: 9
Joined: 12 Oct 2011, 16:12
Antispam: Yes

Howto add the -fPIC as a general option to FFLAGS

Post by braunm »

Hi Friends and Colleagues

How can I add -fPIC to every FFLAG instance used
in the compilation process on Linux 64 bit
I am getting lots of error messages of the type
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
I guess that is controlled in one of the many .m4 files
is there a general one somewhere or do I have to change it manually in all subdirectories?

Any help will be very much appreciated

regards

Moritz Braun
hazelsct
Posts: 153
Joined: 05 Oct 2009, 17:02
Location: Boston, MA, USA
Contact:

Re: Howto add the -fPIC as a general option to FFLAGS

Post by hazelsct »

Can you just set "FFLAGS=-fPIC ./configure" in each command?
braunm
Posts: 9
Joined: 12 Oct 2011, 16:12
Antispam: Yes

Re: Howto add the -fPIC as a general option to FFLAGS

Post by braunm »

Hi there

Thanks a lot for your help

Your tip helped a lot but at the very end when creating a shared library libelmersolve.so ..
he still complains about the same problem as before this time for libumfpack.a

regards

Moritz
braunm
Posts: 9
Joined: 12 Oct 2011, 16:12
Antispam: Yes

Re: Howto add the -fPIC as a general option to FFLAGS

Post by braunm »

Dear All
I am really battling to compile elmer
on RedHat 5
has anybody managed to do this before?

regards

Moritz Braun
braunm
Posts: 9
Joined: 12 Oct 2011, 16:12
Antispam: Yes

Re: Howto add the -fPIC as a general option to FFLAGS

Post by braunm »

Dear All

I have solved the problem!
to compile successfully ( at least on RH5.1 64bit as cloned by Hewlett Packard and using the Intel Suite of Compilers)
use the following script:
======================
#!/bin/sh -f
# Compile Elmer modules and install it
#

# replace these with your compilers:
export CC=icc
export CXX=icc
export FC=ifort
export F77=ifort
modules="matc umfpack mathlibs elmergrid meshgen2d eio hutiter fem"
for m in $modules; do
cd $m
CFLAGS="-fPIC" CXXFLAGS="-fPIC" FFLAGS="-fPIC" FCFLAGS="-fPIC" ./configure --prefix=/home/braunm/elmer
make
make install
cd ..
done
============

The many flags infront of the configure command make sure that fPIC is used all the time

I suggest to the people in charge of the installation help to add this information as tip for the 64bit case under linux!

regards

M Braun
Post Reply