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.

Is there any method to cross-compile application for 32-bit (under 64-bit host) with bfd support.

# compiles fine for host
$ g++ -m64 test.cpp -liberty -lbfd

# can't find 32-bit iberty and bfd
$ g++ -m32 test.cpp -liberty -lbfd
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../libiberty.a when searching for -liberty
/usr/bin/ld: skipping incompatible /usr/lib/libiberty.a when searching for -liberty
/usr/bin/ld: cannot find -liberty
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../libbfd.so when searching for -lbfd
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../libbfd.a when searching for -lbfd
/usr/bin/ld: skipping incompatible /usr/lib/libbfd.so when searching for -lbfd
/usr/bin/ld: skipping incompatible /usr/lib/libbfd.a when searching for -lbfd
/usr/bin/ld: cannot find -lbfd
collect2: error: ld returned 1 exit status

The problem I can't install binutils-dev:i386, because it apt-get asks to remove 64-bit binutils.

$ sudo apt-get install binutils:i386 binutils-dev:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
....
The following packages will be REMOVED:
  binutils binutils-arm-linux-gnueabi binutils-dev binutils-mingw-w64-i686 .....
  ...

So, is there any other method to compile it without i386 chroot environment?

share|improve this question
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.