I'm trying to link with x86 shared library on x64 Ubuntu 11.04 Natty Narwhal but I get the following message:
/usr/bin/ld: skipping incompatible ./bin/libshared.so when searching for -lshared
/usr/bin/ld: cannot find -lshared
Some details:
The shared library name is libshared.so
The shared library is build on x86 OS.
I have installed lib32stdc++6.
The makefile looks like this:
test: main.o
g++ -mi386linux -L./bin -lshared main.o -o test
main.o: main.cpp
g++ -m32 -c main.cpp -o main.o
Any ideas?
Edit: After changing -mi386linux flag to -m32 I got this error:
/usr/bin/ld: cannot find -lshared
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
running locate I found libstdc++.so in the following places:
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.14
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libstdc++.so
/usr/lib32/libstdc++.so.6
/usr/lib32/libstdc++.so.6.0.14
I'm not sure what the -mi386linux
is supposed to be about, but if you replace it by -m32
on the link line then I suspect this will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With