Hi,

I have problems linking the an MPI program with an external shared library in MPICH3.1 on Vesta BGQ. The error message I get is:

 mpicc  -g -Wall -fPIC -Wextra  -I.  -c hello.c  -o hello.o
mpicc  -g -Wall -fPIC -Wextra  -I.  -c dyn_lib.c  -o dyn_lib.o
mpicc  -shared -Wl,-soname,libdyn_lib.so  -o libdyn_lib.so dyn_lib.o
mpicc  -g -Wall -fPIC -Wextra  -I.  -o hello hello.o  -dynamic  -Wl,-rpath, -L. -ldyn_lib 
/bgsys/drivers/toolchain/V1R2M2_base-efix014/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.7/../../../../powerpc64-bgq-linux/bin/ld: hello: hidden symbol `__dso_handle' in /bgsys/drivers/toolchain/V1R2M2_base-efix014/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.7/crtbegin.o is referenced by DSO
/bgsys/drivers/toolchain/V1R2M2_base-efix014/gnu-linux/lib/gcc/powerpc64-bgq-linux/4.4.7/../../../../powerpc64-bgq-linux/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [hello] Error 1

The problem seems to be caused by a __dso_handle symbol in the MPICH library (both in static and dynamic libraries), but I do not know what the solution is:

[fisaila@vestalac2 lib]$ nm libmpich.so | grep __dso_handle
                 U __dso_handle


My MPICH3.1 is configured with:
./configure --prefix=/home/fisaila/software/mpich-3.1-THR_MULT-nodebug-install2rpath --host=powerpc64-bgq-linux --with-device=pamid --with-file-system=bg+bglockless --enable-thread-cs=per-object --with-atomic-primitives --enable-handle-allocation=tls --enable-refcount=lock-free --disable-predefined-refcount CC=powerpc64-bgq-linux-gcc

Any suggestion is welcome

Thanks
Florin