Skip to content

Error building libc for Cross ARM Cortex-M4F #194

Open
@tdyjv

Description

@tdyjv

I'm attempting to compile libc for an STM32L4R5 (Cortex-M4F) on a Linux system running kubuntu 22.04
I cloned the latest libc from the GitHub repo.
I am completely new to using the meson build system, but am willing to learn.
Any help would be appreciated.

After cloning the libc repo...

$ make distclean
$ make default CROSS=arm:cortex-m4_hardfloat

It seems to fail trying to compile cmocka for the ARM STM32 complaining about a missing setjmp.h which I assume should be provided by the local libc headers not the system. setjmp.h is in the libc/include directory.
The compiler invocation to compile cmocka.c does not include any reference to the local header files.
Is there a simple way to add the local libc headers to the cmocka.c build command ljne ?
The complete meson-log.txt file is attached here, but I don't see any reference to cmocka.c there so I'm not sure how helpful that will be.

Here is the final line of output from the build attempt

...
Embedded Artistry libc 1.0

  Subprojects
    cmocka     : YES

  User defined options
    Cross files: meson/cross/arm.txt
                 meson/cross/cortex-m4_hardfloat.txt

Found ninja-1.10.1 at /usr/bin/ninja
ninja: Entering directory `buildresults'                                                                                                                                                    
[1/543] Compiling C object subprojects/cmocka-1.1.5/src/libcmocka.so.0.5.0.p/cmocka.c.o
FAILED: subprojects/cmocka-1.1.5/src/libcmocka.so.0.5.0.p/cmocka.c.o 
arm-none-eabi-gcc -Isubprojects/cmocka-1.1.5/src/libcmocka.so.0.5.0.p -Isubprojects/cmocka-1.1.5/src -I../subprojects/cmocka-1.1.5/src -I../subprojects/cmocka-1.1.5/include -Isubprojects/cmocka-1.1.5/private -I../subprojects/cmocka-1.1.5/private -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu99 -O2 -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Werror=strict-prototypes -Werror=write-strings -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=declaration-after-statement -Werror=return-type -Werror=uninitialized -Wimplicit-fallthrough -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wformat -fno-common -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mabi=aapcs -mthumb -fPIC -DHAVE_CONFIG_H=1 -MD -MQ subprojects/cmocka-1.1.5/src/libcmocka.so.0.5.0.p/cmocka.c.o -MF subprojects/cmocka-1.1.5/src/libcmocka.so.0.5.0.p/cmocka.c.o.d -o subprojects/cmocka-1.1.5/src/libcmocka.so.0.5.0.p/cmocka.c.o -c ../subprojects/cmocka-1.1.5/src/cmocka.c
../subprojects/cmocka-1.1.5/src/cmocka.c:39:10: fatal error: setjmp.h: No such file or directory
   39 | #include <setjmp.h>
      |          ^~~~~~~~~~
compilation terminated.
[13/543] Compiling C object subprojects/cmocka-1.1.5/src/libcmocka_native.so.0.5.0.p/cmocka.c.o
../subprojects/cmocka-1.1.5/src/cmocka.c: In function ‘cmocka_run_one_test_or_fixture’:
../subprojects/cmocka-1.1.5/src/cmocka.c:2768:9: warning: variable ‘rc’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
 2768 |     int rc = 0;
      |         ^~
[14/543] Compiling C++ object printf_tests.p/printf_test_test_suite.cpp.o
ninja: build stopped: subcommand failed.
make: *** [Makefile:57: default] Error 1

meson-log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions