-----Original Message----- From: Prashant Batra (prbatra) Sent: Sunday, February 12, 2012 12:47 AM To: 'Jonathan Wakely' Cc: gcc-help@xxxxxxxxxxx Subject: RE: help needed for builing gcc tool-chain Thanks, Jonathan, I am able to install gcc 4.1.2 with following configuration: ../gcc-4.1.2/configure --prefix=/auto/nobackup-bgl-mitg-dev56/prbatra/fresh/build/ --enable-languages=c,c++,objc Now, the tool-chain is present in "prefix" directory. In second try, to make the tool-chain relocatable, I used --with-sysroot=<prefix-dir> while configuring. It fails saying /usr/include directory is not present in the <prefix-dir>. Have I missed something again? [Prashant] ../gcc-4.1.2/configure --prefix=/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build/ --with-sysroot=/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build/ --with-native-system-header-dir=sysroot --enable-languages=c,c++,objc I tried to configure like above, still it fails with - gcc.o g++spec.o intl.o prefix.o version.o ../libcpp/libcpp.a ../libiberty/libiberty.a echo | /auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/objdir/./gcc/xgcc -B/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/objdir/./gcc/ -B/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build//x86_64-unknown-linux-gnu/bin/ -B/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build//x86_64-unknown-linux-gnu/lib/ -isystem /auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build//x86_64-unknown-linux-gnu/include -isystem /auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build//x86_64-unknown-linux-gnu/sys-include -E -dM - | \ sed -n -e 's/^#define \([^_][a-zA-Z0-9_]*\).*/\1/p' \ -e 's/^#define \(_[^_A-Z][a-zA-Z0-9_]*\).*/\1/p' | \ sort -u > tmp-macro_list /bin/sh ../../gcc-4.1.2/gcc/../move-if-change tmp-macro_list macro_list echo timestamp > s-macro_list The directory that should contain system headers does not exist: /auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/build//usr/include make[2]: *** [stmp-fixinc] Error 1 make[2]: Leaving directory `/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/objdir/gcc' make[1]: *** [all-gcc] Error 2 make[1]: Leaving directory `/auto/nobackup-bgl-mitg-dev56/prbatra/fresh2/objdir' make: *** [all] Error 2 -----Original Message----- From: Jonathan Wakely [mailto:jwakely.gcc@xxxxxxxxx] Sent: Saturday, February 11, 2012 11:21 PM To: Prashant Batra (prbatra) Cc: gcc-help@xxxxxxxxxxx Subject: Re: help needed for builing gcc tool-chain On 11 February 2012 17:03, Prashant Batra (prbatra) wrote: > Hi All, > > I am trying to build a 32 bit gcc/g++ tool-chain on a x86_64 bit Intel machine with, Red Hat Linux Enterprise -5 (2.6.18 kernel). > > Gcc version of my machine is - > gcc -v > Using built-in specs. > Target: x86_64-redhat-linux > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux > Thread model: posix > gcc version 4.1.2 20080704 (Red Hat 4.1.2-48) > > I tried with the procedure mentioned on gnu wiki, also mentioned in LFS. But none of the attempts was successful. > > I have some basic questions here : > > Changing the prefix to some custom location other than /usr/src I think the default is /usr/local/, not /usr/src > should make all the tools installed in the custom location? Yes > I want to run the tool chain on this machine only, so my host and build systems are same, and I can omit them while configuring all my tools (binutils, gcc, glibc). > Is this correct? Yes. > The target of all these tools while configuring should be i486-gnu-linux or I can omit this so that the gcc/g++ gets compiled for x86_64 and when I need a 32 bit executable, > I can use -m32 switch while compiling? You can compile with -m32 to produce 32-bit output and you could add -march=i486 to ensure it will not use any instructions not available on an i486 processor. But if you want a compiler that always produces 32-bit output then yes, you could configure with --target=i486-gnu-linux instead. > Will 32 bit static and shared libraries be available in this case? Yes. > I want static libraries for both gcc and stdc++, is there any special flag that I should give/or not give to build these static libraries? No, they're built by default. > Can someone please point me in right directions, as I am doing this for the first time? Any links to the steps will be really helpful. I already gave you http://gcc.gnu.org/wiki/InstallingGCC - if that doesn't work you need to say how you configured and what errors you get, it should work fine. It will help if you stop creating a new thread for every mail and reply to mail in an existing thread, so we can see the thread history more easily.