Compiling with newlib headers?

Sergei Organov osv@javad.ru
Sat Sep 30 09:57:00 GMT 2000


Chris Faylor <cgf@cygnus.com> writes:
> On Sat, Sep 30, 2000 at 06:40:06PM +0400, Sergei Organov wrote:
> >The article is wonderful, but the following question still remains. How do I
> >merge trees taken from, let's say, gcc-2.95.2, binutils-2.10, and
> >newlib-1.8.2 distributions together? What to do with 'include' and
> >'libiberty' directories in this case? Take them from the latest distribution,
> >or what?
> >
> >Actually, I took everything from binutils, then 'gcc' directory from gcc,
> >then 'newlib' directory from newlib. This seems to work, but is it the right
> >thing to do?
> 
> There is no "right thing to do", unfortunately.  The releases of gcc, gdb,
> newlib, and binutils are disjoint.  That means that the bfd directory from a
> gcc release is only guaranteed to work correctly with gcc.  The include
> directory from a gdb release is only guaranteed to work correctly with gdb,
> etc.
> 
> You can probably get away with using the newest version of common libraries
> and include files but there are no guarantees.

Then, strictly speaking, Michael's answer to the original question wasn't
correct. It could be impossible to build from single source tree if released
distributions are used, and the latter is very likely for end-user. Anyway, it
seems to be safe to put 'newlib' subdirectory from newlib distribution into
the source tree provided with gcc distribution. At least this solves
dependency problem between gcc and newlib, and binutils could be always built 
separately.

BTW, I noticed that if I build 'newlib' separately, the build process
surprisingly doesn't use configured --prefix to find correct compiler. It just
invokes compiler without any path, thus the resulting library depends on the
value of PATH environment variable that is active during make. This could
bring unexpected results if different versions of tools are configured and
installed with different --prefix option.

On the other hand, even when 'newlib' is in the source tree, the include path
for 'gcc' for building libgcc2 is set so that installation directories are
searched before newlib directories in the current build tree. It could
potentially bring different results depending on either another version of
newlib is already installed or not. I usually clean corresponding parts of
installation directory before build to be on the safe side.

Another question related to "single tree" approach. How do I instruct
configuration tools to don't build some components that are present in the
source tree, or, alternatively, select those components that should be built?

Thanks in advance.

BR,
Sergei Organov



More information about the Gcc-help mailing list