[openib-general] Re: [PATCH] rdma_lat-09 and results

Michael S. Tsirkin mst at mellanox.co.il
Sat Jun 4 11:12:37 PDT 2005


Quoting r. Grant Grundler <iod00d at hp.com>:
> Subject: Re: [PATCH] rdma_lat-09 and results
> 
> On Fri, Jun 03, 2005 at 02:45:19AM +0300, Michael S. Tsirkin wrote:
> ...
> > Its possible to link libibverbs and libmthca statically.
> > I did it once.
> 
> While I can get "mthca.a" to link statically, I get warnings
> and the binary doesn't work.
> 
> -LOADLIBES += -libverbs
> +LOADLIBES += -static -libverbs -lpthread -lsysfs -ldl
> 
> $ make
> cc -Wall -O2 -g -D_GNU_SOURCE     rdma_lat.c get_clock.c -static -libverbs -lpthread -lsysfs -ldl -L/usr/lib/infiniband/ -lmthca  -o rdma_lat
> /usr/lib/gcc-lib/ia64-linux/3.3.5/../../../libibverbs.a(src_libibverbs_la-init.o)(.text+0x22): In function `load_driver':
> : warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
> /tmp/ccxfeerJ.o(.text+0x132): In function `pp_connect_sock':
> /home/src/openib_gen2/src/userspace/perftest/rdma_lat.c:120: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
> ...
> $ ldd rdma_lat
>         not a dynamic executable
> grundler at gsyprf3$ taskset 1 ./rdma_lat -C -n 100000
> libibverbs: Warning: no userspace device-specific driver found for uverbs0
>         driver search path: /usr/lib/infiniband
> 	No IB devices found
> 	Segmentation fault
> 
> Sounds like libibverbs *must* dynamically load mthca.so in order to operate.
> I'll look at libibverbs source but this smells like a rat hole.

libibverbs uses dlsym(openib_driver_init) to get entry point into low level
driver.

dlsym documentation says:

If the executable was linked with
the flag "-rdynamic", then the global symbols in  the  executable will
also be used to resolve references in a dynamically loaded library.

So you need to link with -rdynamic.
Maybe you also shall list mthca.a on linker's command line,
and pass in -u openib_driver_init, I dont remember, exactly.


-- 
MST



More information about the general mailing list