Subject: GCC 2.95.2 new patch made for cross-compiler inhibit_libc stuff and still some questions

From: "Bas Mevissen" <[email-masked]>
Date: Wed, 10 Nov 1999 10:55:03 +0100

This is a long mail, there are a few short questions below. Maybe you don't
need the extra info.

Hi,

I'm trying to get a working cross-development environment for arm-linux
kernel development. I'm getting close, but still not there. For building the
Arm cross compiler (from i686-linux host), I use the following files:

-    gcc-2.95.tar.gz (GNU)
-    gcc-2.95-2.95.1-diff.gz (GNU)
-    gcc-2.95.1-2.95.2-diff.gz (GNU)
-    gcc-2.95.2-diff-991022.gz (Chris) Does not apply cleanly:

Changelog.rej:
***************
*** 1,3 ****
  Mon Aug 16 01:29:24 PDT 1999 Jeff Law  ([email-masked])

   * gcc-2.95.1 Released.
--- 1,7 ----
+ 1999-09-10  Philip Blundell  <[email-masked]>
+
+  * config.guess, config.sub: Import from latest autoconf.
+
  Mon Aug 16 01:29:24 PDT 1999 Jeff Law  ([email-masked])

   * gcc-2.95.1 Released.

-    Patch from me (forgot -u option...):

file gcc/libgcc2.c: (moved xcc -> inhibit stuff upwards and added anidecl.h
to let machmode.h compile)
34a35,42
>
> /* In a cross-compilation situation, default to inhibiting compilation
>    of routines that use libc.  */
>
> #if defined(CROSS_COMPILE) && !defined(inhibit_libc)
> #define inhibit_libc
> #endif
>
42a51,52
> #else
> #include <ansidecl.h> // for PROTO in machmode.h
60,66d69
< /* In a cross-compilation situation, default to inhibiting compilation
<    of routines that use libc.  */
<
< #if defined(CROSS_COMPILE) && !defined(inhibit_libc)
< #define inhibit_libc
< #endif
<
3033a3037
> #ifndef inhibit_libc
3034a3039
> #endif

gcc/frame.c (?) (added xcc -> inhibit stuff)
35a36,42
> /* In a cross-compilation situation, default to inhibiting compilation
>    of routines that use libc.  */
>
> #if defined(CROSS_COMPILE) && !defined(inhibit_libc)
> #define inhibit_libc
> #endif
>

I've compiled cross-binutils from binutils-2.9.1.0.23 (without patches) and
installed in /opt/arm:
In build dir:

../sourcedir/configure --prefix=/opt/arm --build=i686-linux --host=i686-linu
x --target=arm-linux
    make
    make install

Then:

#installing linux stuff (is in /opt/arm/linux, with include/asm ->
include/asm-arm)
# symlink /opt/arm/arm-linux/include/asm -> ../../linux/include/asm
# symlink /opt/arm/arm-linux/include/linux -> ../../linux/include/linux

mkdir build-gcc
cd build-gcc
../gcc-2.95.2-mine/configure --prefix=/opt/arm --build=i686-linux --host=i68
6-linux --target=arm-linux
make cross
(fails on building libio, because of lack of glibc header files)
cd gcc
make
make install
(this does actually build and install cross-compiler)

Questions:

- Should I apply patches to the binutils package or use binutils-2.9.5.x.x?
Did i compile the binutils right?

- I put everything in /opt/arm because the files of the binutils are
interfering with the ones installed for the native compiler. Is there an
elegant way to let them coexist? I saw a solution of using a wrapper script
for using dislocated binutils support files with the cross-tools, but that
was not nice...

- Is it right to use the kernel includes the way I do? Wouldn't it be better
to use a --local-include=/opt/arm/include to force using
/opt/arm/include/{asm,linux} for the kernel includes? In that case, I can
use /opt/arm/include for the glibc includes. Is glibc-2.1.2 a good choice?

