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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. Change subject: Call osmo_init_logging() before static BTS constructor ...................................................................... Call osmo_init_logging() before static BTS constructor The BTS constructor uses functions of libosmocore that could in turn want to log something. This requires the logging to be initialized before. The only way to achieve this is to add an __attribute__((constructor)) function *before* the BTS constructor is being run. This solution might not be elegant, but I guess it's the only way to initialize a C library before calling C++ constructors of global static instance of a class. In case anyone comes up with a better / cleaner approach, we can always change later. This change requires libosmocore >= 0.10.1, as only that permits multiple calls to osmo_init_logging() which may now occur. Change-Id: I28dc4f0db229518348c92413959fed5ae85d753d --- M configure.ac M debian/control M src/bts.cpp 3 files changed, 13 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/configure.ac b/configure.ac index 0a3557d..3533af9 100644 --- a/configure.ac +++ b/configure.ac @@ -36,7 +36,7 @@ dnl Checks for typedefs, structures and compiler characteristics dnl checks for libraries -PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.9) +PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.10.1) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.3) PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.5.1.4) diff --git a/debian/control b/debian/control index 69930e8..ea43016 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Section: net Priority: optional Maintainer: Holger Hans Peter Freyther <holger at moiji-mobile.com> -Build-Depends: debhelper (>= 7.0.0~), dh-autoreconf, dh-systemd (>= 1.5), autotools-dev, pkg-config, libosmocore-dev +Build-Depends: debhelper (>= 7.0.0~), dh-autoreconf, dh-systemd (>= 1.5), autotools-dev, pkg-config, libosmocore-dev (>= 0.10.1) Standards-Version: 3.8.4 Homepage: http://osmocom.org/projects/osmopcu Vcs-Git: git://git.osmocom.org/osmo-pcu diff --git a/src/bts.cpp b/src/bts.cpp index b768569..e41b1fa 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -36,6 +36,7 @@ #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/core/gsmtap_util.h> + #include <osmocom/core/application.h> } #include <arpa/inet.h> @@ -48,6 +49,16 @@ extern void *tall_pcu_ctx; +extern "C" { + /* e must make sure to initialize logging before the BTS static + * constructors are executed below, as those call libosmocore APIs that + * require logging already to be initialized. */ + __attribute__((constructor)) static void early_init(void) + { + osmo_init_logging(&gprs_log_info); + } +} + static BTS s_bts; /** -- To view, visit https://gerrit.osmocom.org/4565 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I28dc4f0db229518348c92413959fed5ae85d753d Gerrit-PatchSet: 2 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>