SimonHF's Blog

Just another WordPress.com site

How to compile 32 bit libsxe on a 64 bit host? December 29, 2010

Filed under: Uncategorized — simonhf @ 1:53 am

So believe it or not we don’t actually have a 64 bit build of libsxe yet. At work we currently only need a 32 bit build. I just got my Christmas present to myself setup – a nice new Xeon-based PC running 64 bit Ubuntu among other things – and tried to compile libsxe. Of course, it didn’t work. So here’s the makefile voodoo I did to make it work:


# echo get the latest libsxe from github
# mkdir 20101228-sxe
# cd 20101228-sxe/
# wget --output-document=sxe.tar.gz --no-check-certificate https://github.com/jimbelton/sxe/tarball/master
# tar -xvf sxe.tar.gz
# cd jimbelton-sxe-d3b82bb/libsxe/

# echo only if 64 bit host: install 32bit dev stuff
# apt-get install libc6-dev-i386

# echo only if 64 bit host: force makefile stuff to 32bit
# pushd ../mak
# cp mak-unix.mak mak-unix.mak.orig
# echo edit mak-unix.mak
# diff mak-unix.mak.orig mak-unix.mak
< CC = gcc
> CC = gcc -m32
< LINK = gcc
> LINK = gcc -m32
# popd

# echo only if 64 bit host: force third party makefile stuff to 32bit
# pushd lib-ev
# cp GNUmakefile GNUmakefile.orig
# edit GNUmakefile
# diff GNUmakefile.orig GNUmakefile
< @cd $(DST.dir)/$(THIRD_PARTY.dir) && ./configure
> @cd $(DST.dir)/$(THIRD_PARTY.dir) && env CFLAGS=-m32 LDFLAGS=-m32 ./configure --build=i686-unknown-linux-gnu --disable-ld64
# popd

# echo build release, debug, and coverage versions and run all the tests
# time make check
...
All pre-submit automated tests completed successfully!
Please have your source code changes reviewed before submit!

real 1m13.457s
user 0m40.390s
sys 0m16.190s
Advertisements
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s