Project

General

Profile

Actions

Bug #5960

closed

Recent commit to libosmocore broke the build under Slackware

Added by falconia about 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
-
Target version:
-
Start date:
03/26/2023
Due date:
% Done:

0%

Spec Reference:

Description

This recent commit that has been merged on 2023-03-11:

https://cgit.osmocom.org/libosmocore/commit/?id=9dca9027b75b706f333ede584beb09143cb98cbd

breaks the build of libosmocore under Slackware 14.2. The following factors combine to break compilation of C modules under src/coding:

Factor 1: libosmocore header files are so intertwined (include each other freely) that no matter which part of libosmocore you are actually interested in, or more specifically no matter which libosmocore header you are including, <osmocom/core/talloc.h> will always get pulled in no matter what. In the present case, the include chain goes as follows:

In file included from ../../include/osmocom/core/utils.h:9:0,
from ../../include/osmocom/core/bit16gen.h:21,
from ../../include/osmocom/core/bits.h:11,
from gsm0503_interleaving.c:24:
../../include/osmocom/core/talloc.h:3:20: fatal error: talloc.h: No such file or directory

Factor 2: under Slackware 14.2 (I have no experience with other distros) the only system-installed talloc.h header lives in /usr/include/samba-4.0. Therefore, unless the compiler invokation line includes a -I/usr/include/samba-4.0 option, the inclusion of <talloc.h> from <osmocom/core/talloc.h> is guaranteed to cause a hard compilation failure.

Factor 3: the voodoo magic of autotools plus pkg-config is able to find this deeply-hidden talloc.h on my system, and it correctly sets TALLOC_CFLAGS to the needed -I path.

Factor 4: because of intertwined libosmocore header files (see Factor 1 above), practically every Osmocom sw component must include TALLOC_CFLAGS in its Makefile.am CFLAGS or CPPFLAGS, or else the build breaks. It appears that this rule has been followed by all Osmocom projects up until now, as I haven't run into this issue until this very recent libosmocore commit breaking src/coding.

fixeria: since it was your commit that broke the build, can you please give your attention to this matter?

Actions #1

Updated by laforge about 1 year ago

  • Assignee set to fixeria

The patch in question still seems correct, as libosmocoding does not use talloc.

I guess the problem is that libosmocoding Makefile doesn't seem to be "depending" on libosmocore cflags, despite it using libosmocore.

If libosmocoding would be a separate library, it should be using pkg-config --cflags libosmocore which due to the dependency of libosmocore.pc to talloc would add the talloc include path.

I'm not entirely sure what is the correct solution for the situation at hand, where libosmocoding is not a separate package but built as part of the libosmocore build process.

Actions #2

Updated by fixeria about 1 year ago

  • Status changed from New to In Progress
Actions #3

Updated by fixeria about 1 year ago

  • Status changed from In Progress to Feedback

Hi Mychaela,

falconia wrote:

This recent commit that has been merged on 2023-03-11:

https://cgit.osmocom.org/libosmocore/commit/?id=9dca9027b75b706f333ede584beb09143cb98cbd

breaks the build of libosmocore under Slackware 14.2.

sorry for inconvenience, I submitted a partial revert adding $(TALLOC_CFLAGS) back:

https://gerrit.osmocom.org/c/libosmocore/+/32166 fixup (partial revert): "coding: clean up Makefile.am" [NEW]

Factor 1: libosmocore header files are so intertwined (include each other freely) that no matter which part of libosmocore you are actually interested in, or more specifically no matter which libosmocore header you are including, <osmocom/core/talloc.h> will always get pulled in no matter what.

I also submitted a patch removing unnecessary includes of talloc.h from some header files:

https://gerrit.osmocom.org/c/libosmocore/+/32167 core: remove unnecessary #include <osmocom/core/talloc.h> [NEW]

Removing it from osmocom/core/utils.h is impossible because it has inline functions using talloc API.

Factor 3: the voodoo magic of autotools plus pkg-config is able to find this deeply-hidden talloc.h on my system, and it correctly sets TALLOC_CFLAGS to the needed -I path.

Perhaps because the pkg-config manifest talloc.pc lives in the standard location for your distro, unlike the header file.

Factor 4: because of intertwined libosmocore header files (see Factor 1 above), practically every Osmocom sw component must include TALLOC_CFLAGS in its Makefile.am CFLAGS or CPPFLAGS, or else the build breaks. It appears that this rule has been followed by all Osmocom projects up until now, as I haven't run into this issue until this very recent libosmocore commit breaking src/coding.

No, this is not entirely correct. Other projects don't really need to put TALLOC_CFLAGS into their CFLAGS/CPPFLAGS because libosmocore.pc.in explicitly lists talloc as a dependency, so LIBOSMOCORE_CFLAGS will additionally contain talloc's CFLAGS. This is all autotools magic...

Actions #4

Updated by falconia about 1 year ago

Hi Vadim,

fixeria wrote in #note-3:

sorry for inconvenience, I submitted a partial revert adding $(TALLOC_CFLAGS) back:

https://gerrit.osmocom.org/c/libosmocore/+/32166 fixup (partial revert): "coding: clean up Makefile.am" [NEW]

Looks good to me - once it reaches master, I should be back in play.

I also submitted a patch removing unnecessary includes of talloc.h from some header files:

https://gerrit.osmocom.org/c/libosmocore/+/32167 core: remove unnecessary #include <osmocom/core/talloc.h> [NEW]

Also good - any reduction of unnecessary dependencies is always a good thing.

Perhaps because the pkg-config manifest talloc.pc lives in the standard location for your distro, unlike the header file.

Yes, that appears to be the trick indeed! There is a talloc.pc file in /usr/lib/pkgconfig, containing the /usr/include/samba-4.0 path inside.

Actions #5

Updated by falconia about 1 year ago

  • Status changed from Feedback to Resolved

This commit in libosmocore master fixes the broken build:

https://cgit.osmocom.org/libosmocore/commit/?id=48c60f97714581e53de068b4a1b7c0d70bd41fdf

The present issue can now be closed.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)