Can't compile 32bit with 64bit g++

kravemir picture kravemir · Oct 10, 2010 · Viewed 21.8k times · Source

I'm using codeblocks. I'm using ubuntu. Here is output of compilation.

g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Component.cpp -o obj/ReleaseCGI32/src/WEBGINE/Component.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Debug/ComData.cpp -o obj/ReleaseCGI32/src/WEBGINE/Debug/ComData.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Debug/DebugCom.cpp -o obj/ReleaseCGI32/src/WEBGINE/Debug/DebugCom.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Error/ErrorCom.cpp -o obj/ReleaseCGI32/src/WEBGINE/Error/ErrorCom.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Request.cpp -o obj/ReleaseCGI32/src/WEBGINE/Request.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Site.cpp -o obj/ReleaseCGI32/src/WEBGINE/Site.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/WEBGINE/WEBGINE.cpp -o obj/ReleaseCGI32/src/WEBGINE/WEBGINE.o
g++ -Wall  -O2  -m32 -nostdlib    -Iinclude  -c /home/miroslav/Development/WEBGINE/src/main.cpp -o obj/ReleaseCGI32/src/main.o
g++  -o /home/miroslav/htdocs/freelife/index32.cgi obj/ReleaseCGI32/src/WEBGINE/Component.o obj/ReleaseCGI32/src/WEBGINE/Debug/ComData.o obj/ReleaseCGI32/src/WEBGINE/Debug/DebugCom.o obj/ReleaseCGI32/src/WEBGINE/Error/ErrorCom.o obj/ReleaseCGI32/src/WEBGINE/Request.o obj/ReleaseCGI32/src/WEBGINE/Site.o obj/ReleaseCGI32/src/WEBGINE/WEBGINE.o obj/ReleaseCGI32/src/main.o   -s -m32 -L/usr/lib32/  
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.3/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++

Little info about 32bit libs:

miroslav@miroslav-desktop:/usr/lib32$ ls -la libst*
lrwxrwxrwx 1 root root     19 2010-06-21 20:50 libstdc++.so.6 -> libstdc++.so.6.0.13
-rw-r--r-- 1 root root 975088 2010-03-27 01:16 libstdc++.so.6.0.13

Answer

rubenvb picture rubenvb · Oct 10, 2010

Be sure to install gcc-multilib and g++-multilib. These depend on both the 64 as the 32-bit gcc and stdc++ libraries.