[Coin-discuss] Missing flags when building COIN projects on x86_64 (AMD64)?

Kish Shen kish.shen at crosscoreop.com
Fri Nov 24 19:24:53 EST 2006


Hi,

I have ran into some problems with a Cbc built on x86_64 (or more precisely, the AMD64 variant)
Linux with the standard configure and make:

the main problem is during compilation of the Coin libraries, the flag -fPIC is needed to get gcc 
to generate PIC (Position Independent Code). PIC is needed because we link the Coin libraries 
(.so, .a and .o) into our own dynamic (.so) library,  i.e. we are doing something like

gcc -shared mycode.o -lCbc -o mylib.so

I get an error saying that -fPIC is needed. 

I worked around this by giving extra flags during configure:

configure --enable-static CFLAGS="-fPIC" CXXFLAGS="-fPIC"

However, it would be nice if configure could detect this automatically and add the flags 
automatically. [the -fPIC flag can be given even if the resulting code is not linked to produce
.so files]

On a related topic -- the same AMD64 processor I used had SunOS (Solaris) installed on
it previously, and for our own code, in addition to the -fPIC flag, we needed -m64 for both
compiling and linking to get the 64 bit code to be generated (otherwise 32 bit code is generated
by default). Here we would need to configure as follow:

configure --enable-static CFLAGS="-fPIC -m64" CXXFLAGS="-fPIC -m64" LDFLAGS="-m64"

Again, it would be useful if these can be generated automatically by configure. [the -m64 flag
can also be given for the x86_64 Linux, but is not needed]

While I was compiling Cbc, I think the same issue applies to other COIN project (I have tried
SYMPHONY). 

--Kish Shen



More information about the Coin-discuss mailing list