🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

gcc/g++ executables not linking correctly on Solaris 10

Started by
1 comment, last by Ramsess 17 years ago
I installed the gcc collection for Solaris 10, and I can successfully compile and link programs into executables. However, when I attempt to run one of these executables, it complains that it cannot find any of the libraries it was linked to. In my case, I wrote a simple test program called test.cpp located in /usr/local/bin:

#include <iostream>
using namespace std;
int main()
{
     cout << "Testing that gcc works correctly\n";
     return 0;
}


My gcc libraries are in /usr/local/lib and my gcc binaries are in /usr/local/bin. When I do cd /usr/local/bin ./g++ main.cpp ./test I get the following error: libstdc++.so.6 open failed: No such file or directory Note: the reason I am executing g++ directly is because for some reason the following fails to update my PATH variable: export $PATH=$PATH:/usr/local/lib I have even tried the following: cd /usr/local/bin ./g++ main.cpp -L/usr/local/lib -lstdc++ -o test mv test /usr/local/lib/test cd /usr/local/lib ./test As you can see, the executable is now in the same directory as the library it is looking for, but I still get the same error for some reason. If anyone offer any advice on what I'm doing wrong, I would much appreciate. On a lesser note, me not being able to update my path variable is kind of annoying so if anyone happens to know anything about that, that would also help. Final note: I am aware of Sun's CC compiler and it has been working wonderfully so far.. I would just like to have the gcc collection available in case I need it. It also perturbs me that I can't figure out such a simple thing after going on a two week *nix crunch learning period. Regards, Khaos Dragon
Advertisement
I figured it out after some thinking, not sure why it wasn't obvious before.

Anyways I guess I was making a mistake of utilizing the $ operator when assigning environment variables. With the ability to assign them, I then noticed the library path variable and noticed that I was missing the requisite paths.

With that said, all my problems are fixed.. its probably better I figured it out on my own since my past mistake is so ingrained I don't think I can make it again.

Try run command like this:
ldconfig -m /usr/local/lib


man ldconfig
I think it's help you

This topic is closed to new replies.

Advertisement