I'm trying to run my first C++ program on Solaris. Just a simple Hello World program. When I try to run. I get the error libstdc++.so.6:open failed:No such file or directory. Of course I did some googling and found out that I can solve this by setting the environment variable:export LD_LIBRARY_PATH=/usr/local/libAfter relog, I found out that it was not a permanent way to solve it. I'm guessing this have something to do with linking the libstdc++.so.6 during compile. Here are the step that I did from the beginning:bash-3.2# gcc -c test.cppbash-3.2# gcc -o test test.o -lstdc++bash-3.2# ./test   libstdc++.so.6:open failed:No such file or directorybash-3.2# ldd test | grep not   libstdc++.so.6 =>        (file not found)bash-3.2# /usr/ccs/bin/elfdump test | grep RUNPAbash-3.2# find /usr -name libstdc++.so.6   /usr/local/lib/libstdc++.so.6Did I miss a flag or something during compile? How do I create a softlink so that it knows where to look for when running that program?This is the platform that I'm using:bash-3.2# uname -a   SunOS ms-sparc8 5.8 Generic_108528-13 sun4u sparc SUNW,Sun-Blade-100bash-3.2# gcc -v   Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/specs   Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls --disable-libgcj --enable-languages=c,c++   Thread model: posix   gcc version 3.3.2
libstdc++.so.6: open failed: No such file or directory
solaris;gcc;c++
The easiest way to set the Solaris run-time linker search path is by using crle, but you need to be very careful when doing so as you can quite easily make your system unusable if you break it! To add /usr/local/bin to the linker path:# crle -u -l /usr/local/libOnce you've done that, call crle on its own to verify the new search path.An alternative is to compile the path into the binary itself:$ gcc -Wl,-rpath,/usr/local/lib -o test test.o -lstdc++The above is a better option as the binary will work on other systems without having to have the linker path adjusted.