By default, LAM/MPI does a few things that are un-friendly to static
linking, including using some pthreads calls, using dlopen, and
playing some linker tricks. I'd recommend compiling LAM/MPI with the
options:
--without-threads --without-memory-manager
You'll still likely get some warnings about dlopen() and gethostbyname
(), but those are mostly harmless.
Brian
On Dec 27, 2007, at 12:34 PM, Sourangshu Bhattacharya wrote:
> Dear Everybody,
>
> I was trying to compile my program into a static binary with lam/mpi.
> The program compiles perfectly when compiled without the static
> switch. However, it gives the following errors when trying to compile
> with the -static switch.
>
> I have seen a similar query on this mailing list, but no satisfactory
> replies. Please let me know if someone has faced a similar problem and
> succeded in solving it.
>
> Thank you.
> Regards,
> Sourangshu
> -------------------------------------------------------
> [sourangshu_at_ramanujan parcode]$ make kernel
> mpicc -static -I
> /home/sourangshu/experiments/lib/gsl/gsl-install//include -I
> /home/sourangshu/experiments/lib/glpk/glpk-install//include -L
> /home/sourangshu/experiments/lib/gsl/gsl-install//lib -L
> /home/sourangshu/experiments/lib/glpk/glpk-install//lib -c -o main.o
> main.c
> mpicc -static -I
> /home/sourangshu/experiments/lib/gsl/gsl-install//include -I
> /home/sourangshu/experiments/lib/glpk/glpk-install//include -L
> /home/sourangshu/experiments/lib/gsl/gsl-install//lib -L
> /home/sourangshu/experiments/lib/glpk/glpk-install//lib -c -o
> fullstr.o fullstr.c
> mpicc -static -I
> /home/sourangshu/experiments/lib/gsl/gsl-install//include -I
> /home/sourangshu/experiments/lib/glpk/glpk-install//include -L
> /home/sourangshu/experiments/lib/gsl/gsl-install//lib -L
> /home/sourangshu/experiments/lib/glpk/glpk-install//lib -c -o substr.o
> substr.c
> mpicc -static -I
> /home/sourangshu/experiments/lib/gsl/gsl-install//include -I
> /home/sourangshu/experiments/lib/glpk/glpk-install//include -L
> /home/sourangshu/experiments/lib/gsl/gsl-install//lib -L
> /home/sourangshu/experiments/lib/glpk/glpk-install//lib -c -o
> substrlimitker.o substrlimitker.c
> mpicc -static -I
> /home/sourangshu/experiments/lib/gsl/gsl-install//include -I
> /home/sourangshu/experiments/lib/glpk/glpk-install//include -L
> /home/sourangshu/experiments/lib/gsl/gsl-install//lib -L
> /home/sourangshu/experiments/lib/glpk/glpk-install//lib -c -o eig.o
> eig.c
> mpicc -static -I
> /home/sourangshu/experiments/lib/gsl/gsl-install//include -I
> /home/sourangshu/experiments/lib/glpk/glpk-install//include -L
> /home/sourangshu/experiments/lib/gsl/gsl-install//lib -L
> /home/sourangshu/experiments/lib/glpk/glpk-install//lib -o kernel
> main.o fullstr.o substr.o substrlimitker.o eig.o \
> /home/sourangshu/experiments/lib/CLAPACK//tmglib_LINUX.a \
> /home/sourangshu/experiments/lib/CLAPACK//lapack_LINUX.a
> /home/sourangshu/experiments/lib/CLAPACK//blas_LINUX.a \
> /home/sourangshu/experiments/lib/CLAPACK//libF77.a
> /home/sourangshu/experiments/lib/CLAPACK//libI77.a \
> -lgsl -lgslcblas -lglpk -lm -lc
> /opt/lam/gnu/lib/liblam.a(ltdl.o)(.text+0x472): In function
> `sys_dl_open':
> : warning: Using 'dlopen' in statically linked applications requires
> at runtime the shared libraries from the glibc version used for
> linking
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)(.text+0x0):
> In function `flockfile':
> : multiple definition of `_IO_flockfile'
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (flockfile.o)(.text+0x0):
> first defined here
> /usr/bin/ld: Warning: size of symbol `_IO_flockfile' changed from 24
> in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (flockfile.o)
> to 12 in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)(.text+0x0):
> In function `flockfile':
> : multiple definition of `__flockfile'
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (flockfile.o)(.text+0x0):
> first defined here
> /usr/bin/ld: Warning: size of symbol `__flockfile' changed from 24 in
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (flockfile.o)
> to 12 in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)(.text+0x10):
> In function `funlockfile':
> : multiple definition of `_IO_funlockfile'
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (funlockfile.o)(.text+0x0):
> first defined here
> /usr/bin/ld: Warning: size of symbol `_IO_funlockfile' changed from 24
> in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (funlockfile.o)
> to 12 in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)(.text+0x10):
> In function `funlockfile':
> : multiple definition of `__funlockfile'
> /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (funlockfile.o)(.text+0x0):
> first defined here
> /usr/bin/ld: Warning: size of symbol `__funlockfile' changed from 24
> in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/libc.a
> (funlockfile.o)
> to 12 in /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../lib64/
> libpthread.a(lockfile.o)
> /opt/lam/gnu/lib/liblam.a(kill.o)(.text+0x595): In function
> `lam_tmpdir_init_opt':
> : warning: Using 'getpwuid' in statically linked applications requires
> at runtime the shared libraries from the glibc version used for
> linking
> /opt/lam/gnu/lib/liblam.a(lam_gethostby.o)(.text+0x11): In function
> `lam_gethostbyaddr':
> : warning: Using 'gethostbyaddr' in statically linked applications
> requires at runtime the shared libraries from the glibc version used
> for linking
> /opt/lam/gnu/lib/liblam.a(lam_gethostby.o)(.text+0x1): In function
> `lam_gethostbyname':
> : warning: Using 'gethostbyname' in statically linked applications
> requires at runtime the shared libraries from the glibc version used
> for linking
> collect2: ld returned 1 exit status
> mpicc: No such file or directory
> make: *** [kernel] Error 1
>
>
> --
> "I have never taken any exercise except sleeping and resting." -
> Mark Twain
>
> Sourangshu Bhattacharya
> PhD Student,
> Dept. of Computer Science & Automation,
> Indian Institute of Science,
> Bangalore, India.
>
> http://people.csa.iisc.ernet.in/sourangshu
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
--
Brian Barrett
LAM/MPI Developer
Make today a LAM/MPI day!
|