[PATCH] How to compile osmocom on NetBSD

Pierre Pronchery khorben at defora.org
Wed Jan 26 15:34:10 UTC 2011

			Hi baseband developers,

a couple days ago I managed to compile osmocom's binaries and firmware
files from a NetBSD host, using a cross-compilation toolchain generated
with the standard build script on this system. This was actually quite
straightforward, but required some patches and tricks, so I figured it'd
be worth posting it here.

I will write the procedure in more details on my blog [1], in my case it
was enough to do this:
$ CPATH="/usr/include" gmake \

The patch itself is certainly more interesting to discuss here. I do not
expect it to be fully merged, but I think it may raise interesting points:

- src/shared/libosmocore/src/Makefile.am
  linking with "-ldl" is hardcoded, but breaks the build on systems
  where it is not required; this is a usual portability issue, already
  solved about a thousand times, I'll try to come up with a cleaner
  solution here.

- src/shared/libosmocore/src/gsm_utils.c
  I think this one is quite elegant, allowing to build even without
  support for backtraces; an additional #warning would help though/

- src/shared/libosmocore/src/msgfile.c
  here I had to bluntly emulate the functionality of the getline()
  call, which seems to be specific to glibc; again, it'd certainly be
  nicer if I added a test for HAVE_GETLINE or something along this line.

- src/shared/libosmocore/src/talloc.c
  again, talloc seems to rely on strnlen() being part of the libc, which
  is already known to not be the case on MacOS X; considering it also
  absent of NetBSD fixes the build for me.

- src/target/firmware/include/stdint.h
  this one is definitely more ugly, since I tricked the cross-compiler
  to believe /usr/include matches its specific needs I ended up with
  some essential type definitions already; therefore, I am not sure if
  this workaround would not be more harmful upstream than not.

Anyway, the actual patch is attached.

A few more things to NetBSD users:
- my previous patch about building without GNU make is also necessary;
- I haven't tested the resulting binaries on a NetBSD host;
- the firmware images seem to be only partly functional at the moment.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: netbsd.diff
URL: <http://lists.osmocom.org/pipermail/baseband-devel/attachments/20110126/ac7510d5/attachment.ksh>

More information about the baseband-devel mailing list