[openib-general] [PATH] problem dlopen libibverbs.so

Gleb Natapov glebn at voltaire.com
Wed Jul 20 06:56:33 PDT 2005


Hello,

 There is a problem with ibverbs library if it is not linked with an
application but dynamically loaded by the application in runtime by
dlopen(). It can't load userspace device-specific driver in later case.

Two programs are attached to demonstrate the problem. Compile first one
with:
$ gcc -libverbs linked.c -o linked
Compile second one with:
$ gcc dlopened.c -ldl -o dlopened

$ ./linked
Found 1 devices
$ ./dlopened
libibverbs: Warning: no userspace device-specific driver found for uverbs0
        driver search path: /usr/local/lib/infiniband
Found 0 devices

It appears that libmthca relies on back linking to find symbols from
libibverbs but back linking doesn't work in the later case.

I linked libmthca with libibverbs and this solved the problem.


Index: src/userspace/libmthca/Makefile.am
===================================================================
--- src/userspace/libmthca/Makefile.am	(revision 2885)
+++ src/userspace/libmthca/Makefile.am	(working copy)
@@ -13,7 +13,7 @@
 endif
 
 src_mthca_la_SOURCES = src/ah.c src/cq.c src/memfree.c src/mthca.c src/qp.c src/verbs.c
-src_mthca_la_LDFLAGS = -avoid-version -module \
+src_mthca_la_LDFLAGS = -avoid-version -module -libverbs\
     $(mthca_version_script)
 
 DEBIAN = debian/changelog debian/compat debian/control debian/copyright \
--
			Gleb.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linked.c
Type: text/x-csrc
Size: 237 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050720/0e61a844/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlopened.c
Type: text/x-csrc
Size: 399 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050720/0e61a844/attachment-0001.c>


More information about the general mailing list