I am trying to build openmpi so that mpicc does not require me to set up
the compiler's environment, and so that any executables built with mpicc
can run without my having to point LD_LIBRARY_PATH to the openmpi lib
directory. I made some unsuccessful attempts to accomplish this (which I
describe below), but after building openmpi using the Intel compiler, I
found the following:

1) When typing "<path-to-mpicc>/mpicc -showme" I get:
<path-to-mpicc>/mpicc: error while loading shared libraries: libsvml.so:
cannot open shared object file: No such file or directory

I then set LD_LIBRARY_PATH to point to the Intel compiler libraries, and
now "-showme" works, and returns:
icc -I/usr/local/openmpi-1.1.2-intel/include
-I/usr/local/openmpi-1.1.2-intel/include/openmpi -pthread
-L/usr/local/openmpi-1.1.2-intel/lib -L/usr/ofed/lib -L/usr/ofed/lib64
-lmpi -lorte -lopal -libverbs -lrt -lpbs -lnsl -lutil

However...

2) When typing "<path-to-mpicc>/mpicc hello.c" I now get:
------------------------------------------------------------------------
--
The Open MPI wrapper compiler was unable to find the specified compiler
icc in your PATH.

Note that this compiler was either specified at configure time or in
one of several possible environment variables.
------------------------------------------------------------------------
--

Of course, this is due to the fact that -showme indicates that mpicc
invokes "icc" instead of "<path-to-icc>/icc". If I now set up the PATH
to the Intel compiler, it works. However...

3) When I try to run the executable thus created, I get:
./a.out: error while loading shared libraries: libmpi.so.0: cannot open
shared object file: No such file or directory

I now need to set LD_LIBRARY_PATH to point to the openmpi lib directory.
-------------------------------------------------------
-------------------------------------------------------

To avoid problems (1) and (2), I built openmpi with:
export CC=/opt/intel/cce/latest/bin/icc
export CXX=/opt/intel/cce/latest/bin/icpc
export F77=/opt/intel/fce/latest/bin/ifort
export FC=/opt/intel/fce/latest/bin/ifort
export
LDFLAGS="-Wl,-rpath,/opt/intel/cce/latest/lib,-rpath,/opt/intel/fce/late
st/lib"

But while this satisfied the configure script and all its tests, it did
not produce the results I hoped for.

To avoid problem (3), I added the following option to configure:
--with-wrapper-ldflags=-Wl,-rpath,/usr/local/openmpi-1.1.2-intel/lib

I was hoping "-showme" would add this to its parameters, but no such
luck. Looking at the build output, it seems that the
--with-wrapper-ldflags parameter seems to be parsed differently from how
LDFLAGS gets parsed, and I get a compilation line:
/opt/intel/cce/latest/bin/icc -O3 -DNDEBUG -fno-strict-aliasing -pthread
-Wl,-rpath -Wl,/opt/intel/cce/latest/lib -Wl,-rpath
-Wl,/opt/intel/fce/latest/lib -o .libs/opal_wrapper opal_wrapper.o
../../../opal/.libs/libopal.so -lnsl -lutil -Wl,--rpath
-Wl,/usr/local/openmpi-1.1.2-intel/lib

Notice that the rpath preceding the openmpi lib directory is specified
as "--rpath", which is probably why it is ignored. Is this perhaps a
bug?

Can you help me accomplish any or all of these goals?

Thanks.

Dennis McRitchie
Computational Science and Engineering Support (CSES)
Academic Services Department
Office of Information Technology
Princeton University

Reply via email to