Difference between revisions of "Cross Compiling"

From CSCWiki
Jump to navigation Jump to search
Line 1: Line 1:
Instructions for compiling an i386 multlib toolchain:
+
Instructions for compiling a toolchain:
 +
 
 +
* ARCH = architecture (arm, i386, etc...)
  
 
* Install apt-cross, dpkg-cross, autoconf, automake, gawk, flex, bison, debhelper, devscripts, cdbs, fakeroot
 
* Install apt-cross, dpkg-cross, autoconf, automake, gawk, flex, bison, debhelper, devscripts, cdbs, fakeroot
* Download i386 binary packages of linux-kernel-headers, libc6, libc6-dev, libc6-amd64, libc6-dev-amd64
+
* Download $ARCH binary packages of linux-kernel-headers, libc6, libc6-dev
* Run 'dpkg-cross -a i386 -b package' for each of the above packages
+
* Run 'dpkg-cross -a $ARCH -b package' for each of the above packages
 
* Install the resulting cross packages that were created by dpkg-cross above
 
* Install the resulting cross packages that were created by dpkg-cross above
 
* 'apt-get source' binutils and gcc-4.1
 
* 'apt-get source' binutils and gcc-4.1
 
* cd binutils and run:
 
* cd binutils and run:
** TARGET=i486-linux-gnu fakeroot debian/rules binary-cross
+
** TARGET=$ARCH-linux-gnu fakeroot debian/rules binary-cross
 
* Install resulting cross binutils
 
* Install resulting cross binutils
 
* cd gcc-4.1 and run:
 
* cd gcc-4.1 and run:
** export GCC_TARGET=i386
+
** export GCC_TARGET=$ARCH
 
** export DEB_CROSS_INDEPENDENT=yes
 
** export DEB_CROSS_INDEPENDENT=yes
 
** export WITHOUT_LANG=java,fortran,pascal,obj,obj-c++,ada,treelang
 
** export WITHOUT_LANG=java,fortran,pascal,obj,obj-c++,ada,treelang

Revision as of 04:26, 9 September 2007

Instructions for compiling a toolchain:

  • ARCH = architecture (arm, i386, etc...)
  • Install apt-cross, dpkg-cross, autoconf, automake, gawk, flex, bison, debhelper, devscripts, cdbs, fakeroot
  • Download $ARCH binary packages of linux-kernel-headers, libc6, libc6-dev
  • Run 'dpkg-cross -a $ARCH -b package' for each of the above packages
  • Install the resulting cross packages that were created by dpkg-cross above
  • 'apt-get source' binutils and gcc-4.1
  • cd binutils and run:
    • TARGET=$ARCH-linux-gnu fakeroot debian/rules binary-cross
  • Install resulting cross binutils
  • cd gcc-4.1 and run:
    • export GCC_TARGET=$ARCH
    • export DEB_CROSS_INDEPENDENT=yes
    • export WITHOUT_LANG=java,fortran,pascal,obj,obj-c++,ada,treelang
    • export DEB_CROSS_NO_BIARCH=yes
    • debian/rules control
    • dpkg-buildpackage -b -rfakeroot
    • On the alpha, gcc will fail to build do to a small error:
      • src/libmudflap/mf-runtime.c:172: the type on __mf_lc_mask needs to be set to __mf_uintptr_t
      • dpkg-buildpackage -b -rfakeroot -nc
  • Install resulting cross gcc-4.1

It's generally useful to upload these built packages to the CSC debian repository. To do this you need to scp the .deb's over to natural-flavours and run 'rrr includedeb etch deb-files...'.

If you need i386 binary libraries, you can run 'apt-cross -a i386 -i package'.

sun4u

  • DEB_TARGET_GNU_TYPE=sparc-sun-solaris2.8
  • DEB_TARGET_ALIAS=sparc-sun-solaris2.8
  • DEB_TARGET_ARCH=sparc-sun-solaris2.8