shared object error when using binary on different machine
How can I avoid this? I have a pretty simple c++ program compiled on a ubuntu box. When I move it over to red hat and try to execute it I get an error something like:
cannot find shared object stdlibc++5.so
How does commercial software get around this, the stdlib installed开发者_StackOverflow on users machines is going to vary a lot. Is there some flag I need to be using when I compile?
I think you need to recompile it again because:
- OS is different [Ubuntu and Red Hat]
- The location of libraries might be different. Also there are chances (though very minute) that stdc++ library is not present at all.
- In commercial software employing compiled languages like C/C++ , the applications are deployed on the same OS (both development and production..as far as I know) and usually , the library locations are also consistent
So, please check if you are able to compile your C++ code (may be hello world) and compile your code again.
There could be any number of reasons for this; for all you know, the
target machine may not have installed g++ and its libraries. The only
real solution is to statically link the standard C++ library, using the
-static-libstdc++
option.
精彩评论