Shouldn't mpicc always link system libraries (like -ldl and -lsysfs)
dynamically?

Scott Weitzenkamp
SQA and Release Manager
Server Virtualization Business Unit
Cisco Systems


> -----Original Message-----
> From: users-boun...@open-mpi.org 
> [mailto:users-boun...@open-mpi.org] On Behalf Of Josh England
> Sent: Friday, October 13, 2006 3:53 PM
> To: Open MPI Users
> Subject: [OMPI users] problem building static w/ 1.1.2_rc4
> 
> Hi,
> 
> I'm trying to statically compile a simple program, but have run into
> some difficulties so far.  Trying with my own link line I get many
> complaints about symbols being redefined:
> 
> [root@dlogin2 examples]# gcc -static -o cpi cpi.c
> -I/apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/include
> -L/apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib
> -L/apps/torque/lib -L/usr/ofed/lib64 -lmpi -lopal -ldl -lpthread -lrt
> -lorte -lopal -ltorque -lutil -libverbs -lsysfs -lm
> 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(ltdl.o)(.text+0x2ef): 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
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> liborte.a(sys_info.o)(.text+0xa2): In function `orte_sys_info':
> : warning: Using 'getpwuid' in statically linked applications requires
> at runtime the shared libraries from the glibc version used 
> for linking
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(if.o)(.text+0x5d9): In function `opal_ifaddrtoname':
> : warning: Using 'gethostbyname' 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.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x1880): In function `free':
> : multiple definition of `free'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x3a8a): first defined here
> /usr/bin/ld: Warning: size of symbol `free' changed from 231
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 255 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x38d0): In function `malloc':
> : multiple definition of `malloc'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x2fd5): first defined here
> /usr/bin/ld: Warning: size of symbol `malloc' changed from 319
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 461 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x3fb0): In function `realloc':
> : multiple definition of `realloc'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x3b71): first defined here
> /usr/bin/ld: Warning: size of symbol `realloc' changed from 448
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 783 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x4c0): In function `_int_new_arena':
> : multiple definition of `_int_new_arena'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x352): first defined here
> /usr/bin/ld: Warning: size of symbol `_int_new_arena' changed from 242
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 224 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0xff0): In function `_int_free':
> : multiple definition of `_int_free'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x113a): first defined here
> /usr/bin/ld: Warning: size of symbol `_int_free' changed from 856
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 1897 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x1980): In function `_int_malloc':
> : multiple definition of `_int_malloc'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x1b0a): first defined here
> /usr/bin/ld: Warning: size of symbol `_int_malloc' changed from 3193
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 3548 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x2840): In function `_int_memalign':
> : multiple definition of `_int_memalign'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x28b9): first defined here
> /usr/bin/ld: Warning: size of symbol `_int_memalign' changed from 464
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 524 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x2a50): In function `_int_valloc':
> : multiple definition of `_int_valloc'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x3d71): first defined here
> /usr/bin/ld: Warning: size of symbol `_int_valloc' changed from 69
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 71 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x2c10): In function `_int_realloc':
> : multiple definition of `_int_realloc'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x2cd8): first defined here
> /usr/bin/ld: Warning: size of symbol `_int_realloc' changed from 765
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 1273 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)(.text+0x42c0): In function `__malloc_check_init':
> : multiple definition of `__malloc_check_init'
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o)(.text+0x631): first defined here
> /usr/bin/ld: Warning: size of symbol `__malloc_check_init' 
> changed from
> 141
> in 
> /apps/x86_64/mpi/openmpi/gcc-3.4.6/openmpi-1.1.2_rc4-ofed/lib/
> libopal.a(lt1-malloc.o) to 164 in 
> /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libc.
> a(malloc.o)
> collect2: ld returned 1 exit status
> 
> 
> When I try mpicc, its seemingly unable to find some symbols, 
> even when I
> add the right library:
> 
> [root@dlogin2 examples]# mpicc -static -o cpi cpi.c 
> -L/usr/lib64 -lsysfs
> ...
> ...  Same 'multiple definition' stuff as above, followed by:
> ...
> /usr/ofed/lib64/libibverbs.a(src_libibverbs_la-init.o)(.text+0
> x23b): In
> function `ibverbs_init':
> : undefined reference to `sysfs_open_class'
> /usr/ofed/lib64/libibverbs.a(src_libibverbs_la-init.o)(.text+0
> x2d0): In
> function `ibverbs_init':
> : undefined reference to `sysfs_get_class_devices'
> /usr/ofed/lib64/libibverbs.a(src_libibverbs_la-init.o)(.text+0
> x2e4): In
> function `ibverbs_init':
> : undefined reference to `dlist_start'
> /usr/ofed/lib64/libibverbs.a(src_libibverbs_la-init.o)(.text+0
> x2f1): In
> function `ibverbs_init':
> : undefined reference to `_dlist_mark_move'
> /usr/ofed/lib64/libibverbs.a(src_libibverbs_la-init.o)(.text+0
> x334): In
> function `ibverbs_init':
> : undefined reference to `sysfs_open_class_device'
> collect2: ld returned 1 exit status
> 
> [root@dlogin2 examples]# nm /usr/lib64/libsysfs.a |grep
> sysfs_open_class_device
> 
> 0000000000000d60 T sysfs_open_class_device
> 0000000000000170 T sysfs_open_class_device_path
> 
> 
> I configured ompi with '--with-openib=/usr/ofed --with-tm=/apps/torque
> --enable-static --without-libnuma' .
> 
> Is there something I missed doing in order to be able to 
> compile static
> binaries?  Any help is greatly appreciated.
> 
> -JE
> 
> -- 
> 
> -----------------------------------------------
> Josh England
> Sandia National Laboratory, Albuquerque, NM
> Infrastructure Computing Systems
> email: jjen...@sandia.gov
> phone: (505) 284-0963
> 
> 
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users
> 

Reply via email to