Assuming that you have the resources and you can perform the build for a NuttX target, then there should be no problem.  The cross build of the toolchain for the NuttX target is the hard part.

Most of the dependencies I list are GCC build dependencies, not run-time dependencies.  So depending upon how you do the build, perhaps those are not issues.

Why not try it and see what obstacles you encounter?

On 4/8/2023 12:45 PM, Victor Suarez Rovere wrote:
So isn't GCC POSIX compliant? I mean a static build of gcc executable and
nothing more (no make, awk or anything)
The only thing that GCC does is read and write files
The C library shouldn't be part of the equation since GCC can compile many
C libraries
Another compiler (besides clang) won't work since I expect C++

So what's the actual difficulty in running a program that just reads and
writes files?



On Sat, Apr 8, 2023 at 2:47 PM Gregory Nutt <spudan...@gmail.com> wrote:

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.


Reply via email to