Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to compile a 32 bit version of python on a 64 bit ubuntu system with the following configure command:

CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \ -Lpwd/lib32 -Wl,-rpath,/lib32 \
    -Wl,-rpath,/usr/lib32" \ ./configure --prefix=/opt/pym32

then make, make install. No errors, but it should be something wrong because a "readelf -h python" tells me that python was build as a ELF64 instead.

share|improve this question
    
you are "readelf'ing" the correct python - are you picking up the default 64bit python ? i.e. which python –  fossfreedom Sep 5 '11 at 10:51
    
yep :( i used an absolutepath to readelf: readelf -h /opt/pym32/bin/python –  Gabriele B Sep 5 '11 at 11:32
    
Is using chroot an option? –  Nathan Osman Sep 5 '11 at 16:52
    
yes, actually it is...i was just wondering for a one-line solution –  Gabriele B Sep 6 '11 at 10:39
    
Here is chroot instructions for chroot'ed Python: opensourcehacker.com/2010/08/03/… –  Mikko Ohtamaa Sep 10 '11 at 18:14
add comment

2 Answers

up vote 2 down vote accepted

Use "--build" and "--host".

./configure --help
System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

You need to use ./configure --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu to compile for 32-bit Linux in a 64-bit Linux system. You still need to add the other ./configure options.

share|improve this answer
    
tnx a lot! it works perfectly :) –  Gabriele B Nov 18 '11 at 8:13
add comment

If you want the compile to be debuged, you should post (in a pastebin) your verbose output from gcc. Otherwise, it's impossible to know.

The suggested solution of using chroot may help you and Mikko kindly offers a link to guide users in how to use chroot for 32bit python on a 64bit machine:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.