2014-04-08 20:22 GMT+08:00 David Guillen <da...@davidgf.net>:
> Can you check whether crt1.o and crt1.o exist? And the path where they do 
> live.
> Also it would be interesting to know the exact commandline (check config.log).
Do you mean the commanline I build , here is :

The total command list

0 perpare var in env
  modify .bashrc

        export HOST=x86_64-pc-linux-gnu
        export BUILD=$HOST
        export TARGET=x86_64-none-linux-gnu
        export CROSS_TOOL=/vita/cross-tool
        export CROSS_GCC_TMP=/vita/cross-gcc-tmp
        export SYSROOT=/vita/sysroot
        PATH=$CROSS_TOOL/bin:$CROSS_GCC_TMP/bin:/sbin:/usr/sbin:$PATH

1 build binutilss

cd /vita/
mkdir source build cross-tool cross-gcc-tmp sysroot
cd source/
cp -rf /mnt/hgfs/D/linux/source/* .
cd ..
cd build/
mkdir binutils-build
cd binutils-build/
../binutils-2.23.1/configure --prefix=$CROSS_TOOL --target=$TARGET
--with-sysroot=$SYSROOT
make -j2
make install

Now have ld and so on
modify .basrch  and source ~/.bashrc

    export AR="$TARGET-ar"
    export AS="$TARGET-as"
    export RANLIB="$TARGET-ranlib"
    export LD="$TARGET-ld"
    export STRIP="$TARGET-strip"

2 build freestanding compiler first perpare gmp source

cd /vita/
cd build/
tar -xvf ../source/gcc-4.7.2.tar.bz2
cd gcc-4.7.2/
tar -xvf ../../source/mpfr-3.1.1.tar.bz2
tar -xvf ../../source/mpc-1.0.1.tar.gz
tar -xvf ../../source/gmp-5.0.5.tar.bz2
mv gmp-5.0.5/ gmp
mv mpfr-3.1.1/ mpfr
mv mpc-1.0.1/ mpc
cd ..
mkdir gcc-build1
cd gcc-build1/
../gcc-4.7.2/configure --prefix=$CROSS_GCC_TMP --target=$TARGET
--with-sysroot=$SYSROOT --with-newlib --enable-languages=c
--with-mpfr-include=/vita/build/gcc-4.7.2/mpfr/src
--with-mpfr-lib=/vita/build/gcc-build1/mpfr/.libs --disable-shared
--disable-threads --disable-decimal-float --disable-libquadmath
--disable-libmudflap --disable-libgomp --disable-nls --disable-libssp
--disable-multilib
make -j2
make install
cd /vita/cross-gcc-tmp/
ln -s libgcc.a  lib/gcc/x86_64-none-linux-gnu/4.7.2/libgcc_eh.a

now have a cc
modify .bashrc

    export CC="$TARGET-gcc"


3 build glibc

cd ..
cd build/
tar -xvf ../source/linux-3.7.4.tar.xz
cd linux-3.7.4/
make mrproper
make ARCH=x86_64 headers_check
make ARCH=x86_64 INSTALL_HDR_PATH=$SYSROOT/usr/ headers_install

cd ..
tar -xvf ../source/glibc-2.15.tar.xz glibc-2.15/
cd glibc-2.15/
../glibc-2.15/configure --prefix=/usr --host=$TARGET
--enable-kernel=3.7.4 --enable-add-ons
--with-headers=$SYSROOT/usr/include libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes libc_cv_ctors_header=yes
patch -pl < ../../source/glibc-2.15-cpuid.patch
patch -p1 < ../../source/glibc-2.15-s_frexp.patch
make -j2
make install_root=$SYSROOT install

now have glibc crt1.o in $sysroot/usr/lib64/
vita@engine-virtual-machine:/vita$ ls sysroot/usr/lib64/*.o
sysroot/usr/lib64/crt1.o  sysroot/usr/lib64/crtn.o   sysroot/usr/lib64/Mcrt1.o
sysroot/usr/lib64/crti.o  sysroot/usr/lib64/gcrt1.o  sysroot/usr/lib64/Scrt1.o


4 build second pass gcc
cd ..
mkdir gcc-build2
cd gcc-build2/

../gcc-4.7.2/configure --prefix=$CROSS_TOOL --target=$TARGET
--with-sysroot=$SYSROOT
--with-mpfr-include=/vita/build/gcc-4.7.2/mpfr/src
--with-mpfr-lib=/vita/build/gcc-build2/mpfr/src/.libs
--enable-languages=c,c++ --enable-threads=posix



attach the config.log






>
> 2014-04-08 14:13 GMT+02:00 Mo Jia <life.130...@gmail.com>:
>> Try to make a gcc cross compiler ,
>>
>> 0 perpare vars in env
>>
>>         export HOST=x86_64-pc-linux-gnu
>>         export BUILD=$HOST
>>         export TARGET=x86_64-none-linux-gnu
>>         export CROSS_TOOL=/vita/cross-tool
>>         export CROSS_GCC_TMP=/vita/cross-gcc-tmp
>>         export SYSROOT=/vita/sysroot
>>         PATH=$CROSS_TOOL/bin:$CROSS_GCC_TMP/bin:/sbin:/usr/sbin:$PATH
>>
>> 1 build binutilss
>>
>>      ../binutils-2.23.1/configure --prefix=$CROSS_TOOL \
>>      --target=$TARGET --with-sysroot=$SYSROOT
>>
>>  build success
>>  then add this lines to .bashrc And this want build glibc next use the
>> tools I just build
>>
>>     export AR="$TARGET-ar"
>>     export AS="$TARGET-as"
>>     export RANLIB="$TARGET-ranlib"
>>     export LD="$TARGET-ld"
>>     export STRIP="$TARGET-strip"
>>
>> 2 build freestanding compiler first perpare gmp source
>>
>>      cd gcc-4.7.2/
>>      tar -xvf ../../source/mpfr-3.1.1.tar.bz2
>>      tar -xvf ../../source/mpc-1.0.1.tar.gz
>>      tar -xvf ../../source/gmp-5.0.5.tar.bz2
>>      mv gmp-5.0.5/ gmp
>>      mv mpfr-3.1.1/ mpfr
>>      mv mpc-1.0.1/ mpc
>>
>> then cd to gcc-build1
>>
>>     ../gcc-4.7.2/configure --prefix=$CROSS_GCC_TMP --target=$TARGET \
>>     --with-sysroot=$SYSROOT --with-newlib --enable-languages=c \
>>     --with-mpfr-include=/vita/build/gcc-4.7.2/mpfr/src \
>>     --with-mpfr-lib=/vita/build/gcc-build1/mpfr/src/.libs \
>>     --disable-shared --disable-threads --disable-decimal-float \
>>     --disable-libquadmath --disable-libmudflap --disable-libgomp \
>>     --disable-nls --disable-libssp --disable-multilib
>>
>>   succss . So add this line  the ~/.bashrc  (this will use this build
>> gcc to build a second gcc )
>>
>>
>>     export CC="$TARGET-gcc"
>>
>> 3 build glibc
>>
>>     ../glibc-2.15/configure --prefix=/usr --host=$TARGET \
>>     --enable-kernel=3.7.4 --enable-add-ons \
>>     --with-headers=$SYSROOT/usr/include\
>>     libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes \
>>     libc_cv_ctors_header=yes
>>
>> and make and install
>>
>>     make install_root=$SYSROOT install
>>
>> after install :
>>
>>      vita@engine-virtual-machine:/vita$ ls sysroot/usr/lib64/*.o
>>      sysroot/usr/lib64/crt1.o  sysroot/usr/lib64/crtn.o
>> sysroot/usr/lib64/Mcrt1.o
>>      sysroot/usr/lib64/crti.o  sysroot/usr/lib64/gcrt1.o
>> sysroot/usr/lib64/Scrt1.o
>>
>> 4 build second pass gcc  , cd to gcc-build2
>>
>>     ../gcc-4.7.2/configure --prefix=$CROSS_TOOL --target=$TARGET \
>>     --with-sysroot=$SYSROOT \
>>     --with-newlib --enable-languages=c,c++  \
>>     --with-mpfr-include=/vita/build/gcc-4.7.2/mpfr/src \
>>     --with-mpfr-lib=/vita/build/gcc-build2/mpfr/src/.libs \
>>     --disable-multilib --enable-threads=posix
>>
>> Here will be error
>>
>>     checking build system type... x86_64-unknown-linux-gnu
>>     checking host system type... x86_64-unknown-linux-gnu
>>     checking target system type... x86_64-none-linux-gnu
>>     checking for a BSD-compatible install... /usr/bin/install -c
>>     checking whether ln works... yes
>>     checking whether ln -s works... yes
>>     checking for a sed that does not truncate output... /bin/sed
>>     checking for gawk... gawk
>>     checking for libitm support... yes
>>     checking for gcc... x86_64-none-linux-gnu-gcc
>>     checking for C compiler default output file name...
>>     configure: error: in `/vita/build/gcc-build2':
>>     configure: error: C compiler cannot create executables
>>
>> Then I cd /vita/cross-gcc-tmp/bin The first pass install dir :
>>
>>     vita@engine-virtual-machine:/vita/cross-gcc-tmp/bin$
>> ./x86_64-none-linux-gnu-gcc test.c
>>     /vita/cross-tool/bin/x86_64-none-linux-gnu-ld: cannot find crt1.o:
>> No such file or directory
>>     /vita/cross-tool/bin/x86_64-none-linux-gnu-ld: cannot find crti.o:
>> No such file or directory
>>     collect2: error: ld returned 1 exit status
>>
>> (I install bintuils in /vita/cross-tool  and install tmp gcc in
>> /vita/cross-gcc-tmp )
>>
>> Here is question :
>> Seem  /vita/cross-tool/bin/x86_64-none-linux-gnu-ld  can't find crti.o
>> and  it don't know the $sysroot/usr/lib64 I already success build
>> So I am wondering the --with-sysroot=$SYSROOT  mean to search libs in
>> $SYSROOT, why it can't known ?
>>
>> Any suggestion ?

Attachment: config.log
Description: Binary data

Reply via email to