Could you tell us a bit about what problem you're trying to solve by using
the host system's glibc? As Greg explained, that isn't really feasible, but
perhaps if we understand what you're trying to accomplish, someone might be
able to suggest a different approach...

Cheers
Nathan

On Fri, Aug 2, 2024 at 4:15 PM Ritvik Tanksalkar <ritviktanksal...@gmail.com>
wrote:

> Hi,
>
> Thank you so much for the valuable insights Gregory and Alan. I kind of
> understood the pitfalls but nevertheless wanted to confirm.
>
> Regards,
> Ritvik
>
>
>
> On Fri, Aug 2, 2024 at 3:49 PM Gregory Nutt <spudan...@gmail.com> wrote:
>
> > On 8/2/2024 12:06 PM, Ritvik Tanksalkar wrote:
> > > Hello,
> > >
> > > I'm working on a project where I need to compile the NuttX kernel to
> use
> > > the system's standard library (stdlib) instead of its custom
> > > implementation. My goal is to have NuttX use the host system's stdlib
> > > functions rather than the ones provided with the kernel.
> > >
> > > Currently, I'm compiling the Nuttx kernel for "sim:posix_spawn" which
> > > guarantees native linux support.
> > >
> > > I'd appreciate any guidance on how to achieve this. Specifically:
> > >
> > > 1. What configuration changes are needed to disable NuttX's built-in
> > libc?
> > > 2. Are there any known issues or challenges in making this change?
> > >
> > > Any insights in this regard would be greatly appreciated.
> > >
> > > Regards,
> > > Ritvik
> > >
> > Almost nothing is impossible given enough effort.  But if you are
> > thinking in terms of a simple effort, the simple answer is that
> > replacing the NuttX-specific libc with a Linux-specific libc is
> > impossible.  That is because the NuttX libc uses the NuttX OS system
> > calls and the Linux libc uses the Linux system calls.  They are not the
> > same.  In order to make this work, you would have to change the OS
> > interface used in GLIBC to use the NuttX OS interface.  That would be an
> > enormous job!
> >
> > GLIBC uses the Linux-specific header files that you will find under
> > /usr/include/sys.  Those would all have to be replaced with
> > NuttX-specific header files.  The exported NuttX header files are the
> > ones you find in nuttx/include/nuttx.  Most of the header file required
> > by GLIBC don't even exist in NuttX and would have to be created to
> > satisfy GLIBC.  That is another enormous job.
> >
> > Alan's suggestion works fine for a few, specific, leaf functions in
> > GLIBC but will not work in general.  That is because many non-leaf GLIBC
> > header files will draw in other header files that are not compatible
> > with NuttX.  It would be yet another enormous job to make that work.
> >
> > My recommendatioin:  Don't waste your time.
> >
> >
> >
>

Reply via email to