cannot compile 32-bit applications on 64-bit ubuntu 9.04
I asked a similar question a few days ago on the ubuntu forum, but the responders have not been able to help me. I ask the question in this forum because it may be far more specific to software development than ubuntu. Sorry for this duplication.
We are developing a multiplatform 3D game/graphics/simulation application that adopts OpenGL for graphics but otherwise only calls functions in standard C function libraries. We've been developing on 32-bit ubuntu 8.04 until last week when we decided it was time to create a 64-bit version to take advantage of the extra CPU/SIMD registers and efficiencies available only in 64-bit mode. So we installed the 64-bit version of ubuntu 9.04 on our computers and tried to build the 32-bit debug version of our program in CodeBlocks (which is the development environment we've been working with). The only change we made to the project settings on the 32-bit debug/release versions was to add -m32 to force the tools to compile/assemble/link 32-bit mode code and libraries. The current problem is, an attempt to build generates the following error (after apparently compiling all the source-code files without troubles): ld cannot find -lstdc++ However, the following check indicates to me that these 32-bit libraries are installed in the correct directory. Code:
cd /usr/lib32 I assume "stdc++" and "libstdc++" refer to the same package, right? Our project settings don't explicitly include library stdc++ or libstdc++, but my source-code files do include some C standard libraries. I assume the build tools automatically include the stdc++ library. Correct? I'm at a loss. This problem will probably appear obvious in retrospect --- once somebody explains what we're missing. |
Is -L/usr/lib32 being passed to the linker? Even when linking with -m32, I believe you need to add the lib32 path.
|
Quote:
|
Are you even using c++, or just C? I'm not sure why it would need libstdc++. What functions are you using for that?
Try installing the g++-multilib package. |
Quote:
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. |
g++-multilib fixed the problem for me when I tried to build a test program based on what you said. I didn't need to create a symlink either. In any case, if the symlink is working for you, then you should be fine.
|
Quote:
|
unknown trivialities
Quote:
Wait, now I remember what might be the problem. My applications are cross-platform, meaning they compile on Linux and Windoze. As I recall, getting the same code to compile on both gcc/g++ and VisualStudio was lots easier as C++ code. But who knows what drove me to this... 'twas a long time ago in a galaxy far, far away. |
All times are GMT -5. The time now is 01:59 PM. |