While using GCC to generate a 32 bits application we get the error "cannot find -lstdc++" or "cannot find -lstdc++_nonshared"
Issue
While using GCC to generate a 32 bits application we get the error "cannot find -lstdc++" or "cannot find -lstdc++_nonshared"
We would like to generate 32 bit code with the compiler g++-4.4.x. Unfortunately, it does not seem to work, the following program fails at link time with the error:
$ g++44 -m32 m32.cpp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux6E/4.4.0/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux6E/4.4.0/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/usr/bin/ld: cannot find -lstdc++_nonshared
collect2: ld returned 1 exit status
Or
$ g++ -m32 tmp.cpp
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
Environment
gcc in a 64 bits environment to generate a 32 bits application
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
