On 11/02/2012 12:38 PM, Bob Friesenhahn wrote:
On Thu, 1 Nov 2012, Leek, Jim wrote:
I'm using libtool 2.4.2 on IBM's BG/Q platform with the xlC
compiler. In general it is working fairly well, but I
have one issue. Unlike most Linux systems, on BG/Q static linking is
the default, and in order to link an executable
dynamically you must pass the flags: -qnostaticlink
-qnostaticlink=libgcc
So, the library builds both statically and dynamically just fine, but
when I try to build the test binary, libtool
does not pass those two flags, so the binary build fails. If I copy
the build line and add the two flags, the binary
links dynamically.
How can I get libtool to pass those flags only when I want to build
the binary dynamically? So far I've only found
the place where I can put flags to make libtool build the binary
statically.
You might obtain some joy from
'LDFLAGS=-Wl,-qnostaticlink -Wl,-qnostaticlink=libgcc'
So, embarrassingly, something like this actually worked. Embarrassingly
because I thought I had tried it. Since BG/Q is a very new platform
with it's share of quirks, autoconf/libtool doesn't completely work on
it yet. Below a quick write up on what I found worked. I ran into a
number of issues that I don't have time to work on now, so I just
documented them.
These notes only apply to libtool 2.4.2 and, AFAIK, the BG/Q machine at
LLNL as of November 1, 2012. I hope it's helpful to someone else, but I
don't claim it will be correct in any other circumstances.
---------------------------
Installation
---------------------------
The basic GNU configure;make;make install works with this package,
with a few caveats.
If you are building on an x86/amd64 Linux machine follow those
directions. If you are building on BG/Q, skip down to the BG/Q
SEQUOIA section.
---------------------
x86/amd64 Linux
---------------------
This package requires MPI, so you must configure --with-mpi.
--with-mpi will search for an mpi script such as mpiCC or mpicxx,
etc.
If you want to specify a specific script, say 'mpicxx' use:
configure --with-mpi=mpicxx
So, a configure line like this will work fine:
./configure --with-mpi=mpicxx --prefix=<INSTALL DIR>
Aside from that, just make all check install installcheck, etc. should
all work.
----------------------
BG/Q SEQUOIA notes:
----------------------
BG/Q requires a cross-compile, and has all the issues that implies.
The first issue is that libtool gets too friendly with gcc, so you're
better off using the xlC compiler. If you use the mpigcc compiler
libtool will discover all the libraries the the mpigcc script links to
and call them dependency_libs. So, it will attempt to link them into
the test binaries as well. Unfortunately, that doesn't work. In this
case we need to trust the mpi compiler scripts. Since I don't know
how to disable this behavior in libtool, for now stick with mpixlcxx.
Also, since we're cross-compiling anyway, you don't need to use
--with-mpi. So this is the configure line you want:
./configure --host=powerpc-bgq-linux CXX=/usr/local/bin/mpixlcxx
--prefix=<INSTALL DIR>
then you can run make all install as usual.
Tests:
If you want to run tests on Sequoia there are a couple of additional
notes. First decide if you want to test a static build or a
shared/dyanmic build. If static fine, just use this configure line
and a static library will build and make check and installcheck will
work fine.
./configure --host=powerpc-bgq-linux CXX=/usr/local/bin/mpixlcxx
--prefix=<INSTALL DIR> --enable-shared=no
If you want test shared libraries on BG/Q, you must do the following.
First, you MUST install the libraries, so set a reasonable prefix.
Also, you must pass in a couple of special LDFLAGS, so use this
configure line:
./configure --host=powerpc-bgq-linux CXX=/usr/local/bin/mpixlcxx
CXXFLAGS=-I/usr/include --prefix=<INSTALL DIR> LDFLAGS="-qnostaticlink
-qnostaticlink=libgcc"
Next, make check doesn't work because libtools magic script does
something wrong with the dynamic libraries. (I'm not sure what's
going wrong. The binary seems to build OK, but fails to launch.) So you must
use installcheck:
make all install installcheck
All tests should pass.
Jim
_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool