Fri Feb 26 17:05:42 EST 2016

Debian multiarch linker flags

I want to build a 32bit intel binary on a 64bit system.
I solved this problem before...

Excerpt, with multiarch:

ifeq ($(shell uname -m), x86_64)
## Build 32-bit binaries (emu_portcon.elf needs 32bit pointers)
GCC_DIR             := /usr/lib/gcc/i586-linux-gnu/4.9/
USR_LIB_DIR         := /usr/lib/i386-linux-gnu/
LIB_DIR             := /lib/i386-linux-gnu/
PLATFORM_LDFLAGS    := -m32 -L$(GCC_DIR) -L$(LIB_DIR) -L$(USR_LIB_DIR) -nostdlib
PLATFORM_STARTFILES := $(USR_LIB_DIR)/crt1.o $(USR_LIB_DIR)/libc.a -lgcc_s

This produces binaries that crash in exit() on tp.
Let's do it the right way...

Ok, likely not the right gcc version.
Nope.  2 hosts do not have this, but tp does.  Let's upgrade.

This upgrade fixed it:

ii  libc6-i686:i386                   2.19-18+deb8u2
ii  libc6-i686:i386                   2.21-9