GCC - Best way to build cross compiler?



Hi all,

So, I want to create packages for a cross compiler targeting powerpc-wrs-vxworks on Wheezy. I don't exactly know how to approach the problem.

With binutils it's easy enough to just grab the sources with apt-get source and then run 'TARGET=powerpc-wrs-vxworks debuild'. However, it's a little different with gcc.

With GCC, it's a little more difficult. I need to have a little more control over the flags passed to configure. At the same time, the debian/rules et al for gcc is _very_ intimidating. I could make my own source package, but that seems like a lot of duplicated effort. At the same time, because I need a very specialized build (I need to add a dependency on a custom package, add some patches, and exactly control configure flags) that seems like the only option available to me. PLEASE, stop me now if I'm not seeing the solution in front of my face - I really did try to sort through all of the debian sources!

On the other hand, it seems like it would be nice if environment variables for build/host/target and appending to configure flags is standardized and documented. It may be (/probably is), but I didn't see it :-(, at least for pre-written debian/rules scripts - debhelper >= 7 makes everything easier if you're writing from scratch.

One more thing- why are there so many build-depends for gcc? I've successfully built gcc many times before and never needed all of those - just the compiler, mpfr-dev, mpc-dev, gmp-dev, and build-essential. Please forgive the ignorance :-)

OK, so how I would try to do this is I would make two directories, gcc-4.7 and gcc-4.7-src. I would make a script in gcc-4.7, and name it configure:

#!/bin/sh

../gcc-4.7-src/configure "$@"

Then I'd run dh_make -p..., edit debian/*, and then in debian/rules:

#!/usr/bin/make -f
export DH_OPTIONS

override_dh_auto_configure:
dh_auto_configure -- \
--target=powerpc-wrs-vxworks \
#lots of compile options, etc.

%:
dh $@ --with autotools-dev

Then, hopefully, just a simple debuild would work. Then I'd just copy over the debian/control files from my box and edit them appropriately.

Any feedback/sanity checking would be AWESOME. Thank you all,

--
rbmj


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/4FB1A820.8060007@xxxxxxxxxxx



Relevant Pages

  • Re: GCC - Best way to build cross compiler?
    ... it's a little different with gcc. ... the debian/rules et al for gcc is _very_ intimidating. ... At the same time, because I need a very specialized build (I need to add a dependency on a custom package, add some patches, and exactly control configure flags) that seems like the only option available to me. ... I've successfully built gcc many times before and never needed all of those - just the compiler, mpfr-dev, mpc-dev, gmp-dev, and build-essential. ...
    (Debian-User)
  • C preprocessor "/lib/cpp" fails sanity check
    ... do with that package, but probably more with my system... ... installing a compiler, binutils and glibc on my ttylinux-based system. ... It was created by GNU make configure 3.81, ... configure:1831: checking for gcc ...
    (comp.os.linux.misc)
  • Re: Troubles with pfil (needed for ipfitler) with 32-bit Sun.
    ... >>I wanted to add ipfilter to a Sun, so thought whilst I was doing it, I ... >>compiler there, so used gcc. ... > This happens during package making and is pretty much benign.. ...
    (comp.sys.sun.admin)
  • gcc error
    ... I encountered a gcc problem after upgrading various other packages. ... checking whether the C compiler works... ... This is the GNU C compiler, a fairly portable optimizing compiler for C. ... This is a dependency package providing the default GNU C compiler. ...
    (Debian-User)
  • Re: Whats the story with the "end of XP"?
    ... Support gives them access to the larger body ... The same compiler suite may be "best" in both ... In the case of ByteCraft compilers, you are truly expert in your field, you work closely and rapidly with customers if there are any issues, and you have top class testing and quality control. ... understanding the inner workings of a relatively simple compiler like GCC ...
    (comp.arch.embedded)