** Description changed:

  Binary package hint: gcc
  
  Ubuntu's 64-bit platform is becoming more popular, especially with
  software developers. It would be great if we could have a
  "gcc-x86-32-cross" meta-package to ease the learning-curve of
  discovering which libraries and tools need installing to build 32-bit
  executables on the 64-bit architecture.
  
  I've just gone through this and it took almost an hour of searching,
  cross-referencing, and testing to be sure I'd got it sorted.
  
  I need to do both kernel and user-space application cross-compilation
  for x86 64- and 32-bit debugging. I'm still working on ensuring the
  kernel build can be done both ways (64-bit on 32-bit, and 32-bit on
  64-bit).
  
  32-bit cross-compilation needs:
  
  $ apt-get install ia32-libs lib32gcc1 lib32stdc++6 libc6-dev-i386 gcc-
  multilib
  
- And then use the gcc flag '-m32', either added to CCFLAGS in the
- Makefile or directly:
+ And then use the gcc flag '-m32', either added to CFLAGS in the Makefile
+ or directly. The -m32 flag must also be supplied as part of EXTRA_CFLAGS
+ and LDFLAGS in order to produce 32-bit object files to link against
+ 32-bit libraries.
  
- $ gcc -m32 program.c -o program
+ e.g. Makfile:
+ 
+ CC=gcc
+ CFLAGS+=-m32
+ EXTRA_CLFAGS+=-m32
+ LDFLAGS+=-m32
+ 
+ Manual compile and link:
+ 
+ $ gcc -m32 -c -o program.o program.c
+ $ gcc -m32 program.o -o program
  
  $ file program
  program: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for 
GNU/Linux 2.6.8, dynamically linked (uses shared libs), not stripped
  
  $ uname -m
  x86_64

-- 
[Wishlist] gcc-x86-32-cross compiler meta-package
https://bugs.launchpad.net/bugs/144311
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to