Not able to run gcc

Hi,

I am working with solaris 9(SunOS mgsun 5.9 Generic_112233-07 sun4u sparc SUNW,Sun-Blade-100).I install the gcc 3.4.6 from sunfreeware website and when I am trying to run it,I am getting the error--

# gcc
ld.so.1: gcc: fatal: libiconv.so.2: open failed: No such file or directory
Killed

when I am trying to see that lib by
# ldd /usr/local/bin/gcc
libiconv.so.2 => (file not found)
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
/usr/platform/SUNW,Sun-Blade-100/lib/libc_psr.so.1

so please let me know how can I solve this problem :confused:

Set your LD_LIBRARY_PATH for /opt/csw/lib or something. Check the csw website for more instructions.

If it still doesn't work, you got to get the "Internationalization" libraries as well. These are used by a lot of GNU stuff, so there's probably a CSW package that you also have to install. (Could be they didn't check for the dependency).

You need to download and install the libiconv package. It is available on sunfreeware and elsewhere.

fpmurphy's answer is correct. As stated in the sunfreeware listing for gcc 3.4.6, the libiconv package needs to be installed so that the libraries are in /usr/local/lib - which needs to be in your library path. The CSW packages have nothing to do with the sunfreeware ones and are not equivalent or used by any sunfreeware packages.

Feel free to email me directory with sunfreeware questions in the future.

Steve Christensen
Sunfreeware.com

Ooops. Indeed.

I downloaded the libiconv and now I am able to compile the program..

Thanks a lot guys for helping me :b::b::b::b::b::b:

but now I am not able to run my program.I have a file test.cpp given below--

#include<iostream>
using namespace std;

int main()
{
cout<<"Welcome to the world of C++"<<endl;
return 0;
}

when I am compiling it using
# gcc -c test.cpp -o test
it is compiling the file and creating the binary file test.o but when I am running it,it is giving error--

# . ./test
syntax error: `\3704' unexpected

so please tell me why It's coming and how to resolve it:confused::confused:

Thanks in advance

#include<iostream>
using namespace std;

int main()
{
cout<<"Welcome to the world of C++"<<endl;
return 0;
}

You may want to space things out a little... Although I'm not 100% sure this is causing your problem.

cout << "Welcome to the world of C++" << endl;

when I am compling it by g++

# g++ test.cpp
it is compiling and generates a.out but when I am executing.It is throwing error

even I already set the LIB path
# echo $LD_LIBRARY_PATH
/usr/lib:/usr/local/lib:/opt/csw/lib

Any assistance would be great!? Thanks!

is the library libstdc++.so.6 present in LD_LIB path ?

Yes.it is

libstdc++.so.6 is under /usr/local/lib

So where is the problem is coming :confused::confused::confused::confused:

What OS is this?

From the first post:

what does ldd `which g++` and ldd `which ld` show ? It doesn't link to libstdc++.so on my RHEL box ....

Please also do a file `which libstdc++.so` and file `which g++` to check if the libs are both 32/64 bit versions and there is no mismatch ....

check the g++ library installation