[Distutils] cross compiling using setuptools

Venkat Bommakanti venkatbo at yahoo.com
Sun Oct 8 03:57:12 CEST 2006

Hi folks,

I have a need to cross compile (i686 linux build system -> ppc linux target system) some py/C source pkgs:
    . RuleDispatch-0.5a0.dev-r2115.tar.gz
    . cElementTree-1.0.5-20051216.zip
    . PyProtocols-1.0a0dev_r2082.zip
    . Cheetah-2.0rc7.tar.gz
to generate target-specific eggs... Actually, all are a part of TurboGears (TG).

I was able to download all the comps to a local directory (i686 linux with python 2.4.2 compiled from sources, w/zlib enabled). Now,
   . while in the download dir (curr-dir - .),
   . with PYTHONPATH that includes "<my-i686-root>/usr/lib/python2.4/site-packages", and 
   . with a command like:
        "easy_install --prefix=<my-i686-root>/usr -s <my-i686-root>/usr/bin -f . TurboGears"
I'm able to build the native i686 target and deploy the i686 eggs to :
just fine... No problem there.

Assuming I can use setuptools as-is and "easy_install ..." invoke syntax like above - for the cross build (ppc target), how would I specify the options meant for:
   . setup.py (of each of the above comps):

       . -c (cross-gcc)
       . bdest_egg (setuptools):
          .  --dist-dir
          .  --plat-name
          .  exclude-source
in the "easy_install ..." command. I read:
but its unclear how the above options are passed on to "easy_install ...".

I realize that I'd have to use a PYTHONPATH that includes something like:
for the ppc-target, so it doesn't complain about the:
   "bad install directory or PYTHONPATH"
error... Also, 'am assuming its not a problem to include a path to ppc-eggs in the PYTHONPATH setting, before invoking the "easy_install ..." command for the cross compile.

As an aside, would also like to know how I could enable the creation of target-specific .pyc files, in such a cross-compile scenario. I was able to build python itself in a cross compile (i686 build system -> ppc target system) mode, but the .pyc it generates appear to be i686-specific ones and not ppc-ones... when deployed to the ppc-system, it complains about the "bad magic number" error...

Much appreciate any help. Thanks.

More information about the Distutils-SIG mailing list