Project

General

Profile

Actions

Bug #6487

open

OsmocomBB fails to build on arch linux

Added by kuyaya 7 days ago. Updated 6 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
OsmocomBB Firmware
Target version:
-
Start date:
06/11/2024
Due date:
% Done:

0%

Resolution:
Spec Reference:

Description

Hello everyone
I tried to build OsmocomBB today and couldn't get it to work. My steps include:

1. git clone https://gitea.osmocom.org/phone-side/osmocom-bb.git
2. Install libosmocore (tried both directly via source and the AUR package libosmocore) and arm-none-eabi-gcc (via pacman)
3. Invoked make as follows: make -e CROSS_TOOL_PREFIX=arm-none-eabi-. I also tried just copying the /usr/bin/arm-none-eabi-gcc binary to /usr/bin/arm-elf-gcc and invoking make without any parameters, didn't change anything
4. I got the following error after this:

make[4]: Entering directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target/src'
  CC       utils.lo
../../src/utils.c: In function 'get_value_string':
../../src/utils.c:32:56: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
   32 |         snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val);
      |                                                       ~^   ~~~
      |                                                        |   |
      |                                                        |   uint32_t {aka long unsigned int}
      |                                                        unsigned int
      |                                                       %lx
../../src/utils.c: In function 'get_string_value':
../../src/utils.c:48:22: error: implicit declaration of function 'strcasecmp' [-Wimplicit-function-declaration]
   48 |                 if (!strcasecmp(vs[i].str, str))
      |                      ^~~~~~~~~~
make[4]: *** [Makefile:510: utils.lo] Error 1
make[4]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target/src'
make[3]: *** [Makefile:382: all] Error 2
make[3]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target/src'
make[2]: *** [Makefile:509: all-recursive] Error 1
make[2]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target'
make[1]: *** [Makefile:381: all] Error 2
make[1]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target'
make: *** [Makefile:34: shared/libosmocore/build-target/src/.libs/libosmocore.a] Error 2

The whole console output is pasted here: https://pastebin.com/Q9FSL4UV

Stackoverflow said that it was due to some error import (strings.h should also be imported, not only string.h). This fixed the error but other files generated even more errors, which prompts me to think that I don't have the correct toolchain installed or am compiling incorrectly.

These are the next errors I encounter:

../../src/logging.c: In function 'log_parse_category_mask':
../../src/logging.c:164:22: error: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
  164 |         char *mask = strdup(_mask);
      |                      ^~~~~~
../../src/logging.c:164:22: warning: incompatible implicit declaration of built-in function 'strdup' [-Wbuiltin-declaration-mismatch]
../../src/logging.c:171:26: error: implicit declaration of function 'strtok'; did you mean 'strtol'? [-Wimplicit-function-declaration]
  171 |         category_token = strtok(mask, ":");
      |                          ^~~~~~
      |                          strtol
../../src/logging.c:171:24: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  171 |         category_token = strtok(mask, ":");
      |                        ^
../../src/logging.c:175:39: error: implicit declaration of function 'strstr' [-Wimplicit-function-declaration]
  175 |                         char* colon = strstr(category_token, ",");
      |                                       ^~~~~~
../../src/logging.c:44:1: note: include '<string.h>' or provide a declaration of 'strstr'
   43 | #include <osmocom/vty/logging.h>        /* for LOGGING_STR. */
  +++ |+#include <string.h>
   44 | 
../../src/logging.c:175:39: warning: incompatible implicit declaration of built-in function 'strstr' [-Wbuiltin-declaration-mismatch]
  175 |                         char* colon = strstr(category_token, ",");
      |                                       ^~~~~~
../../src/logging.c:175:39: note: include '<string.h>' or provide a declaration of 'strstr'
../../src/logging.c:201:34: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  201 |         } while ((category_token = strtok(NULL, ":")));
      |                                  ^
../../src/logging.c: In function '_file_output':
../../src/logging.c:443:9: error: implicit declaration of function 'fflush' [-Wimplicit-function-declaration]
  443 |         fflush(target->tgt_file.out);
      |         ^~~~~~
../../src/logging.c: In function 'log_target_create_file':
../../src/logging.c:516:32: error: implicit declaration of function 'fopen' [-Wimplicit-function-declaration]
  516 |         target->tgt_file.out = fopen(fname, "a");
      |                                ^~~~~
../../src/logging.c:44:1: note: 'fopen' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
   43 | #include <osmocom/vty/logging.h>        /* for LOGGING_STR. */
  +++ |+#include <stdio.h>
   44 | 
