[Coin-discuss] Missing flags when building COIN projects on x86_64 (AMD64)?
Kish Shen
kish.shen at crosscoreop.com
Tue Nov 28 20:03:25 EST 2006
Hi Andreas,
Thanks for your reply and help -- configuring with both --enable-static and --enable-shared
does cause the -fPIC flag to be used.
On Tuesday 28 November 2006 21:06, Andreas Waechter wrote:
> Hi Kish,
>
> I guess I can say a little bit about this:
>
> We are using the GNU facility "libtool" to find out about flags for
> compiling and linking libraries.
>
> Libtool does correctly set the PIC flags on all supported platforms, when
> it compiles code for shared libraries. In fact, if you run configure with
> both --enable-static and --enable-shared, each source file is compiled
> twice, once for the a static archive and once for a shared library.
>
> If you would use the COIN makefiles etc to create the shared libraries for
> the individual COIN projects, everything should work fine for you.
> However, I assume that you don't want to do this, because you don't want
> to have everything collected into your own shared library?
>
I am not quite sure if I understood you correctly, but I do use the COIN makefile to
generate the shared and static libraries for the COIN projects, and I then copy the static
files (.a) to where I would link my own code to create my own shared library, so essentially
I did something like:
in the toplevel directory of the COIN project:
./configure --enable-static
make
make install
cp lib/*.a ~/mylib
Both dynamic and static files are generated with the --enable-static option alone, but it seems
the files are not compiled without the -fPIC flag in this case. I had just assumed that dynamic
files are compiled by default, and no flag need to be specified.
Adding the --enable-shared flag solve the problem, but I am still somewhat puzzled by the above
behaviour.
On a related topic, on what looks like a minor problem when I link the COIN static .a libraries
into my own code, I get lots of warning messages like:
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: `.gnu.linkonce.t._Z9CoinZeroNIiEvPT_i' referenced in section `.rodata' of /vol/Eclipse/thirdparty/coin/i386_linux/lib/libCoinUtils.a(CoinPresolveMatrix.o): defined in discarded section `.gnu.linkonce.t._Z9CoinZeroNIiEvPT_i' of /vol/Eclipse/thirdparty/coin/i386_linux/lib/libCoinUtils.a(CoinPresolveMatrix.o)
/usr/lib/gcc-lib/i586-suse-linux/3.3.5/../../../../i586-suse-linux/bin/ld: `.gnu.linkonce.t._Z9CoinZeroNIiEvPT_i' referenced in section `.rodata' of /vol/Eclipse/thirdparty/coin/i386_linux/lib/libCoinUtils.a(CoinPresolveMatrix.o): defined in discarded section `.gnu.linkonce.t._Z9CoinZeroNIiEvPT_i' of /vol/Eclipse/thirdparty/coin/i386_linux/lib/libCoinUtils.a(CoinPresolveMatrix.o)
but my shared library is generated, and it seems to work. Should I worry about these warnings,
and is there anyway of avoiding them?
Thanks and cheers,
Kish
More information about the Coin-discuss
mailing list