Re: Configure Option to Disable libc

Shivam Patel via Gcc-help <[email protected]>
Newsgroups gmane.comp.gcc.help
Message-ID <LV3P222MB1218A85D4AB2093CB2802705B4D5A@LV3P222MB1218.NAMP222.PROD.OUTLOOK.COM>
Hi,

Thank you for the response. I have tried to configure (in a new build tree) with
--without-headers and --with-newlib, but they didn't work.
I tried both at the same time and separately as well in new build trees,
but it didn't resolve the issue, and I get the same error.

For --disable-threads and --enable-threads=single, I used these configure options in a
clean directory, and built again and I still had the same error.
I usually delete the build directory entirely and then try again with the new configure options.
I do an out-of-tree build each time. I'm not sure where I'm going wrong.

Best,
Shivam
________________________________
From: Shivam Patel
Sent: November 21, 2025 1:52 PM
To: [email protected] <[email protected]>
Subject: Configure Option to Disable libc

Hi,

For context, I'm working on a GCC backend for an extensible ISA.
Here is a link to a previous thread I had made "Help Emitting Proper Immediates": https://gcc.gnu.org/pipermail/gcc-help/2025-November/144575.html.
I've gotten further in the build process, but I am encountering the following error when running make all-target-libgcc:

In file included from ../../../etca-gcc/libgcc/gthr.h:157,
                 from ../../../etca-gcc/libgcc/unwind-dw2.c:37:
./gthr-default.h:35:10: fatal error: pthread.h: No such file or directory

   35 | #include <pthread.h>
      |          ^~~~~~~~~~~
compilation terminated.
make[1]: *** [unwind-dw2.o] Error 1
make: *** [all-target-libgcc] Error 2

I was wondering if there was a way to disable libc at configuration time as
there isn't a libc for the target yet. Here is the exact configure line I've used:

../etca-gcc/configure \
--target=etca-elf \
--enable-languages=c \
--without-headers \
--prefix="$HOME/etca-compiler/out"

I've tried a few fixes:


  *
Configuring with --disable-threads or --enable-threads=single
  *
Adding tmakefile="${tmakefile} t-slibgcc-nolc-override" to config/gcc for the target
  *
Also tried configuring with --without-headers

All of these have had no effect.
So I'm left with the following questions:

1. Is there a configure-time option (or some recommended approach) to
prevent libgcc from requiring target libc headers
like pthread.h when the target has no libc?

2. If not, what is the recommended minimal approach to build libgcc for a target
without a libc? Should I be using --with-newlib
or a different combination of options/overrides?

Is there somewhere I can read documentation about the configure process, options, and/or makefile fragments that are available? I have not been able to find it but I am hopeful that it would answer other questions that may arise from my project.

Thank you for any guidance!

Best,
Shivam
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.