../../src/logging.c:516:30: error: assignment to 'FILE *' {aka 'struct __file *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
  516 |         target->tgt_file.out = fopen(fname, "a");
      |                              ^
../../src/logging.c: In function 'log_target_destroy':
../../src/logging.c:562:25: error: implicit declaration of function 'fclose' [-Wimplicit-function-declaration]
  562 |                         fclose(target->tgt_file.out);
      |                         ^~~~~~
../../src/logging.c: In function 'log_target_file_reopen':
../../src/logging.c:575:30: error: assignment to 'FILE *' {aka 'struct __file *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
  575 |         target->tgt_file.out = fopen(target->tgt_file.fname, "a");
      |                              ^
make[4]: *** [Makefile:510: logging.lo] Error 1
make[4]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target/src'
make[3]: *** [Makefile:382: all] Error 2
make[3]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target/src'
make[2]: *** [Makefile:509: all-recursive] Error 1
make[2]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target'
make[1]: *** [Makefile:381: all] Error 2
make[1]: Leaving directory '/home/alois/apps/osmocom-bb/src/shared/libosmocore/build-target'
make: *** [Makefile:34: shared/libosmocore/build-target/src/.libs/libosmocore.a] Error 2

Again, here's the full output: https://pastebin.com/xsTRNyF1

Last but not least, here's some information that may be relevant:
Commit hash: d70e8a6de72c361870bd9202110dac933d91992f (currently latest)
gcc version: gcc (GCC) 14.1.1 20240522
arm-none-eabi-gcc version: arm-none-eabi-gcc (Arch Repository) 14.1.0
libosmocore version: 1.9.3-1
kernel version: 6.6.32-1-lts

Actions #1

Updated by fixeria 7 days ago

  • Category set to OsmocomBB Firmware

Hi,

sadly, the firmware does not compile anymore with recent arm-none-eabi-gcc 14.1.0. It worked fine with 13.2.0.
Same problem here on Arch. I tried to fix those string.h related problems, but then faced even more issues and quickly gave up.
I hope it can be fixed by adding some CFLAGS params, which we may not be setting explicitly.

For now, as a workaround, I recommend using an older toolchain version, e.g. the one provided by debian:bookworm (Docker can help).
Alternatively, you can build the old known to work toolchain from here: https://cgit.osmocom.org/docker-playground/tree/arm-none-eabi-gcc-4.8.2.

Actions #2

Updated by kuyaya 6 days ago

Hey, thanks for the quick response!

I downgraded my arm-none-eabi-gcc to 13.2.0 and the problems I first encountered seemed to get fixed with this. However, the compilation errored out with the following error:

[...]
checking for libosmo-gprs-rlcmac... no
configure: error: Package requirements (libosmo-gprs-rlcmac) were not met:

Package 'libosmo-gprs-rlcmac', required by 'virtual:world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBOSMOGPRSRLCMAC_CFLAGS
and LIBOSMOGPRSRLCMAC_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** [Makefile:81: host/layer23/Makefile] Error 1

Thus, I installed libosmo-gprs-git from the AUR. After that, I got a different error, which I couldn't fix yet:

ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     mobile
/usr/bin/ld: libmobile.a(tch_data.o): warning: relocation against `osmo_v110_e1e2e3' in read-only section `.text'
/usr/bin/ld: libmobile.a(tch_data.o): in function `osmo_v110_ta_circuit_name':
tch_data.c:(.text+0x39d): undefined reference to `osmo_v110_ta_circuit_names'
/usr/bin/ld: libmobile.a(tch_data.o): in function `osmo_v110_ta_circuit_desc':
tch_data.c:(.text+0x3be): undefined reference to `osmo_v110_ta_circuit_descs'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_soft_uart_alloc':
tch_data.c:(.text+0x6df): undefined reference to `osmo_soft_uart_alloc'
/usr/bin/ld: tch_data.c:(.text+0x702): undefined reference to `osmo_soft_uart_set_rx'
/usr/bin/ld: tch_data.c:(.text+0x713): undefined reference to `osmo_soft_uart_set_tx'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_v110_ta_async_rx_cb':
tch_data.c:(.text+0x911): undefined reference to `osmo_soft_uart_rx_ubits'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_v110_ta_async_tx_cb':
tch_data.c:(.text+0x94b): undefined reference to `osmo_soft_uart_tx_ubits'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_v110_ta_status_update_cb':
tch_data.c:(.text+0xb5c): undefined reference to `osmo_soft_uart_set_status_line'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_v110_ta_alloc':
tch_data.c:(.text+0xd8b): undefined reference to `osmo_v110_e1e2e3'
/usr/bin/ld: tch_data.c:(.text+0xdc1): undefined reference to `osmo_v110_ta_alloc'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_csd_rx_from_l1':
tch_data.c:(.text+0x120d): undefined reference to `osmo_v110_ta_frame_in'
/usr/bin/ld: tch_data.c:(.text+0x1250): undefined reference to `osmo_soft_uart_flush_rx'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_csd_tx_to_l1':
tch_data.c:(.text+0x13e7): undefined reference to `osmo_v110_ta_frame_out'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_data_state_init':
tch_data.c:(.text+0x1edb): undefined reference to `osmo_soft_uart_free'
/usr/bin/ld: tch_data.c:(.text+0x1ef8): undefined reference to `osmo_v110_ta_free'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_data_state_free':
tch_data.c:(.text+0x1f56): undefined reference to `osmo_soft_uart_free'
/usr/bin/ld: tch_data.c:(.text+0x1f73): undefined reference to `osmo_v110_ta_free'
/usr/bin/ld: libmobile.a(tch_data.o): in function `tch_csd_sock_state_cb':
tch_data.c:(.text+0x205c): undefined reference to `osmo_v110_ta_set_circuit'
/usr/bin/ld: tch_data.c:(.text+0x2072): undefined reference to `osmo_v110_ta_sync_ind'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:459: mobile] Error 1
make[4]: Leaving directory '/home/alois/apps/osmocom-bb/src/host/layer23/src/mobile'
make[3]: *** [Makefile:339: all-recursive] Error 1
make[3]: Leaving directory '/home/alois/apps/osmocom-bb/src/host/layer23/src'
make[2]: *** [Makefile:383: all-recursive] Error 1
make[2]: Leaving directory '/home/alois/apps/osmocom-bb/src/host/layer23'
make[1]: *** [Makefile:324: all] Error 2
make[1]: Leaving directory '/home/alois/apps/osmocom-bb/src/host/layer23'
make: *** [Makefile:84: host/layer23/layer23] Error 2

The full output is here: https://pastebin.com/nhLFCF0U

To me, it seems like some additional libraries/dependencies are missing, so I tried to install every libosmo* package from the AUR (most of which failed to install too). That didn't help unfortunately.
I also tried every arm-none-eabi-gcc version available on the arch archive and always got the same error, but I don't think it's the compiler version this time (although I didn't try 4.8.2 yet).

Actions #3

Updated by fixeria 6 days ago

kuyaya wrote in #note-2:

I downgraded my arm-none-eabi-gcc to 13.2.0 and the problems I first encountered seemed to get fixed with this.

FYI: I have added some notes to the Toolchain wiki page about this.

However, the compilation errored out with the following error:

This is no longer a toolchain but a host side related problem.
Indeed, the wiki page Software_Getting_Started was not updated to mention the new libosmo-gprs dependency.
I have fixed this and added some notes for Arch Linux.

Thus, I installed libosmo-gprs-git from the AUR. After that, I got a different error, which I couldn't fix yet:[...]

Apparently, you have installed https://aur.archlinux.org/packages/libosmocore (latest stable release), which is missing the V.110/soft-uart API.
Please use the "-git" variant https://aur.archlinux.org/packages/libosmocore-git instead.

To me, it seems like some additional libraries/dependencies are missing, so I tried to install every libosmo* package from the AUR (most of which failed to install too).

As a maintainer of those packages, I am surprised to hear they fail to install. Please let me know more (preferably by sending E-mail to fixeria at osmocom.org).

I also tried every arm-none-eabi-gcc version available on the arch archive and always got the same error, but I don't think it's the compiler version this time (although I didn't try 4.8.2 yet).

As I said above, this is no longer a toolchain problem. As can be seen from your logs, the firmware compiled fine.

Actions #4

Updated by kuyaya 6 days ago

fixeria wrote in #note-3:

FYI: I have added some notes to the Toolchain wiki page about this.

Nice, thanks :)

Apparently, you have installed https://aur.archlinux.org/packages/libosmocore (latest stable release), which is missing the V.110/soft-uart API.
Please use the "-git" variant https://aur.archlinux.org/packages/libosmocore-git instead.

Awesome, this fixed the previous error. I can successfully compile without any errors now, thanks a lot for the support!

As you stated, currently only libosmocore-git seems to work fine for compiling, but the sources of libosmo-gprs-git (and also osmo-gapk-git, libosmo-netif-git, libosmo-sccp-git, libosmo-pfcp, libosmo-netif, libosmo-abis-git, libosmo-abis) depend on libosmocore, so I had to adjust the PKGBUILD to point to libosmocore-git.

As a maintainer of those packages, I am surprised to hear they fail to install. Please let me know more (preferably by sending E-mail to fixeria at osmocom.org).

As far as I can remember, the errors were very similar (or the same) which I got when trying to compile OsmocomBB. Out of curiosity, I downloaded the PKGBUILDs for libosmo-abis-git and libosmo-netif-git (which I knew failed previously) and adjusted them to use the -git versions for their dependency. After this, they too compiled fine and without errors. Thus, it's highly likely that it's only a problem when using the libosmocore package and everything works fine when using libosmocore-git. In total, I've tested it for every libosmo-*-git package maintained by you, osmo-gapk-git and libosmo-pfcp, all of which now compile and install without problem.

This is no longer a toolchain but a host side related problem.
Indeed, the wiki page Software_Getting_Started was not updated to mention the new libosmo-gprs dependency.
I have fixed this and added some notes for Arch Linux.

Great, thank you!

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)