[vtkusers] compilation with -fPIC necessary?

Sebastiaan sebastia at ch.its.tudelft.nl
Fri Mar 17 07:09:08 EST 2006


Hi,

On Fri, 17 Mar 2006, Obada Mahdi wrote:

> Hi Sebastiaan!
>
> Actually, you (almost) always need "-fPIC" when creating shared
> libraries.  Do I understand you correctly that the "-fPIC" flag is
> present when compiling VTK for shared libraries on AMD64, but not on the
> EMT64?  That could be a problem.
>
I made a mistake here: on the amd64 I did not compile VTK with MPI or 
PARALLEL, so it does not need the mpich library. So I do not know if amd64 
breaks, but I guess it will, which makes sense.

I have also read about -fPIC is almost always needed on 64 bit (don't know 
why it is not needed on 32 bit). I also read that -fPIC can break 
packages. Since most of VTK compiles clean without -fPIC, it seems 
overkill to compile all of VTK with this flag.

Why isn't this flag automatically added to the compiler for those shared 
libraries, if it is compiled on a 32 bit system?

Greetz,
Sebastiaan


> However, that "libmpich.a" issue is not related to VTK:
>
> On Thu, 16 Mar 2006, Sebastiaan wrote:
>> Linking CXX shared library ../bin/libvtkParallel.so
>> /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: 
>> /usr/X11R6/lib64/libmpich.a(isend.o): relocation R_X86_64_32 against `a 
>> local symbol'
>> can not be used when making a shared object; recompile with -fPIC
>
> Linking static libraries when creating a shared library just does not
> work generally.  Any chance there is a dynamic version like
> "libmpich.so" or so a available?  If not, you really need to recompile
> the "mpich" library in order to create shared VTK libraries.
>
>
> HTH,
>
> Obada
>


--

English written by Dutch people is easily recognized by the improper use of 'In principle ...'

The software box said 'Requires Windows 95 or better', so I installed Linux.

Als Pacman in de jaren '80 de kinderen zo had beïnvloed zouden nu veel jongeren rondrennen 
in donkere zalen terwijl ze pillen eten en luisteren naar monotone electronische muziek. 
(Kristian Wilson, Nintendo, 1989)


More information about the vtkusers mailing list