Re: Building a cross compiler (Was: -Dinhibit_libc)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 17, 2007 at 12:12:14PM -0400, Kevin Yohe wrote:

> I'm still a bit confused.  When I download gcc, I get a tarball that
> extracts everything to ./gcc-4.x.x/, and likewise with newlib and binutils.
> Under that directory there is another directory called gcc that contains all
> the source files.  I have read somewhere that my directories should look
> something like this.
>
> src/
>       +-- gcc
>       +-- newlib
>       +-- binutils
> build/
>       +-- gcc
>       +-- newlib
>       +-- binutils
>
> Then you can do this
> cd build
> ../src/configure
> make
>
> That's all well and good but exactly how do I set this up with what I am
> given?

I don't know anything about making a combined source tree, but I can
tell you what I do to try out cross toolchains (I am trying to build
two, currently, one of which is a canadian cross.  They all involve
Kai's work on x86_64-pc-mingw32).  Note that I may be doing things
totally wrong (in which case, someone please tell me!)  But this works
for me... your mileage may vary.

First, I create some staging area for a new root:

mkdir /myroot, mkdir /tmp/myroot, mkdir /opt/root, etc etc.  Pick
whatever works for you.  I'll do /me so I can type less :)

I use this area for everything.  Now, all the tools support the use of
with-sysroot and --prefix.  I set both to this newly created path,
allowing me to put everything in a safe place using a system with
pre-existing stuff so I don't accidently break anything serious (I'm
VERY talented at destroying systems unknowingly.)

So try to follow these steps:

mkdir /me && cd /me && mkdir build && cd build && mkdir binutils gcc
&& cd binutils
cvs -Qz 9 -d :pserver:anoncvs@xxxxxxxxxxxxxx:/cvs/src co binutils
mkdir build && cd build
../src/configure --with-sysroot=/me --prefix=/me --disable-nls
--target=x86_64-pc-mingw32 > /dev/null
make > /dev/null
make install > /dev/null

cd ../../gcc
svn -q checkout svn://gcc.gnu.org/svn/gcc/trunk gcc-latest
mkdir build.core && cd build.core
../gcc-latest/configure --with-sysroot=/me --prefix=/me --disable-nls
--enable-languages=c --target=x86_64-pc-mingw32 > /dev/null
make all-gcc > /dev/null
make install-gcc > /dev/null


Now at this point you have to build some libraries.  I was using Kai's
libraries, as glibc doesn't support my target yet.  Do what you will
there.  When you are done and have installed them in /me, do this:

cd /me/build/gcc
mkdir build.full && cd build.full
../gcc-latest/configure --with-sysroot=/me --prefix=/me --disable-nls
--enable-languages=c,c++ --target=x86_64-pc-mingw32 > /dev/null
make > /dev/null
make install > /dev/null

Select all the languages you want.  I chose c and c++.

This should install a full compiler in your root.  Now just add
/me/bin to your path, and the x86_64-pc-mingw32-gcc (or whatever
target you build) executable will be available whenever you try to
cross compile a program.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux