Skip to content

Building 32 bit Vogl binaries on a multilib system

Robert Bragg edited this page Jun 17, 2014 · 3 revisions

Since successfully building 32 bit Vogl binaries on a multilib Arch Linux system, I thought it might be helpful to others to write up a few notes here about some of the snags I hit...

Note: Since commit ca79c9b39f7d4 building 32 bit Vogl binaries on a multilib x86_64 system has become pretty straight forward and the only substantial thing left documented here is how to manually build 32 bit libunwind binaries on ArchLinux. This page may be deleted or renamed in the near future

This approach is an alternative to using a 32 bit chroot, e.g. built with the scripts in the vogl_chroot repo.

Prerequisites

I won't cover the details of setting up a multilib system, except for a few pointers:

Essentially, to start with you will need to install your distro's gcc-multilib package and all the 32 bit packages for vogl's dependencies, which on Arch can include packages like lib32-mesa, lib32-mesa-libgl, lib32-intel-dri, lib32-qt4, lib32-sdl2 depending on the driver you want to use.

Building libunwind

This problem may only apply to Arch Linux so skip this if you use another distro and can install a 32 bit libunwind package.

One issue I hit was that vogl depends on libunwind and although there is an Arch AUR package for lib32-libunwind; due to the way it is configured it is missing the _Ux86_getcontext which implements unw_getcontext() used by vogl.

You can fetch the libunwind source from here to build it manually:

git clone git://git.sv.gnu.org/libunwind.git

I configured it as follows:

./configure --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --enable-debug --enable-debug-frame CFLAGS="-g3 -O0 -m32" LDFLAGS="-m32"

  • _Note: it's important that libunwind's configure sees the host and target match otherwise it defines a REMOTE_ONLY automake conditional which means src/x86/getcontext-linux.S (which implements Ux86_getcontext) won't be built and vogl depends on this.
  • _Note: also beware you may hit dependency tracking issues with src/elf32.c if you your tree was previously configured for an x86_64 build (I was seeing unresolved symbol errors for Uelf32_get_proc_name and explicitly touching src/elf32.c seemed to be enough to fix it for me)

Compiling Vogl

It used to be that you needed to create a standalone toolchain.cmake file to make this work, but since ca79c9b39f7d4, Vogl's build system aims to Just Work™ on a multilib, x86_64 based system if you pass the -DBUILD_X64=Off option to cmake:

mkdir -p vogl/vogl_build/bin/debug32 && cd $_
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_X64=Off ../../..
make -j 10

If you had to manually build libunwind then you may need to explicitly tell cmake where to find these with options such as:

-DLIBUNWIND_LIBRARY=/path/to/libunwind/lib/libunwind.so -DLIBUNWIND_INCLUDE_DIR=/path/to/libunwind/include