Change in libosmocore[master]: fix tests linking: don't use system installed libs

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Sep 13 14:11:17 UTC 2018


Neels Hofmeyr has submitted this change and it was merged. ( https://gerrit.osmocom.org/5844 )

Change subject: fix tests linking: don't use system installed libs
......................................................................

fix tests linking: don't use system installed libs

Do not link against the system-wide installed libosmo* libs when building the
regression test programs. Always use the locally built ones.

Linking some libosmo libraries causes libtool to pull in other libosmo libs
even though they were not explicitly named. For example, ctrl_test explicitly
links libosmoctrl, but this also has dependencies to libosmovty and libosmogsm:

  ldd src/ctrl/.libs/libosmoctrl.so | grep osmo
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f26c26d4000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f26c22bb000)
    libosmovty.so.4 => /usr/local/lib/libosmovty.so.4 (0x00007f26c2171000)

If we omit explicit LDADD of these dependencies in the Makefile.am, libtool
will take the first canonical place to find them, which may just be the already
installed older versions of the same libs, which may or may not be compatible
with the current build. In any case, it is never intended to link installed
libs.

All library dependencies are listed by this quick script:

  cd libosmocore
  for l in $(find . -name "*.so") ; do echo; echo "$l"; ldd $l | grep libosmo; done

  ./.libs/libosmocore.so

  ./coding/.libs/libosmocoding.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f25fc3c2000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f25fbfa9000)
    libosmocodec.so.0 => /usr/local/lib/libosmocodec.so.0 (0x00007f25fbf9b000)

  ./codec/.libs/libosmocodec.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007fb4c900d000)

  ./ctrl/.libs/libosmoctrl.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f5df5129000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f5df4d10000)
    libosmovty.so.4 => /usr/local/lib/libosmovty.so.4 (0x00007f5df4bc6000)

  ./gb/.libs/libosmogb.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f788e536000)
    libosmovty.so.4 => /usr/local/lib/libosmovty.so.4 (0x00007f788e3ec000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f788dfd3000)

  ./vty/.libs/libosmovty.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f3b7ed21000)

  ./gsm/.libs/libosmogsm.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007fc69472e000)

  ./sim/.libs/libosmosim.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f2f6412d000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f2f63d14000)

Add all explicit linking of all required library dependencies in all regression
test programs, as shown by above listing.

Example for reproducing a problem:

In libosmocore.a, introduce a new function, and call that from libosmovty code.
For example, I made loglevel_strs non-static in logging.c, and used that in
logging_vty.c. Build and install this in a place where libtool can find it.
Then go back to before this change and rebuild. You will see that linking
ctrl_test (before this patch) then complains about libosmovty requiring the
loglevel_strs symbol which it cannot find in libosmocore.so.

Change-Id: Id084e6e6efd25cd62b1bd7a4fc7c5985c39130c6
---
M tests/Makefile.am
1 file changed, 13 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/tests/Makefile.am b/tests/Makefile.am
index 072bb4a..5d07695 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -76,7 +76,10 @@
 abis_abis_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
 
 ctrl_ctrl_test_SOURCES = ctrl/ctrl_test.c
-ctrl_ctrl_test_LDADD = $(LDADD) $(top_builddir)/src/ctrl/libosmoctrl.la
+ctrl_ctrl_test_LDADD = $(LDADD) \
+	$(top_builddir)/src/ctrl/libosmoctrl.la \
+	$(top_builddir)/src/gsm/libosmogsm.la \
+	$(top_builddir)/src/vty/libosmovty.la
 
 gea_gea_test_SOURCES = gea/gea_test.c
 gea_gea_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
@@ -130,20 +133,24 @@
 
 gb_bssgp_fc_test_SOURCES = gb/bssgp_fc_test.c
 gb_bssgp_fc_test_LDADD = $(LDADD) $(top_builddir)/src/gb/libosmogb.la \
+			 $(top_builddir)/src/vty/libosmovty.la \
 			 $(top_builddir)/src/gsm/libosmogsm.la
 
 gb_gprs_bssgp_test_SOURCES = gb/gprs_bssgp_test.c
 gb_gprs_bssgp_test_LDADD = $(LDADD) $(top_builddir)/src/gb/libosmogb.la $(LIBRARY_DLSYM) \
+			   $(top_builddir)/src/vty/libosmovty.la \
 			   $(top_builddir)/src/gsm/libosmogsm.la
 
 gb_gprs_ns_test_SOURCES = gb/gprs_ns_test.c
 gb_gprs_ns_test_LDADD = $(LDADD) $(top_builddir)/src/gb/libosmogb.la $(LIBRARY_DLSYM) \
+			$(top_builddir)/src/vty/libosmovty.la \
 			$(top_builddir)/src/gsm/libosmogsm.la
 
 logging_logging_test_SOURCES = logging/logging_test.c
 
 fr_fr_test_SOURCES = fr/fr_test.c
 fr_fr_test_LDADD = $(LDADD) $(top_builddir)/src/gb/libosmogb.la $(LIBRARY_DLSYM) \
+		   $(top_builddir)/src/vty/libosmovty.la \
 		   $(top_builddir)/src/gsm/libosmogsm.la
 
 codec_codec_test_SOURCES = codec/codec_test.c
@@ -177,7 +184,11 @@
 oap_oap_client_test_LDADD = $(LDADD) $(top_builddir)/src/gsm/libosmogsm.la
 
 fsm_fsm_test_SOURCES = fsm/fsm_test.c
-fsm_fsm_test_LDADD = $(LDADD) $(top_builddir)/src/ctrl/libosmoctrl.la
+fsm_fsm_test_LDADD = \
+	$(LDADD) \
+	$(top_builddir)/src/ctrl/libosmoctrl.la \
+	$(top_builddir)/src/gsm/libosmogsm.la \
+	$(top_builddir)/src/vty/libosmovty.la
 
 write_queue_wqueue_test_SOURCES = write_queue/wqueue_test.c
 

-- 
To view, visit https://gerrit.osmocom.org/5844
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id084e6e6efd25cd62b1bd7a4fc7c5985c39130c6
Gerrit-Change-Number: 5844
Gerrit-PatchSet: 6
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180913/a8f1775e/attachment.htm>


More information about the gerrit-log mailing list