Help: build 32-bit OpenGL apps on 64-bit ubuntu 12.04

[FONT=tahoma]I just replaced my 64-bit ubuntu 10.04 LTS system of the past 2 years with a new fresh-install 64-bit ubuntu 12.04 LTS system. Actually it’s just a new disk drive on the same computer, but that should be irrelevant.

I was developing a 3D engine on the old installation with the codeblocks IDE on top of the usual suspects (gcc/gdb/etc). One of the last things I did was to get the 64-bit version of the 3D engine working (had to write 64-bit SIMD/AVX/ymm assembly language versions of my 32-bit SIMD/SSE3/xmm maxtrix/vector/transformation routines).

After setting up my new system, installing codeblocks and installing the packages I needed, I was able to compile/link/execute the 64-bit version of my engine. Yeah!

However, I am unable to make the 32-bit versions compile and link, and can’t figure out what to do the make this work. The build errors reported are:

#1: fatal error: <glibconfig.h> - file not found

  • i provisionally “solved” this one by adding the following compiler search path for the 32-bit projects:
  • this path seems totally bogus, but that’s the only place on my system the glibconfig.h file exists

Given the above bogus “patch” (what’s it doing inside a “lib” subdirectory, and also a 64-bit one at that?), it was able to compile, but then I got the following link errors.

#2: ld : cannot find -lX11
#3: ld : cannot find -lcairo
#4: ld : cannot find -lpango
#5: ld : cannot find -lfreetype
#6: ld : cannot find -lfmodex

I thought I could maybe fix these link problem by installing the following packages (with the “ubuntu software center” application):

  • libglib2.0-dev:i386
  • zlib1g-dev:i386
  • libcairo2-dev:i386
  • libpango1.0-dev:i386
  • libfreetype6-dev:i386

However, when I said “install”, the application generated a warning dialog with this message:If you install <item-from-above-list>, future updates will not include new items in the Ubuntu desktop system set. Are you sure you want to continue?

The list was about 200 items long and included fundamental packages, including:[i]- install packages using the apt protocol - gtk+ frontend

  • install packages using the apt protocol - common data
  • build-essentials
  • deja-dup
  • g++
  • g+±multilib
  • gcc
  • gcc-multilib
  • gdb
  • gedit
  • gimp
  • … and literally 100~200 more packages !!![/i]

Needless to say, I canceled out rather than trashing my installation!

The bottom line is… how do I compile 32-bit versions of my engine in 64-bit ubuntu 12.04 ???

Are “external packages” like fmodex (not supported by the “ubuntu software center”) handled differently?



MBx = gigabyte 990FXA-UD7
CPU = AMD FX-8150 8-core bulldozer
RAM = 8GB DDR3 in 2 matched modules
GPU = nvidia GTX-580
HDD = 250GB seagate SATA2 @7200rpm — 64-bit ubuntu 12.04 boot disk
HDD = 250GB seagate SATA2 @7200rpm — alternate ubuntu 12.04 boot disk and backups
HDD = 1024GB seagate SATA3 @7200rpm — backup drive
HDD = 3072GB seagate SATA3 @7200rpm — backup drive
HDD = 2048GB seagate external USB drive — backup drive
DVD = TSSTcorp CDDVDW SH-S223B — CD/DVD burner (SATA2)
DVD = HL-DT-ST BD-RE WH12LS38 — CD/DVD/bluray burner (SATA2)


64-bit ubuntu 12.04 LTS
codeblocks IDE
mesa-utils (glxinfo, glxgears, glxheads, glxdemo)

  • download and execute with --extract-only option to create directory with include and library files
  • copy all .h files to directory /usr/include/GL (gl.h, glx.h, glext.h, glxext.h)
  • download and extract to directory to access .h and .c files
  • copy all .h files to directory /usr/include/GL (glew.h, glxew.h, wglew.h)
  • copy 3 .c files into project directory (glew.c, glewinfo.c, visualinfo.c)
  • download and extract to directory to access .h and .so files
  • copy all .h files to directory /usr/include/fmodex
  • copy all .so files to directory /usr/lib

requires X11 - xlib.h
requires GL/GLX - gl.h, glext.h, glx.h, glxext.h
requires GLEW - glew.h, glew.c, etc…
requires cairo library
requires pango library
requires freetype library
requires fmodex - fmodex.h
requires standard c libraries
no SDL or other frameworks[/FONT]

An update. I was told to NOT install the ia32-libs package, because “multiarch” and “multilib” now takes care of everything. Ehhhhh… not everything. After I installed the ia32-libs package and make a couple tweaks, codeblocks was able to compile/link/execute both 32-bit and 64-bit versions of my 3D engine. Hurrah!

Did you tell g++ to compile for 32-bit arch? Add -m32 to the command line.

Thanks for the idea. But yes, the -m32 and -m64 settings to compiler and linker have always been in the 32-bit and 64-bit properties of this program.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.