Compiling for Shared Libraries

Kevan Hashemi hashemi at
Wed Feb 5 21:11:54 CET 2014

Dear GPC Users,

I just compiled GPC from sources on both 32-bit and 64-bit Linux 
machines. On both machines, I'm running Scientific Linux 6.4, a 
derivative of Red Had Linux 6.4. The local C compiler is 4.4.7 in both 

On the 32-bit machine, I can compile from Pascal to make objects, and 
link them with libgpc.a to make a shared library. But on the 64-bit 
machine I find that I must pass -fPIC to GPC to force it to compile 
position-independent code for the subsequent link. Even then, libgpc.a 
is position-dependent, so I can't link it into a shared library. So I 
edit the GPC build's Makefile:

CFLAGS = -g -O2 -fPIC

Now I build GPC again and re-install. The new libgpc.a is 
position-independent, and I can make my shared library.

Does anyone know why the default on 64-bit is position-dependent, while 
on 32-bit it is position-independent?

Is there an easier way to add a compiler option to the build process, 
other than editing the Makefile produced by the GCC_3.4.6 configure 
script? (For example, can I pass a compiler option into the configure 
script or into the makefile.)

Anyway: I have adapted my compiler GPC instructions below, and I'll be 
adding more Linux binary install files in the coming weeks.

Yours, Kevan

Kevan Hashemi, Electrical Engineer
Physics Department, Brandeis University

More information about the Gpc mailing list