Project

General

Profile

Actions

Bug #6487

open

OsmocomBB fails to build on arch linux

Added by kuyaya 15 days ago. Updated 14 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

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)