- Is my patch OK? It is somewhat crippled because it was too late tonight
:-) I used LIBGCC2_CFLAGS="-Dinhibiti_libc" make before and that worked too!

- Do I need libio? Does it really need the glibc header files? How can I
avoid libio from building?

Bas.

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]
++        Please use [email-masked] for           ++
++                        kernel-related discussions.                      ++

---

From: Philip Blundell <[email-masked]>
Date: Wed, 10 Nov 1999 10:55:11 +0000

>Did i compile the binutils right?

Use 2.9.5.  Yes, your compilation options were fine.

>elegant way to let them coexist?

It should happen automatically.  What are the actual problems you see?

>use /opt/arm/include for the glibc includes.

No.  The cross-compiler will look in $PREFIX/arm-linux/include and this is 
where you should put the headers.

>Is glibc-2.1.2 a good choice?

Yes.

>avoid libio from building?

No, you probably don't want it.  Yes, it really does need the header files.  
The easy way to stop it building is just to delete it from your source tree 
before running configure.

p.

---

From: "Bas Mevissen" <[email-masked]>
Date: Wed, 10 Nov 1999 13:08:03 +0100

----- Original Message -----
From: Philip Blundell <[email-masked]>
To: Bas Mevissen <[email-masked]>
Cc: <[email-masked]>
Sent: Wednesday, November 10, 1999 11:55
Subject: Re: GCC 2.95.2 new patch made for cross-compiler inhibit_libc stuff
and still some questions

| >- Should I apply patches to the binutils package or use
binutils-2.9.5.x.x?
| >Did i compile the binutils right?
|
| Use 2.9.5.  Yes, your compilation options were fine.
|
OK. Can I safely upgrade my native binutils for i686 too or can the two
versions (2.9.1.x.x and 2.9.5.x.x) coexist?

| >- I put everything in /opt/arm because the files of the binutils are
| >interfering with the ones installed for the native compiler. Is there an
| >elegant way to let them coexist?
|
| It should happen automatically.  What are the actual problems you see?
|

I did not try it, I just looked for duplicate, different(*) files and found
them: /usr/lib/lib{bfd,opcodes,iberty}*. I understand that when you compile
a new binutils, it will read the current supported targets. But what if I
distribute it in binaire form?

(*) different from the native binutils already installed.

What I would like to do is build separate cross packages that just add files
and do not replace anything. I have to get deeper into this.

| >- Is it right to use the kernel includes the way I do? Wouldn't it be
better
| >to use a --local-include=/opt/arm/include to force using
| >/opt/arm/include/{asm,linux} for the kernel includes? In that case, I can
| >use /opt/arm/include for the glibc includes.
|
| No.  The cross-compiler will look in $PREFIX/arm-linux/include and this is
| where you should put the headers.
|
Just to be sure: that's the right place for the glibc header files too? That
makes sense to me, because then you can use an other version of the
c-library for the arm cross-builds.

| >- Do I need libio? Does it really need the glibc header files? How can I
| >avoid libio from building?
|
| No, you probably don't want it.  Yes, it really does need the header
files.
| The easy way to stop it building is just to delete it from your source
tree
| before running configure.
|
OK. I'll see if I can make a patch for cleanly exclude it from the build,
without removing files.
BTW. Where is libio for?

Thanks for the answers so far.

Bas.

---

From: Philip Blundell <[email-masked]>
Date: Wed, 10 Nov 1999 12:11:11 +0000

>versions (2.9.1.x.x and 2.9.5.x.x) coexist?

Either.  It should be safe to use 2.9.5 for x86 but the two can also coexist.

>distribute it in binaire form?

If those are static libraries (.a) then you can safely not distribute them - 
nothing uses them at run time.  The only problem you will have is if you 
configure with "--enable-shared" in which case you will end up with clashing 
versions of libbfd.so and friends; the solution is just to not do that.

Yes.

>BTW. Where is libio for?

It provides I/O stream functions.  I think the iostream component of libstdc++ 
rests on it.  The stdio library in C also uses libio but libc contains its own 
copy.

p.