On 4/7/2023 9:02 PM, Victor Suarez Rovere wrote:
Hi everyone!
Considering that NuttX is POSIX compliant, can gcc or clang be run on NuttX?
I was waiting to see if someone who has actually tried this would
respond. I haven't tried to build a GCC toolchain on NuttX and can't
say that it is impossible, but it certainly would be a big challenge!
* *GCC Components*. GCC consists of several components including
binutils and several other prerequisite libraries (GMP, MPFR, MPC).
A Bash shell and GNU make would need needed too.
* *Other dependencies*: awk, GNU make, Perl, Python3, Flex, Bison,
and perhaps automake. Maybe gzip, bzip2, and tar if you build from
tarballs. Documentation needs Texinfo. And lots of other things
that I forgot.
* *GDB*. GDB is usually considered to be part of the toolchain too.
But it would not be possible to build GDB because it depends on
ptrace which not supported by NuttX.
* *C Library*. GCC and C-libraries are very intimately entangled.
NuttX has its own C libary. I suspect that the integration with GCC
and the NuttX C library would be somewhat challenging as well.
* *Other Unsupported Interfaces*. Several interfaces that depend on
an MMU (fork, full mmap) are not supported and could also be an issue.
* FLAT build? Or Kernel build? Each has it own challenges.
* *Delivery*. GCC normally comes as several Linux executables and
libraries that use several other shared libraries. How would you
package and deliver a GCC toolchain on NuttX? Would you build it
into the FLASH image or put it into a huge monolithic ELF executable
on some mounted volume?
Although I cannot say it is impossible, I would not be optimistic
starting a GCC port to NuttX. I would think that a smaller, less
feature rich C compiler would be a reasonable job.