LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   cannot compile 32-bit application on 64-bit ubuntu 9.04 (https://www.linuxquestions.org/questions/ubuntu-63/cannot-compile-32-bit-application-on-64-bit-ubuntu-9-04-a-730815/)

maxreason 06-04-2009 11:55 PM

cannot compile 32-bit application on 64-bit ubuntu 9.04
 
We have been developing a portable 3D game/graphics/simulation application for some time on 32-bit ubuntu 8.04 LTS. Finally we are ready to create versions that take advantage of the extra CPU/SIMD registers, instructions and efficiencies available only in 64-bit mode executables.

So we installed 64-bit ubuntu 9.04 on our computers with the intention to continue development on both 32-bit and 64-bit versions of our applications. We installed the ia32 libs via the synaptic package manager application, but compilation fails with the following error message:

ld cannot find -lstdc++

I assume this means the 32-bit version of the stdc++ library is not installed, or is not installed in the expected location. But I don't know what to do about it. I do not find an obvious solution. I'm guessing the 64-bt stdc++ library was installed when we installed the "build-essential" package. But I don't see any "build-essential32" or equivalent, nor "libc++32" or equivalent listed in the package manager application.

How do we configure our computers to create both 32-bit and 64-bit executables?

PS: The IDE appears to successfully compile all our C and ASM source-code files before it fails this link step (I presume). For some odd reason the IDE stops trying to build after this initial link error, so other errors might be waiting to happen after this one is solved.

-----

The following is basic information about our development tools and application, in case this information matters.

##### IDE and tools
64-bit implementation of CodeBlocks offered by synaptics application
same project settings that worked in 32-bit ubuntu 8.04, except add -m32 option
default paths: /usr/include/GL and /usr/include/X11
link libraries: rt, GL, X11

##### our application
C and ASM source-code compiles/assembles/links/executes in 32-bit ubuntu 8.04
depends upon "C standard libraries", xlib (part of X11, GL (OpenGL), and GLX.

Simon Bridge 06-05-2009 02:31 AM

Perhaps you don't have the GlibC development headers, they are in the libc6-dev package.

maxreason 06-05-2009 03:36 AM

The following were already selected according to the synaptic GPU package manager:

libc6 - 2.9-4ubuntu6
libc6-dev - 2.9-4ubuntu6
libc6-dbg - 2.9-4ubuntu6
libc6-i386 - 2.9-4ubuntu6
libc6-dev-i386 - 2.9-4ubuntu6

To me, that seems sufficient, though synaptic does not show a file named "libc6-dbg-i386" at all.

Any other ideas?

maxreason 06-05-2009 04:51 PM

more information
 
cd /usr/lib32
ls -la libst*

outputs

Code:

lrwxrwxrwx 1 root root    18  2009-06-04 19:41 libstdc++.so.5 -> libstdc++.so.5.0.7
-rw-r--r-- 1 root root 737192  2008-05-09 23:18 libstdc++.so.5.0.7
lrwxrwxrwx 1 root root    19  2009-06-04 19:41 libstdc++.so.6 -> libstdc++.so.6.0.10
-rw-r--r-- 1 root root 950424  2009-03-16 18:03 libstdc++.so.6.0.10

To me, that indicates the "stdc++" library is installed in the correct path. I assume "stdc++" and "libstdc++" refer to the same package, right?

I'm at a loss. This is one of those problems that will probably appear obvious --- in retrospect. Unfortunately, I'm not there yet.

PS: I don't explicitly include library libstdc++, but my source-code files do include some C standard libraries. I assume including this library is default behavior for the build tools. Correct?

brianL 06-06-2009 07:09 AM

I'm not on my 64 bit 9.04 at the moment, so I can't check, but I think you need the ia32 libs (look in Synaptic).

Edit (better late than never):
I really must read posts properly. Missed the fact that you've got already got the ia32 libs.

maxreason 06-06-2009 10:28 PM

resolved
 
Someone in the OpenGL forum figured out my problem... pretty obvious in retrospect.

cd /usr/lib32
ln -s libstdc++.so.6 libstdc++.so

This creates a symbolic link named "libstdc++.so" that refers to "libstdc++.so.6" (the most recent version I have installed). That makes sense to me. Presumably the CodeBlocks IDE (and/or gcc compiler tools) automatically links to "libstdc++.so" with the assumption that will be linked to the most recent installed version of that library. Presumably most applications prefer to link to the newest library, unless they have some unusual need to link to an older version.

I'm guessing the programmer who made the package that contains libstdc++.so forgot to include the symbolic link. I notice this symbolic link is also missing from the /usr/lib64 directory! I guess I better add one into that directory too, before I forget!

Thanks for the ideas, everyone.


All times are GMT -5. The time now is 08:00 AM.