1

I'm trying to cross compile MPICH and statically link libraries using the following commands:

export CC="/buildroot-2015.02/output/host/usr/bin/arm-linux-gcc"
export CFLAGS="-march=armv5te -I/buildroot-2015.02/output/host/usr/include/"
export LDFLAGS="--static -L//buildroot-2015.02/output/host/usr/lib/"
./configure --prefix=/mpich-3.1.3/build/ --host=arm-linux  --disable-shared --with-pm=hydra --with-device=ch3:nemesis --disable-fortran

After building I tried file mpiexec and I got the following:

mpiexec: symbolic link to `mpiexec.hydra'
$ file mpiexec.hydra
mpiexec.hydra: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

I want know how to link MPICH statically.

Wesley Bland
  • 8,816
  • 3
  • 44
  • 59
Doha
  • 325
  • 2
  • 13
  • what about ``ldd mpiexec.hydra` – Severin Pappadeux Aug 18 '15 at 02:03
  • @SeverinPappadeux yes I have libmpi.a in the lib folder . the result of ldd mpiexec.hydra: not a dynamic executable – Doha Aug 19 '15 at 21:09
  • Well, if `ldd` tells you `not a dynamic executable`, you've reached your goal, congratulations – Severin Pappadeux Aug 20 '15 at 01:14
  • No, I'll take it back. If it is cross-compile, and your native `ldd` is different from target, you'll get no dependencies. Ok, next thing to try is `readelf`. Basically, you should check if your app required any shared libs. `readelf` should work on non-native bins. Something along the line `readelf -a mpiexec.hydra | grep NEEDED` – Severin Pappadeux Aug 20 '15 at 01:53
  • @SeverinPappadeux I have tried `readelf -a mpiexec.hydra | grep NEEDED` 0x00000001 (NEEDED) Shared library: [libnsl.so.0] 0x00000001 (NEEDED) Shared library: [libpthread.so.0] 0x00000001 (NEEDED) Shared library: [libm.so.0] 0x00000001 (NEEDED) Shared library: [libc.so.0] I think that the problem is in the buildroot generated files – Doha Aug 23 '15 at 23:33
  • yes, it is clearly shared executable depending on several shared libraries – Severin Pappadeux Aug 24 '15 at 03:15

0 Answers0