Wind River Support Network

HomeDefectsLIN7-4263
Fixed

LIN7-4263 : How to compile a 32-bit program on 64-bit WindRiver7

Created: Jul 9, 2015    Updated: Sep 8, 2018
Resolved Date: Sep 24, 2015
Found In Version: 7.0
Fix Version: 7.0.0.10
Severity: Standard
Applicable for: Wind River Linux 7
Component/s: Build & Config, Toolchain, Userspace

Description

The customer wants to create a self host toolchains on a x86 64bit host.  He needs the compiler can also build 32 bit applications.   The compiler has been created , but it can not build 32bit applications.  This is the error message:

oot@windriver7:~/install# gcc helloworld.c -m32
/usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../../x86_64-wrs-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../x86_64-wrs-linux/4.9.1/libgcc.a when searching for -lgcc
/usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../../x86_64-wrs-linux/bin/ld: skipping incompatible /usr/lib64/x86_64-wrs-linux/4.9.1/libgcc.a when searching for -lgcc
/usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../../x86_64-wrs-linux/bin/ld: cannot find -lgcc
/usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../../x86_64-wrs-linux/bin/ld: skipping incompatible /lib64/libgcc_s.so when searching for -lgcc_s
/usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../../x86_64-wrs-linux/bin/ld: skipping incompatible /usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../libc.so when searching for -lc
/usr/lib64/gcc/x86_64-wrs-linux/4.9.1/../../../../x86_64-wrs-linux/bin/ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
collect2: error: ld returned 1 exit status

It seems some libraries for 32bit are missing.  

I also re-produce the issue on my environment.  These are the steps:

1.  configure the project in windriver 7:

$WIND_LINUX_CONFIGURE --enable-board=intel-x86-64 --enable-kernel=standard \
--enable-rootfs=glibc_std \
--enable-jobs=4 \
--enable-parallel-pkgbuilds=4 \
--enable-reconfig \
--with-template=feature/target-toolchain,feature/self-hosted,feature/toolchain-wrappers \
--with-package=kernel-dev

2. modify local.conf, add two lines:

MULTILIB = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
 
3.  add some 32 bit libs:
make  lib32-zlib.addpkg
make lib32-zlib.build

make   lib32-libgcc.addpkg
make  lib32-libgcc.build

4. make:
make
make usb-image


dd if=usb.img of=/dev/sdc

insert the USB disk to a x86 host,  and run 

gcc helloworld.c -m32

Workaround

Apply attached patch to oe-core layer.
-------------------------
Use the attached specs file to guide on-target gcc:

> gcc -specs=fix.spec hello.c -o h64
> gcc -specs=fix.spec hello.c -o h32 -m32

Other Downloads


Live chat
Online