Question

I'm trying to compile x32 LD_PRELOAD on x64 platform(Ubuntu), my command:

g++ -fPIC -m32  -shared -Wl,-soname,test.so -ldl -o test.so test.cpp

But i'm getting error:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.5/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

How can i fix that? Thanks!

Was it helpful?

Solution

You need to install 32-bit development packages provided by your distribution. You are seeing this error because you do not have a 32-bit libstdc++ to link against.

Try installing Ubuntu's g++-multilib package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top