Unable to Compile LibNoSys in LibGloss

Ammar Ali Ratnani <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAB2H6_vM7j2xgZ1TsmUTfydTtkaeoAKRk0j-C8_WCw6hFuYLUw@mail.gmail.com>
I tried running the following commands on a fresh checkout of both
main and newlib-4.3.0:
```
$ cd libgloss && mkdir build && cd build/
$ ../configure
$ make
```
It fails with:
```
$ make
make  all-recursive
make[1]: Entering directory '/home/ammra/Desktop/newlib-cygwin/libgloss/build'
Making all in .
make[2]: Entering directory '/home/ammra/Desktop/newlib-cygwin/libgloss/build'
depbase=`echo libnosys/chown.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -nostdinc  -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/include -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/include-fixed -DHAVE_CONFIG_H
-I. -I..     -g -O2 -MT libnosys/chown.o -MD -MP -MF $depbase.Tpo -c
-o libnosys/chown.o ../libnosys/chown.c &&\
mv -f $depbase.Tpo $depbase.Po
../libnosys/chown.c:6:10: fatal error: _ansi.h: No such file or directory
    6 | #include <_ansi.h>
      |          ^~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:2146: libnosys/chown.o] Error 1
make[2]: Leaving directory '/home/ammra/Desktop/newlib-cygwin/libgloss/build'
make[1]: *** [Makefile:4072: all-recursive] Error 1
make[1]: Leaving directory '/home/ammra/Desktop/newlib-cygwin/libgloss/build'
make: *** [Makefile:1097: all] Error 2
```
The gcc command does not seem to be looking for headers installed with
libc. This appears to be intended behavior (as evidenced by e0c0ad82).
However, the C files reference <_ansi.h>, <errno.h>, <unistd.h>, and
others - which I thought would be provided by a C library. I suppose
my question is: who should provide these files to allow LibNoSys to
compile?

Additionally, my build process may not be correct. Running the build
process in the top-level directory results in nothing happening, with
the following build output:
```
$ make
make[1]: Entering directory '/home/ammra/Desktop/newlib-cygwin/build'
mkdir -p -- ./etc
Configuring in ./etc
configure: creating cache ./config.cache
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
configure: updating cache ./config.cache
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
make[2]: Entering directory '/home/ammra/Desktop/newlib-cygwin/build/etc'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ammra/Desktop/newlib-cygwin/build/etc'
make[1]: Nothing to be done for 'all-target'.
make[1]: Leaving directory '/home/ammra/Desktop/newlib-cygwin/build'
```
I am able to build newlib, though.

To avoid the XY problem, I am attempting to port newlib to a new
architecture. By fiddling with the compiler options, I was able to
compile newlib. However, I think I still need to write the syscalls. I
believe new targets should them in LibGloss, so I attempted to cross
compile that as well. I got the same error while cross compiling, and
eventually I found it doesn't work on the host system either. I want
to be able to at least compile newlib with the "stubbed" system calls.

Thank you,
- Ammar Ratnani
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.