Thanks for the great replies from both of you! I am still trying to digest some of your information. First off, let me post the output of “ldd /usr/bin/glxgears” on my system in case it tells you something important.
linux-vdso.so.1 => (0x00007fff94bfe000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00007fdb8c6d6000)
libm.so.6 => /lib/libm.so.6 (0x00007fdb8c451000)
libc.so.6 => /lib/libc.so.6 (0x00007fdb8c0df000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fdb8bdd8000)
libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0x00007fdb8aaee000)
libnvidia-tls.so.1 => /usr/lib/tls/libnvidia-tls.so.1 (0x00007fdb8c9c9000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fdb8a8dc000)
libdl.so.2 => /lib/libdl.so.2 (0x00007fdb8a6d8000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fdb8a4bc000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fdb8a2b9000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fdb8a0b4000)
Some addresses are different (not surprising), but the set of files appears to be the same… so we’re on the same page.
It makes sense they’d have only one set of include files for both 32-bit and 64-bit — that’s what I do too via conditional includes (and by me defining either CPU32 or CPU64). However, if those header files contain any conditional includes, I’m not sure what names they might adopt to specify 32-bit versus 64-bit. I don’t see off hand how -m32 or -m64 on the compile or link lines can selectively include parts of include files.
ubuntu64 9.04 does indeed have /usr/lib32 and /usr/lib64 directories, with /usr/lib64 linked to /usr/lib on this 64-bit OS.
You ask whether I “drive the linker directly”. I’m not sure how to answer that question. The CodeBlocks IDE requires we fill in project settings for each project, including the following (this set is for the build-option we call “linux32_debug”):
compiler flags (the following are checked)
produce debugging symbols [-g]
in C mode, support all ISO C90 programs (in C++ mode, remove GNU extensions that conflict with ISO C++) [-ansi]
enable all compiler warnings (overrides every other setting) [-Wall]
AMD Athlon64 (x86-64 instruction set) [-march=athlon64]
NOTE: They do not have any Phenom or Phenom2 switches, but hopefully that doesn’t matter.
-O0 (-O2 or more aggressive on release builds)
-m32 (-m64 on 64-bit builds)
CPU32 (CPU64 on 64-bit builds)
LINUX (versus WINDOZE on win32 builds)
DEBUG (versus RELEASE on release builds)
other linker options
-m32 (not sure this is necessary, but we have this entered for sake of our ASM files)
That’s pretty much everything, I think. The main point is, we do not specify any directories for standard/system C function libraries (not for include .h files and not for static/shared libraries either). We didn’t need these on ubuntu32 8.04 which was our previous development linux platform (winxp64 is our windoze development platform).
I assume we need not add the following entries: (-L/usr/lib64 -L/usr/local/lib64), because we specify the “rt”, “GL”, “X11” link libraries, which presumably get searched for in “/usr/lib/” by default). Oh wait! That’s wrong, isn’t it? Since we want to develop (and test) both 32-bit and 64-bit versions of our application on our current ubunbu64 OS, we probably DO need to explicitly specify explicit “/usr/lib32” and “/usr/lib64” linker search directories in the 32-bit and 64-bit build specifications, huh? Otherwise we’d always link to the 64-bit libraries via the presumable default “/usr/lib”. Related question: If we do enter those search directories, will they always be searched BEFORE the default “/usr/lib”? If not, we need to disable those default search paths!
Oh no, wait. You address this. You are saying the -m32 or -m64 option to the compiler will be passed to the linker to force the linker to link our executable to static/shared libraries in “/usr/lib32” or “/usr/lib64”. Very convenient!
I am not familiar with cmake or autotools, because I prefer to develop in IDEs like CodeBlocks and VisualStudio. I know that’s a bad habit in many ways, but ever since I created a compiler/debugger/IDE in 1988… I’ve acquired that nasty habit for software development. Bad, bad boy!
I am still getting an error message from ld (the linker, I presume) “can’t find -lX11”. That probably means the 32-bit libraries for X11 are not installed. For some strange reason I don’t see separate libx11 files listed in the synaptic IDE. What is does show installed already is “libx11-data”, “libx11-dev” and “libx11-6”. None say “64-bit” or “32-bit” so I assume these are 64-bit versions. How do I find and install the 32-bit packages in a way that absolutely, positively cannot accidentally overwrite my default 64-bit libraries? I also wonder why the synaptic package manager IDE doesn’t even list them. BTW, the installed versions are shown as “2:188.8.131.52-1ubuntu2”.