error "This header is not available in freestanding mode.”
David Filip
dfilip@colornetlabs.com
Wed Jul 24 19:27:10 GMT 2024
Hi newlib community!
I have successfully built and are using Circle (46) on Linux (Rocky/CentOS 8) using the toolchain 3.2:
$ aarch64-none-elf-g++ --version
aarch64-none-elf-g++ (Arm GNU Toolchain 13.2.rel1 (Build arm-13.7)) 13.2.1 20231009
Copyright (C) 2023 Free Software Foundation, Inc.
However, I am having problems building any of the samples, and receive the error:
requires_hosted.h:34:4: error: #error "This header is not available in freestanding mode.”
To build my environment, I have downloaded stdlib from:
https://github.com/smuehlst/circle-stdlib.git
I then I installed and built Circle under:
circle-stdlib/libs/circle
And then newlib under circle-stdlib/libs/std-newlib:
$ git clone https://github.com/smuehlst/circle-newlib.git
And under mbedtls under circle-stdlib/libs/mbedtls:
$ git clone https://github.com/Mbed-TLS/mbedtls.git
And then finally, under circle-stdlib:
$ ./configure --raspberrypi e3 --prefix aarch64-none-elf- --opt-tls
$ make
Which seems to successfully build everything with no errors. However, if I try to build any of the samples under:
circle-stdlib/samples:
I receive a ton of errors, starting with a bunch of:
requires_hosted.h:34:4: error: #error "This header is not available in freestanding mode.”
So my questions re:
1) Did I build the environment correctly, based on the steps I’ve outlined, or am I off base?
2) Any idea why I am getting these errors, and how to fix them?
I’ve included my build steps because it wasn’t initially clear (at least to me) how Circle + StdLib + NewLib all fit together, so let me know if I’ve made any bad assumptions, or if there is an easier way to integrate and build these components.
However, doing ‘make’ does seem to build the libraries correctly, and it did build:
$ find circle-stdlib/install
install
install/.gitignore
install/aarch64-none-circle
install/aarch64-none-circle/lib
install/aarch64-none-circle/lib/libm.a
install/aarch64-none-circle/lib/libc.a
install/aarch64-none-circle/lib/libg.a
install/aarch64-none-circle/lib/libcirclenewlib.a
install/aarch64-none-circle/lib/libnosys.a
install/aarch64-none-circle/lib/nosys.specs
install/aarch64-none-circle/include => Lots of Include Files
But none of the samples will build correctly. The compiler seems to be complaining that I am building with —freestanding while still referencing the C/C++ standard libraries, although those libraries are now provided by newlib?
Thanks in advance for any ideas or suggestions, and/or for clarifying any of my misconceptions about how all these pieces fit together.
Regards,
Dave Filip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/newlib/attachments/20240724/db3684fd/attachment-0001.htm>
More information about the Newlib
mailing list