Hi -
Here are updates I just got working of Lennert and David's patches against current rawhide gcc and binutils:
binutils-2.20.51.0.12-2.fc15.src.rpm gcc-4.5.1-5.fc15.src.rpm
which generate updated binutils and gcc cross packages. The old ones are fine except that they're no longer able to build current kernels without errors.
They're tested to generate working cross compiler packages on x86_64 host; the compilers generate a working kernel.org kernel on iMX31 and can link a test app with printf() OK, since I just need them for kernel compile duties I didn't go any further with cross userspace.
You can use the patches like this:
1) Grab the source RPMs you want to build against
2) cd into your rpmbuild/SOURCES dir and use
rpm2cpio <source rpm> | cpio -id
to unpack, then mv *.spec ../SPECS
3) patch the binuntils.spec and gcc.spec files with the diffs; they should apply cleanly at least with exactly the rawhide sources above
4) rpmbuild -ba --define "binutils_target armv5tel-redhat-linux-gnueabi" rpmbuild/SPECS/gcc.spec
5) rpm -i rpmbuild/RPMS/x86_64/armv5tel-redhat-linux-gnueabi-binutils-2.20.51.0.12-2.fc15.x86_64.rpm
6) rpmbuild -ba --define="cross_target armv5tel-redhat-linux-gnueabi" rpmbuild/SPECS/gcc.spec
7) as root: cd rpmbuild/RPMS/x86_64 ; rpm -Uvf armv5tel-redhat-linux-gnueabi-gcc-4.5.1-5.cross12.x86_64.rpm armv5tel-redhat-linux-gnueabi-libgcc-4.5.1-5.cross12.x86_64.rpm armv5tel-redhat-linux-gnueabi-libgomp-4.5.1-5.cross12.x86_64.rpm armv5tel-redhat-linux-gnueabi-cpp-4.5.1-5.cross12.x86_64.rpm armv5tel-redhat-linux-gnueabi-libstdc++-4.5.1-5.cross12.x86_64.rpm
8) That's it!
-Andy
Hey Andy,
Thanks for sharing these steps.
- rpmbuild -ba --define "binutils_target armv5tel-redhat-linux-gnueabi"
rpmbuild/SPECS/gcc.spec
- rpmbuild -ba --define="cross_target armv5tel-redhat-linux-gnueabi"
rpmbuild/SPECS/gcc.spec
Providing cross_target and binutils_target seems to be a neat solution. However can it be applied to all SRPMs in Fedora universe?
If we can do that, then building packages for ARM would be faster I guess. ( I am not aware of various issues with buidling RPMs using cross compilers. )
/tuxdna
On 12/23/10 13:24, Somebody in the thread at some point said:
Hi -
Thanks for sharing these steps.
You're welcome.
- rpmbuild -ba --define "binutils_target armv5tel-redhat-linux-gnueabi"
rpmbuild/SPECS/gcc.spec
- rpmbuild -ba --define="cross_target armv5tel-redhat-linux-gnueabi"
rpmbuild/SPECS/gcc.spec
Providing cross_target and binutils_target seems to be a neat solution. However can it be applied to all SRPMs in Fedora universe?
If we can do that, then building packages for ARM would be faster I guess. ( I am not aware of various issues with buidling RPMs using cross compilers. )
Well, the blah_target macros are cheats, actually the spec files for those two particularly look for them and act quite differently if they're defined. It has to be done like that because in those cases in fact we're cooking host executables which happen to be configured for ARM; they're x86_64 executables and packages coming out still at the end for example. They're not actually cross compilation actions which would result in an armv5tel package coming out of an x86_64 host.
What you can do generically with rpmbuild for cross is use the --target=<arch> option to really get it to cross build and issue <arch> packages instead of host ones. I used this successfully to package the cross-built bootloader and kernel for an ARM Fedora-based device earlier in the year.
Many packages will eat that OK as well for cross build, it gets passed into ./configure and if the package is capable to configure itself to cross build it will do so.
However there are enough packages like perl that cannot cleanly build cross (it likes to build a "miniperl" executable with which it completes the build action; the cross-built miniperl won't work on the host) and enough problems from staging cross package installs (%pre and %post don't work) that you are way better off doing native build and reserving cross for stuff that really needs it like bootloader and kernel.
-Andy
tor 2010-12-23 klockan 18:54 +0530 skrev tuxdna:
If we can do that, then building packages for ARM would be faster I guess. ( I am not aware of various issues with buidling RPMs using cross compilers. )
Semi-cross builds is reasonable. That is an ARM build host using distcc to hosts of other architectures with suitable cross compilers for performing the CPU crunching.
Regards Henrik