Here's how libtool is called at build time, that is, at the point where it creates the libmpi.la file, as well as the synthetized gcc command line.
(sorry, loong line) /bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -O3 -DNDEBUG -finline-functions -fno-strict-aliasing -pthread -version-info 12:2:0 -o libmpi.la -rpath /tmp/test2/lib class/ompi_free_list.lo class/ompi_rb_tree.lo class/ompi_seq_tracker.lo attribute/attribute.lo attribute/attribute_predefined.lo communicator/comm_init.lo communicator/comm.lo communicator/comm_cid.lo communicator/comm_request.lo communicator/comm_helpers.lo errhandler/errhandler.lo errhandler/errhandler_invoke.lo errhandler/errhandler_predefined.lo errhandler/errcode.lo errhandler/errcode-internal.lo file/file.lo group/group.lo group/group_init.lo group/group_set_rank.lo group/group_plist.lo group/group_sporadic.lo group/group_strided.lo group/group_bitmap.lo info/info.lo message/message.lo op/op.lo proc/proc.lo request/grequest.lo request/request.lo request/req_test.lo request/req_wait.lo runtime/ompi_mpi_abort.lo runtime/ompi_mpi_init.lo runtime/ompi_mpi_finalize.lo runtime/ompi_mpi_params.lo runtime/ompi_mpi_preconnect.lo runtime/ompi_cr.lo runtime/ompi_module_exchange.lo runtime/ompi_info_support.lo win/win.lo mpiext/mpiext.lo patterns/net/netpatterns_base.lo patterns/net/netpatterns_multinomial_tree.lo patterns/net/netpatterns_nary_tree.lo patterns/net/netpatterns_knomial_tree.lo patterns/comm/allreduce.lo patterns/comm/allgather.lo patterns/comm/bcast.lo datatype/libdatatype.la debuggers/libdebuggers.la mpi/c/libmpi_c.la mpi/tool/libmpi_mpit_common.la mpi/c/profile/libmpi_c_pmpi.la mpi/tool/profile/libmpi_pmpit.la mca/common/verbs_usnic/libmca_common_verbs_usnic.la mca/allocator/libmca_allocator.la mca/bcol/libmca_bcol.la mca/bml/libmca_bml.la mca/btl/libmca_btl.la mca/coll/libmca_coll.la mca/crcp/libmca_crcp.la mca/dpm/libmca_dpm.la mca/fbtl/libmca_fbtl.la mca/fcoll/libmca_fcoll.la mca/fs/libmca_fs.la mca/io/libmca_io.la mca/mpool/libmca_mpool.la mca/mtl/libmca_mtl.la mca/op/libmca_op.la mca/osc/libmca_osc.la mca/pml/libmca_pml.la mca/pml/v/libmca_pml_v.la mca/pubsub/libmca_pubsub.la mca/rcache/libmca_rcache.la mca/rte/libmca_rte.la mca/rte/orte/libmca_rte_orte.la mca/sbgp/libmca_sbgp.la mca/sharedfp/libmca_sharedfp.la mca/topo/libmca_topo.la mca/vprotocol/libmca_vprotocol.la /tmp/openmpi-1.10.2/orte/libopen-rte.la /tmp/openmpi-1.10.2/opal/libopen-pal.la -lrt -lm -lutil libtool: link: gcc -std=gnu99 -shared -fPIC -DPIC class/.libs/ompi_free_list.o class/.libs/ompi_rb_tree.o class/.libs/ompi_seq_tracker.o attribute/.libs/attribute.o attribute/.libs/attribute_predefined.o communicator/.libs/comm_init.o communicator/.libs/comm.o communicator/.libs/comm_cid.o communicator/.libs/comm_request.o communicator/.libs/comm_helpers.o errhandler/.libs/errhandler.o errhandler/.libs/errhandler_invoke.o errhandler/.libs/errhandler_predefined.o errhandler/.libs/errcode.o errhandler/.libs/errcode-internal.o file/.libs/file.o group/.libs/group.o group/.libs/group_init.o group/.libs/group_set_rank.o group/.libs/group_plist.o group/.libs/group_sporadic.o group/.libs/group_strided.o group/.libs/group_bitmap.o info/.libs/info.o message/.libs/message.o op/.libs/op.o proc/.libs/proc.o request/.libs/grequest.o request/.libs/request.o request/.libs/req_test.o request/.libs/req_wait.o runtime/.libs/ompi_mpi_abort.o runtime/.libs/ompi_mpi_init.o runtime/.libs/ompi_mpi_finalize.o runtime/.libs/ompi_mpi_params.o runtime/.libs/ompi_mpi_preconnect.o runtime/.libs/ompi_cr.o runtime/.libs/ompi_module_exchange.o runtime/.libs/ompi_info_support.o win/.libs/win.o mpiext/.libs/mpiext.o patterns/net/.libs/netpatterns_base.o patterns/net/.libs/netpatterns_multinomial_tree.o patterns/net/.libs/netpatterns_nary_tree.o patterns/net/.libs/netpatterns_knomial_tree.o patterns/comm/.libs/allreduce.o patterns/comm/.libs/allgather.o patterns/comm/.libs/bcast.o -Wl,--whole-archive datatype/.libs/libdatatype.a debuggers/.libs/libdebuggers.a mpi/c/.libs/libmpi_c.a mpi/tool/.libs/libmpi_mpit_common.a mpi/c/profile/.libs/libmpi_c_pmpi.a mpi/tool/profile/.libs/libmpi_pmpit.a mca/common/verbs_usnic/.libs/libmca_common_verbs_usnic.a mca/allocator/.libs/libmca_allocator.a mca/bcol/.libs/libmca_bcol.a mca/bml/.libs/libmca_bml.a mca/btl/.libs/libmca_btl.a mca/coll/.libs/libmca_coll.a mca/crcp/.libs/libmca_crcp.a mca/dpm/.libs/libmca_dpm.a mca/fbtl/.libs/libmca_fbtl.a mca/fcoll/.libs/libmca_fcoll.a mca/fs/.libs/libmca_fs.a mca/io/.libs/libmca_io.a mca/mpool/.libs/libmca_mpool.a mca/mtl/.libs/libmca_mtl.a mca/op/.libs/libmca_op.a mca/osc/.libs/libmca_osc.a mca/pml/.libs/libmca_pml.a mca/pml/v/.libs/libmca_pml_v.a mca/pubsub/.libs/libmca_pubsub.a mca/rcache/.libs/libmca_rcache.a mca/rte/.libs/libmca_rte.a mca/rte/orte/.libs/libmca_rte_orte.a mca/sbgp/.libs/libmca_sbgp.a mca/sharedfp/.libs/libmca_sharedfp.a mca/topo/.libs/libmca_topo.a mca/vprotocol/.libs/libmca_vprotocol.a -Wl,--no-whole-archive -Wl,-rpath -Wl,/tmp/openmpi-1.10.2/orte/.libs -Wl,-rpath -Wl,/tmp/openmpi-1.10.2/opal/.libs -Wl,-rpath -Wl,/tmp/test2/lib -L/tmp/openmpi-1.10.2/opal/.libs /usr/lib/libosmcomp.so -libumad -lpthread -libverbs /tmp/openmpi-1.10.2/orte/.libs/libopen-rte.so /tmp/openmpi-1.10.2/opal/.libs/libopen-pal.so -lnuma -ldl -lrt -lm -lutil -O3 -pthread -pthread -Wl,-soname -Wl,libmpi.so.12 -o .libs/libmpi.so.12.0.2 The .la file which gets created by the libtool command line above is the one I attached in my answer to Jeff a minute ago. Things go wrong when libtool does the relink step using that file. E. On Sat, Feb 27, 2016 at 12:20 PM, Gilles Gouaillardet <gilles.gouaillar...@gmail.com> wrote: > Emmanuel, > > By any chance, does libosmcomp.la contains a -rpath line ? > > FWIW, you can simply > make V=1 > In order to see how libtool is invoked, and how it will invoke bcc > > Cheers, > > Gilles > > On Saturday, February 27, 2016, Emmanuel Thomé <emmanuel.th...@gmail.com> > wrote: >> >> Hi, >> >> Thanks for your answer. >> >> I have no LD_LIBRARY_PATH. I am not sure it should matter anyway, >> though: the objdump command looks at what the object file requests, >> not necessarily what happens at runtime as if we were using ldd. >> >> This seems to be related to the MOFED debian packages including a .la >> file for the stuff they install (which is against debian practice, >> although not exactly for the same reason: >> https://wiki.debian.org/ReleaseGoals/LAFileRemoval ). >> >> Specifically, I have /usr/lib/libosmcomp.la. If I delete that file, >> then no -L/usr/lib shows up in the relink command for libmpi; libtool >> just emits -losmcomp alone, which is fine. Then the subsequent >> -lopen-rte finds the one installed for the library being build, not >> the /usr one. >> >> It still does not look good that the libmpi.la file has the following: >> >> dependency_libs=' -losmcomp -libverbs >> /tmp/openmpi-1.10.2/orte/libopen-rte.la >> /tmp/openmpi-1.10.2/opal/libopen-pal.la -lnuma -ldl -lrt -lm -lutil' >> >> (here on a machine without /usr/lib/libosmcomp.la ; when the .la file >> exists, -loscomp is replaced by /usr/lib/libosmcomp.la). >> >> I have the impression that having -losmcomp -libverbs *after* the opal >> and orte .la files would be better. I don't see how to achieve this, >> though (just playing with ompi/Makefile.am at the moment, to no avail >> so far). >> >> E. >> >> On Sat, Feb 27, 2016 at 5:58 AM, Ralph Castain <r...@open-mpi.org> wrote: >> > Out of curiosity, do you have your version of OMPI at the _beginning_ of >> > your LD_LIBRARY_PATH? >> > >> >> On Feb 26, 2016, at 8:24 AM, Emmanuel Thomé <emmanuel.th...@gmail.com> >> >> wrote: >> >> >> >> On Fri, Feb 26, 2016 at 5:21 PM, Emmanuel Thomé >> >> <emmanuel.th...@gmail.com> wrote: >> >>> happens to have an openmpi-1.6.5 installation in /usr, as well as . >> >> >> >> Sorry for copy-paste failure. 1.6.5 is only in /usr, of course. >> >> >> >> E. >> >> _______________________________________________ >> >> users mailing list >> >> us...@open-mpi.org >> >> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >> >> Link to this post: >> >> http://www.open-mpi.org/community/lists/users/2016/02/28592.php >> > >> > _______________________________________________ >> > users mailing list >> > us...@open-mpi.org >> > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >> > Link to this post: >> > http://www.open-mpi.org/community/lists/users/2016/02/28595.php >> _______________________________________________ >> users mailing list >> us...@open-mpi.org >> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users >> Link to this post: >> http://www.open-mpi.org/community/lists/users/2016/02/28596.php > > > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2016/02/28597.php