public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* --without-headers and --with-newlib configure options
@ 2009-07-23 15:58 booleandomain
  2009-07-23 17:26 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: booleandomain @ 2009-07-23 15:58 UTC (permalink / raw)
  To: gcc-help

Hello,

I have some doubts about the --without-headers and --with-newlib options 
when configuring a cross-compiler.

The only source of informations about these options I'm aware of is 
http://gcc.gnu.org/install/configure.html. There it is written:

--without-headers: Tells GCC not use any target headers from a libc when 
building a cross compiler.
--with-newlib: Specifies that `newlib' is being used as the target C 
library.

In other words --without-headers means not to use any libc headers, 
while --with-newlib means to use newlib headers. So in my opinion 
--without-headers --with-newlib doesn't make any sense. Despite of this, 
I have often seen in the web both options used at the same time. Why?

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --without-headers and --with-newlib configure options
  2009-07-23 15:58 --without-headers and --with-newlib configure options booleandomain
@ 2009-07-23 17:26 ` Ian Lance Taylor
  2009-07-23 17:48   ` booleandomain
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2009-07-23 17:26 UTC (permalink / raw)
  To: booleandomain; +Cc: gcc-help

booleandomain <booleandomain@gmail.com> writes:

> I have some doubts about the --without-headers and --with-newlib
> options when configuring a cross-compiler.
>
> The only source of informations about these options I'm aware of is
> http://gcc.gnu.org/install/configure.html. There it is written:
>
> --without-headers: Tells GCC not use any target headers from a libc
> when building a cross compiler.
> --with-newlib: Specifies that `newlib' is being used as the target C
> library.
>
> In other words --without-headers means not to use any libc headers,
> while --with-newlib means to use newlib headers. So in my opinion
> --without-headers --with-newlib doesn't make any sense. Despite of
> this, I have often seen in the web both options used at the same
> time. Why?

Normally if you use --with-newlib the compiler will build the gcc
support library, libgcc, without requiring any external support from the
C library.  Using --without-headers will disable that, and the gcc
support library will be built without requiring any library support.
This disables a few features which are generally uninteresting for
embedded systems.

--with-newlib is still useful even when using --without-headers, because
the newlib header files will be used for libraries other than libgcc,
such as libstdc++.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --without-headers and --with-newlib configure options
  2009-07-23 17:26 ` Ian Lance Taylor
@ 2009-07-23 17:48   ` booleandomain
  2009-07-23 18:46     ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: booleandomain @ 2009-07-23 17:48 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Ian Lance Taylor wrote:
> Normally if you use --with-newlib the compiler will build the gcc
> support library, libgcc, without requiring any external support from the
> C library.  Using --without-headers will disable that, and the gcc
> support library will be built without requiring any library support.
> This disables a few features which are generally uninteresting for
> embedded systems.
> 
> --with-newlib is still useful even when using --without-headers, because
> the newlib header files will be used for libraries other than libgcc,
> such as libstdc++.
> 
> Ian

Let me see if I understood correctly.

--with-newlib tells the compiler to use newlib headers wherever possible 
(also for other libraries than libgcc). --without-headers tells the 
compiler to build libgcc (only it) without any headers at all.

So if I use --without-headers --with-newlib, libgcc will be built 
without requiring the presence of any header, and other libraries will 
be built with newlib headers.

If I use --without-headers alone, libgcc will be built without requiring 
the presence of any headers, and other libraries will be built with libc 
headers.

If I use --with-newlib alone, libgcc and other libraries will be built 
with newlib headers.

If I use nothing, libgcc and other libraries will be built with libc 
headers.

So I think I can use either --without-headers --with-newlib or 
--with-newlib alone for bootstrapping a cross-compiler.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --without-headers and --with-newlib configure options
  2009-07-23 17:48   ` booleandomain
@ 2009-07-23 18:46     ` Ian Lance Taylor
  2009-07-23 19:03       ` booleandomain
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2009-07-23 18:46 UTC (permalink / raw)
  To: booleandomain; +Cc: gcc-help

booleandomain <booleandomain@gmail.com> writes:

> --with-newlib tells the compiler to use newlib headers wherever
> possible (also for other libraries than libgcc). --without-headers
> tells the compiler to build libgcc (only it) without any headers at
> all.

Yes.  Note that --without-headers is the default for a cross-compiler.

> So if I use --without-headers --with-newlib, libgcc will be built
> without requiring the presence of any header, and other libraries will
> be built with newlib headers.

Yes.

> If I use --without-headers alone, libgcc will be built without
> requiring the presence of any headers, and other libraries will be
> built with libc headers.

When building a cross-compiler, in practice what will happen is that
libgcc will build and the other libraries will fail to build.

> If I use --with-newlib alone, libgcc and other libraries will be built
> with newlib headers.

Yes.

> If I use nothing, libgcc and other libraries will be built with libc
> headers.

When building a cross-compiler, you do need to provide some headers for
the libraries other than libgcc.  In other words, at build time, the
compiler needs to be able to find the libc headers.  This is typically
done using one of --with-newlib, --with-sysroot, or
--with-build-sysroot.

> So I think I can use either --without-headers --with-newlib or
> --with-newlib alone for bootstrapping a cross-compiler.

Yes.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: --without-headers and --with-newlib configure options
  2009-07-23 18:46     ` Ian Lance Taylor
@ 2009-07-23 19:03       ` booleandomain
  0 siblings, 0 replies; 5+ messages in thread
From: booleandomain @ 2009-07-23 19:03 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Thank you very much Ian for your explanation!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-07-23 19:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23 15:58 --without-headers and --with-newlib configure options booleandomain
2009-07-23 17:26 ` Ian Lance Taylor
2009-07-23 17:48   ` booleandomain
2009-07-23 18:46     ` Ian Lance Taylor
2009-07-23 19:03       ` booleandomain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).