diff mbox

build: have a disable-static build succeed

Message ID 1442406751-29670-1-git-send-email-jengelh@inai.de
State Accepted
Headers show

Commit Message

Jan Engelhardt Sept. 16, 2015, 12:32 p.m. UTC
When using configure --disable-static, no libosmogsm.a will be
created, and the tests fail to link because symbols like _a5_3 and
_a5_4 are not exported through the only remaining libosmogsm.so.

A method to overcome this is an intermediate private non-distributed
library, examples of which are present in e.g. libabc, kmod and
systemd.

With this, disable-static can now be the default and practical compile
time be halved.
---
* This is for libosmocore. *

 configure.ac        | 2 +-
 src/gsm/Makefile.am | 8 ++++++--
 tests/Makefile.am   | 6 ++----
 3 files changed, 9 insertions(+), 7 deletions(-)

Comments

Holger Freyther Sept. 16, 2015, 4:11 p.m. UTC | #1
> On 16 Sep 2015, at 14:32, Jan Engelhardt <jengelh@inai.de> wrote:
> 
> When using configure --disable-static, no libosmogsm.a will be
> created, and the tests fail to link because symbols like _a5_3 and
> _a5_4 are not exported through the only remaining libosmogsm.so.
> 
> A method to overcome this is an intermediate private non-distributed
> library, examples of which are present in e.g. libabc, kmod and
> systemd.
> 
> With this, disable-static can now be the default and practical compile
> time be halved.

thanks. What is the likelihood of —disable-static build to fail? Does it
make sense to add a jenkins config/matrix for this?
Jan Engelhardt Sept. 16, 2015, 4:48 p.m. UTC | #2
On Wednesday 2015-09-16 18:11, Holger Freyther wrote:
>> On 16 Sep 2015, at 14:32, Jan Engelhardt <jengelh@inai.de> wrote:
>> 
>> When using configure --disable-static, no libosmogsm.a will be
>> created, and the tests fail to link because symbols like _a5_3 and
>> _a5_4 are not exported through the only remaining libosmogsm.so.
>> 
>> A method to overcome this is an intermediate private non-distributed
>> library, examples of which are present in e.g. libabc, kmod and
>> systemd.
>> 
>> With this, disable-static can now be the default and practical compile
>> time be halved.
>
>thanks. What is the likelihood of —disable-static build to fail?

No different from before.

>Does it make sense to add a jenkins config/matrix for this?

An extra one no; just modify the existing job and let it use 
`./configure --enable-static` which will build all variants.
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index c492277..9a744b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@  AC_PROG_MAKE_SET
 AC_PROG_MKDIR_P
 AC_PROG_CC
 AC_PROG_INSTALL
-LT_INIT([pic-only])
+LT_INIT([pic-only disable-static])
 
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index d8aff4a..1878050 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -10,9 +10,10 @@  noinst_HEADERS = milenage/aes.h milenage/aes_i.h milenage/aes_wrap.h \
 		 milenage/common.h milenage/crypto.h milenage/includes.h \
 		 milenage/milenage.h
 
+noinst_LTLIBRARIES = libgsmint.la
 lib_LTLIBRARIES = libosmogsm.la
 
-libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
+libgsmint_la_SOURCES =  a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
 			gsm_utils.c rsl.c gsm48.c gsm48_ie.c gsm0808.c sysinfo.c \
 			gprs_cipher_core.c gsm0480.c abis_nm.c gsm0502.c \
 			gsm0411_utils.c gsm0411_smc.c gsm0411_smr.c \
@@ -21,8 +22,11 @@  libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
 			auth_milenage.c milenage/aes-encblock.c \
 			milenage/aes-internal.c milenage/aes-internal-enc.c \
 			milenage/milenage.c gan.c ipa.c gsm0341.c apn.c
+libgsmint_la_LDFLAGS = -no-undefined
+libgsmint_la_LIBADD = ../libosmocore.la
 
+libosmogsm_la_SOURCES =
 libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) -no-undefined
-libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la
+libosmogsm_la_LIBADD = libgsmint.la
 
 EXTRA_DIST = libosmogsm.map
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8e31f66..cf0977d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,12 +19,10 @@  utils_utils_test_SOURCES = utils/utils_test.c
 utils_utils_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
 
 a5_a5_test_SOURCES = a5/a5_test.c
-a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
-a5_a5_test_LDFLAGS = -static
+a5_a5_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la
 
 kasumi_kasumi_test_SOURCES = kasumi/kasumi_test.c
-kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la
-kasumi_kasumi_test_LDFLAGS = -static
+kasumi_kasumi_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libgsmint.la
 
 comp128_comp128_test_SOURCES = comp128/comp128_test.c
 comp128_comp128_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gsm/libosmogsm.la