[Coin-discuss] configuring COIN for x86_64 Linux

Andreas Waechter andreasw at watson.ibm.com
Thu May 3 11:59:05 EDT 2007


Hi Kish,

When you generate static libraries in your COIN package (by using 
--enable-debug, --enable-static, or --disable-shared), libtool will not 
use the -fPIC flag (or its equivalent on different platforms) since you 
are compiling static libraries.

On the other hand, if you compile in shared library mode (default), the 
-fPIC flag is automatically added and it all works fine.

So, what you observe is just as intended.

Since you want to cheat the system and not use the shared libraries as 
build by COIN but instead use COIN's static archives that you now want to 
include in your own shared library, you will have to add the -fPIC 
explicitly, so that it is also used when COIN creates your static 
libraries.

For this, you can use the ADD_CXXFLAGS etc variables.

I hope this helps,

Andreas

On Thu, 3 May 2007, Kish Shen wrote:

> Hi,
>
> On our x86_64 Linux machine:
>
> kish at phoenix:~/Coin-Cbc20070427> uname -a
> Linux phoenix 2.6.16.27-0.9-smp #1 SMP Tue Feb 13 09:35:18 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux
>
> the -fPIC flag is needed during compilation (with gcc) to allow the code 
> to be relocatable.
>
> In our use of the COIN packages, we generate static (.a) libraries that 
> we link against our own code to produce our own dynamic libraries. 
> However, we get an error:
>
> /usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld: 
> /vol/Eclipse/thirdparty/coinnew/x86_64_linux/lib/libOsiClp.a(OsiClpSolverInterface.o): 
> relocation R_X86_64_32 against `a local symbol' can not be used when 
> making a shared object; recompile with -fPIC
>
>
> The -fPIC flag is not added by the COIN configure script (at least for 
> the Cbc trunk branch that I downloaded on 27 April). I run the configure 
> script with the --enable-static option. Looking at the script, it seems 
> to do a lot of testing to determine if -fPIC is needed. Should these 
> tests set the -fPIC flag in my case? I can (and will) do it manually, 
> but it seems to be better if it could be detected automatically.
>
> Thanks and cheers,
>
> Kish
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>



More information about the Coin-discuss mailing list