Andrei G has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/43589?usp=email )
Change subject: hnbap, rua, sabp: link against libosmo-ranap ......................................................................
hnbap, rua, sabp: link against libosmo-ranap
libosmo-hnbap, libosmo-rua and libosmo-sabp call asn1_xer_print() and talloc_asn1_ctx, both defined in iu_helpers.c and shipped in libosmo-ranap, but none of the three declares that dependency.
GNU ld leaves such references unresolved in a shared object and lets the executable supply them later, even with -no-undefined, so nothing shows on GNU/Linux. Darwin's ld64 refuses:
Undefined symbols for architecture arm64: _asn1_xer_print, _talloc_asn1_ctx
while linking libosmo-rua.la, libosmo-hnbap.la and libosmo-sabp.la.
Add libosmo-ranap.la to the LIBADD of each library and "Requires: libosmo-ranap" to the three .pc.in files, so both the library itself and a consumer that links only one of them record the dependency.
There is no cycle: nm on the built libosmo-ranap shows it defines both symbols and references nothing from hnbap, rua or sabp. On GNU/Linux the only change is an explicit DT_NEEDED entry.
Change-Id: Ic936829788536bc1b1973a5ed3082a82cbf90d04 Signed-off-by: Andrei Gosman andrei.gosman@gmail.com --- M libosmo-hnbap.pc.in M libosmo-rua.pc.in M libosmo-sabp.pc.in M src/Makefile.am 4 files changed, 10 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/89/43589/1
diff --git a/libosmo-hnbap.pc.in b/libosmo-hnbap.pc.in index db05756..49eae7c 100644 --- a/libosmo-hnbap.pc.in +++ b/libosmo-hnbap.pc.in @@ -6,5 +6,6 @@ Name: Osmocom HNBAP protocol library Description: C Utility Library Version: @VERSION@ +Requires: libosmo-ranap Libs: -L${libdir} -losmo-hnbap Cflags: -I${includedir}/ diff --git a/libosmo-rua.pc.in b/libosmo-rua.pc.in index b9bd1d4..893e4b5 100644 --- a/libosmo-rua.pc.in +++ b/libosmo-rua.pc.in @@ -6,5 +6,6 @@ Name: Osmocom RUA protocol library Description: C Utility Library Version: @VERSION@ +Requires: libosmo-ranap Libs: -L${libdir} -losmo-rua Cflags: -I${includedir}/ diff --git a/libosmo-sabp.pc.in b/libosmo-sabp.pc.in index fd0c2d4..7cd6a6d 100644 --- a/libosmo-sabp.pc.in +++ b/libosmo-sabp.pc.in @@ -6,5 +6,6 @@ Name: Osmocom SABP protocol library Description: C Utility Library Version: @VERSION@ +Requires: libosmo-ranap Libs: -L${libdir} -losmo-sabp Cflags: -I${includedir}/ diff --git a/src/Makefile.am b/src/Makefile.am index 343fa53..e8962fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -65,10 +65,14 @@ RANAP_LIBVERSION=12:0:5 RUA_LIBVERSION=2:0:2 SABP_LIBVERSION=3:0:2 +# libosmo-hnbap, libosmo-rua and libosmo-sabp use asn1_xer_print and +# talloc_asn1_ctx, both defined in iu_helpers.c of libosmo-ranap, so they +# depend on it. Link it explicitly: GNU ld lets a shared object keep such a +# reference unresolved despite -no-undefined, ld64 on Darwin does not. lib_LTLIBRARIES = libosmo-hnbap.la libosmo-ranap.la libosmo-rua.la libosmo-sabp.la libosmo_hnbap_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HNBAP_LIBVERSION) -no-undefined libosmo_hnbap_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOVTY_LIBS) $(OSMOSIGTRAN_LIBS) \ - $(ASN1C_LIBS) hnbap/libosmo-asn1-hnbap.la + $(ASN1C_LIBS) hnbap/libosmo-asn1-hnbap.la libosmo-ranap.la libosmo_hnbap_la_SOURCES = hnbap_common.c hnbap_encoder.c hnbap_decoder.c
libosmo_ranap_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(RANAP_LIBVERSION) -no-undefined @@ -79,12 +83,12 @@
libosmo_rua_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(RUA_LIBVERSION) -no-undefined libosmo_rua_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOVTY_LIBS) $(OSMOSIGTRAN_LIBS) \ - $(ASN1C_LIBS) rua/libosmo-asn1-rua.la + $(ASN1C_LIBS) rua/libosmo-asn1-rua.la libosmo-ranap.la libosmo_rua_la_SOURCES = rua_common.c rua_encoder.c rua_decoder.c rua_msg_factory.c
libosmo_sabp_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(SABP_LIBVERSION) -no-undefined libosmo_sabp_la_LIBADD = $(OSMOCORE_LIBS) $(OSMOGSM_LIBS) $(OSMOVTY_LIBS) $(OSMOSIGTRAN_LIBS) \ - $(ASN1C_LIBS) sabp/libosmo-asn1-sabp.la + $(ASN1C_LIBS) sabp/libosmo-asn1-sabp.la libosmo-ranap.la libosmo_sabp_la_SOURCES = sabp_common.c sabp_encoder.c sabp_decoder.c