Hi all,

I am having an automake / libtool problem and don't know how to solve it.

In libosmo-pfcp, there is the pfcp_test binary, which obviously requires
linking libosmo-pfcp.so -- more precisely, it should NOT link the system
installed libosmo-pfcp.so, but the locally built one, libosmo-pfcp.a.

I try to accomplish this by:

        pfcp_test_LDADD = \                             
                $(LIBOSMOCORE_LIBS) \                   
                $(top_builddir)/src/libosmo-pfcp/libosmo-pfcp.la \
                $(top_builddir)/src/libosmo-gtlv/libosmo-gtlv.la \
                $(NULL)                                 

https://cgit.osmocom.org/libosmo-pfcp/tree/tests/libosmo-pfcp/Makefile.am

I am now adding a new optional IE to libosmo-pfcp, and I found that this does
not work as expected! The pfcp_test binary is linked to the previously
installed libosmo-pfcp.so in /usr/local/lib, instead of the proper, new version
from the build tree. I found out by getting an obscure ABI corruption error,
verified it by:

        ~/osmo-dev/make/libosmo-pfcp/tests/libosmo-pfcp
        $ ldd .libs/pfcp_test
                [...]
                libosmo-pfcp.so.0 => /usr/local/lib/libosmo-pfcp.so.0 
(0x00007f1b6bc00000)
                libosmo-gtlv.so.0 => /usr/local/lib/libosmo-gtlv.so.0 
(0x00007f1b6cc0a000)
                [...]

As soon as I 'make uninstall' in libosmo-pfcp.git's root dir, this changes to:

        ▶ ldd .libs/pfcp_test 
                [...]
                libosmo-pfcp.so.0 => not found
                libosmo-gtlv.so.0 => not found
                [...]

and then the test succeeds (because './pfcp_test' is actually a shell script
generated by libtool with linker magic referencing the libs built within the
libosmo-pfcp.git tree).

Now I am at a loss:

How do I tell automake (libtool) to keep out the system installed .so and
prioritize the libs in the build tree?

I can work around this for me by doing 'make uninstall' every time the
libosmo-pfcp ABI changes, but I would much rather fix this, so that users
rebuilding a newer version pulled from git don't run into this obscure problem.

I suspect that we may have a similar pitfall in many other osmo source trees,
because the Makefile.am *looks* like it takes care of this problem, but
actually doesn't.

Any ideas?

I am using:

automake (GNU automake) 1.16.5
autoconf (GNU Autoconf) 2.71
libtoolize (GNU libtool) 2.4.7
(Debian Unstable)

Thanks!
~N

Reply via email to