First, you have to have a tool chain that was built with multilib support. Since x86_64 is a multilib architecture (i.e., there is no such thing as a pure 32-bit or pure 64-bit x86_64), you should have this. Second, you will need 32-bit versions of any dependencies that you need to link against. Finally, you need to pass the -m32 flag to gcc when you build the package to create a 32-bit library or binary.
I set four environment variables. BUILD32 and BUILD64 are the gcc options. Here is the difference:
Code:
116 procs - 35 files(38M bytes) - /home/weibullguy/reliafree/source
weibullguy@weibullone for 163D11h32m $ echo $BUILD32
-m32 -mtune=athlon64 -march=athlon64 -O2 -pipe -combine
116 procs - 35 files(38M bytes) - /home/weibullguy/reliafree/source
weibullguy@weibullone for 163D11h32m $ echo $BUILD64
-m64 -mtune=athlon64 -march=athlon64 -O2 -pipe -combine
PKG_CONFIG_PATH32 and PKG_CONFIG_PATH64 are the paths for pkg-config to search for 32- an 64-bit meta files respectively. Here is the difference:
Code:
116 procs - 35 files(38M bytes) - /home/weibullguy/reliafree/source
weibullguy@weibullone for 163D11h32m $ echo $PKG_CONFIG_PATH32
/usr/lib/pkgconfig:/opt/gnome/lib/pkgconfig:/opt/firefox/lib/pkgconfig:/opt/thunderbird-2.0.0.0/lib/pkgconfig
116 procs - 35 files(38M bytes) - /home/weibullguy/reliafree/source
weibullguy@weibullone for 163D11h32m $ echo $PKG_CONFIG_PATH64
/usr/lib64/pkgconfig:/opt/gnome/lib64/pkgconfig:/opt/firefox/lib64/pkgconfig:/opt/thunderbird-2.0.0.0/lib64/pkgconfig
In general, when I configure a package, I use these to set the appropriate environment
Code:
CC="gcc ${BUILD32} PKG_CONFIG_PATH="${PKG_CONFIG_PATH32}" ./configure --blah --blah --blah
Then (usually) make and make install. Specifically for ALSA, it would be like this for the 32-bit libraries
Code:
CC="gcc ${BUILD32}" ./configure &&
make &&
su -c 'make install'
And like this for the 64-bit libraries
Code:
CC="gcc ${BUILD64}" ./configure --libdir=/usr/lib64 &&
make &&
su -c 'make install'
The 32-bit libsigc would be built like this
Code:
CC="gcc ${BUILD32}" CXX="g++ ${BUILD32}" ./configure --prefix=/usr &&
make &&
su -c 'make install'
Keep in mind that on a standards-compliant x86_64 system, 32-bit libraries live in the /lib directories while 64-bit libraries live in the /lib64 directories.