This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: some questions for building newlib


zsz wrote:
> 
> Hello all,
> 
>         Recently , I tried to build a cross-development environment
> for 'arm-elf' target on PentiumIII667 computer. OS is Red Hat 6.1.
> newlib version is 1.8.2 . gcc is 2.95.2 . binutils is 2.10.0.12 .
> insight
> is 5.0 . I has successfully builded binutils , gcc , insight and newlib.
> 
> Today , I checked out mailing list of newlib and taked some
> questions . These questions go as follows:
> 
> 1.I know that, to configure gcc,option '--with-newlib' is required. So
> Does configure need a option '--with-headers' to
> point somewhere path of newlib ? If  needed, Which path of newlib it
> should point  to?
> 

It is strongly recommended that you unpack gcc/binutils/newlib all in the
same source directory and build in a single build tree, distinct from the source tree.  
In such a case, configure will set --with-newlib automatically.

If you, for some strange reason, insist of having separate source/build
trees for the components, then you need to specify --with-newlib so
libgcc.a will be built correctly.  The --with-headers option must be
used to point to target header files.  The majority of these can be found in 
newlib/libc/include.  It should be noted that the --with-headers option
only specifies one directory.  In some cases, platforms may specify platform-specific
header files in the machine or sys directories which will overwrite the ones
in libc/include during install.  In such a case, you would have to do this manually after
configuring and before building gcc or else you would have to do the process
again and this time point to the installed newlib header files.  I have never
tried this - I always use a single source tree / single build tree.  Talking
to the gcc folks, there is no certainty that gcc's make process wouldn't attempt to access
something in newlib after --with-newlib is specified.

> 2.Is setting environment variable CC,AR,AS and RANLIB required before
> complie newlib in native ?
>

It is the target tools you want to specify, not the host tools (CC_FOR_TARGET,
AS_FOR_TARGET, AR_FOR_TARGET, NM_FOR_TARGET, RANLIB_FOR_TARGET).

Again, you are better off having unified src/build trees.  By default,
the top level Makefile.in will set these up to be the build versions of the
tools (e.g. build_path/gas/as-new) if the tools can be located.  Thus,
in the unified build tree, you do not have to do anything.

If the "-new" tools cannot be found, then Makefile.in uses the target name
to create the target tool (e.g. arm-elf-as or arm-elf-gcc).  You can either
place the install directories for these tools in your path or else you
can manually set the CC_FOR_TARGET, etc.. flags when you issue the top
level make invocation.

> 3.What files is generated after successfully compile newlib? and Where
> they are placed ?
> 

The main pieces are libc.a, libg.a, libm.a, the libgloss library(s), crtx objects,
ld scripts, and target includes.  The target includes are installed in the
install_directory/TARGET/include (where TARGET is based on the configuration
target - e.g. arm-elf).  The remaining files are installed in the install_directory/TARGET/lib.
It should be noted that if multilibs exist (multiple versions of libraries built with different
options - e.g. cpu variants/endianness options), they will be installed in subdirectories of
lib.  Multiple option combinations are specified as further subdirectories (e.g. be (big-endian)
cpu1 libraries/libgloss might be found in install_directory/TARGET/lib/be/cpu1).  The compiler
when used to compile/link knows which subdirectories to use to properly link in the correct
libraries.  You can see the various multilibs by invoking the compiler with the -print-multi-lib
option.


-- Jeff Johnston (Red Hat Inc.)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]