Re: Build cross compiler for Raspberry Pi

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

 



Hi,

You are great!!! ^_^. The stage 2 compilation was successful! These
are the steps I did:

# prepare fonders
mkdir -p /opt/rpi/src
mkdir -p /opt/rpi/build

# build binutils-2.29
mkdir -p /opt/rpi/build/binutils-2.29
cd /opt/rpi/build/binutils-2.29
../../src/binutils-2.29/configure --with-sysroot=/opt/rpi/sysroot
--prefix=/opt/rpi --disable-nls --target=arm-linux-gnueabihf
--disable-multilib
make
make install

# build stage 1 of gcc-7.2.0
export PATH=/opt/rpi/bin:${PATH}
mkdir -p /opt/rpi/build/gcc-7.2.0
cd /opt/rpi/build/gcc-7.2.0
../../src/gcc-7.2.0/configure --prefix=/opt/rpi
--target=arm-linux-gnueabihf --enable-languages=c --without-headers
--disable-nls --disable-multilib --disable-threads --disable-shared
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc

# install linux header
cd /opt/rpi/src
git clone https://github.com/raspberrypi/linux.git
cd linux
mkdir -p /opt/rpi/sysroot/usr
make headers_install ARCH=arm INSTALL_HDR_PATH=/opt/rpi/sysroot/usr

# build glibc-2.26
cd /opt/rpi/build/glibc-2.26
../../src/glibc-2.26/configure --prefix=/usr
--host=arm-linux-gnueabihf --with-headers=/opt/rpi/sysroot/usr/include
--disable-multilib
make
make install DESTDIR=/opt/rpi/sysroot

# build stage 2 of gcc 7.2.0
cd /opt/rpi/build/gcc-7.2.0-final
../../src/gcc-7.2.0/configure --prefix=/opt/rpi
--target=arm-linux-gnueabihf --enable-languages=c,c++ --disable-nls
--disable-multilib --with-sysroot=/opt/rpi/sysroot
make
make install

All steps ok on my CentOS 7 x86_64 desktop. Tomorrow I will replicate
the steps on another host.

Thank you Christer!! :-)



2017-08-16 14:36 GMT+01:00 Christer Solskogen <christer.solskogen@xxxxxxxxx>:
> On 16-Aug-17 15:14, Avelino Herrera Morales wrote:
>>
>> Hi Christer,
>>
>> thankyou very much for your help. I have tested your changes:
>>
>> For binutils 2.26:
>> $ configure --prefix=/opt/rpi --with-sysroot=/opt/rpi/sysroot
>> --disable.nls --target=arm-linux-gnueabihf --disable-multilib
>> $ make
>> $ make install
>>
>> For stage 1 of gcc 7.2.0:
>> $ configure --prefix=/opt/rpi --target=arm-linux-gnueabihf
>> --enable-languages=c --without-headers --disable-nls
>> --disable-multilib --disable-threads --disable-shared
>> $ make all-gcc all-target-libgcc
>> $ make install-gcc install-target-libgcc
>>
>> For linux kernel headers (following your suggestion):
>> $ cd linux
>> $ make headers_install ARCH=arm INSTALL_HDR_PATH=/opt/rpi/sysroot
>>
>> For glibc 2.29 (following your suggestion):
>> $ configure --prefix=/usr --host=arm-linux-gnueabihf
>> --with-headers=/opt/rpi/sysroot/include --disable-multilib
>> $ make
>> $ make install DESTDIR=/opt/rpi/sysroot
>>
>> Until this point everyting ok (I realized that now /opt/rpi/sysroot is
>> populated with /usr and the rest of standard folders and with include
>> files). The problem arises when compiling stage 2 of gcc using the
>> modifications you suggested (I use separated build folders for stages
>> 1 and 2):
>>
>> $ configure --prefix=/opt/rpi --target=arm-linux-gnueabihf
>> --enable-languages=c,c++ --disable-nls --disable-multilib
>> --with-sysroot=/opt/rpi/sysroot
>> $ make
>>
>> The process terminates with the following output:
>>
>> /opt/rpi/build/gcc-7.2.0-final/./gcc/xgcc
>> -B/opt/rpi/build/gcc-7.2.0-final/./gcc/
>> -B/opt/rpi/arm-linux-gnueabihf/bin/
>> -B/opt/rpi/arm-linux-gnueabihf/lib/ -isystem
>> /opt/rpi/arm-linux-gnueabihf/include -isystem
>> /opt/rpi/arm-linux-gnueabihf/sys-include    -g -O2 -O2  -g -O2
>> -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing
>> -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
>> -Wold-style-definition  -isystem ./include   -fPIC -fno-inline -g
>> -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fPIC
>> -fno-inline -I. -I. -I../.././gcc -I../../../../src/gcc-7.2.0/libgcc
>> -I../../../../src/gcc-7.2.0/libgcc/.
>> -I../../../../src/gcc-7.2.0/libgcc/../gcc
>> -I../../../../src/gcc-7.2.0/libgcc/../include  -DHAVE_CC_TLS  -o
>> _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c
>> ../../../../src/gcc-7.2.0/libgcc/libgcc2.c -fvisibility=hidden
>> -DHIDE_EXPORTS
>> In file included from /opt/rpi/sysroot/usr/include/errno.h:28:0,
>>                   from
>> ../../../../src/gcc-7.2.0/libgcc/../gcc/tsystem.h:93,
>>                   from ../../../../src/gcc-7.2.0/libgcc/libgcc2.c:27:
>> /opt/rpi/sysroot/usr/include/bits/errno.h:26:11: fatal error:
>> linux/errno.h: No such file or directory
>>   # include <linux/errno.h>
>>
>> Any idea or suggestion?
>>
>
> Yes. Don't listen to me ;-)
> The kernel headers should go to sysroot/usr(include) not sysroot/(include)
> You can just move the ones in sysroot/include to sysroot/usr/include and you
> should be good to go.
>
>



-- 
Avelino Herrera Morales
http://avelino.atlantes.org
https://twitter.com/avelinohm
https://facebook.com/avelinoherrera
https://plus.google.com/+AvelinoHerreraMorales



[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