C Compiler

Greetings, :rolleyes: :o :confused:

I am working on Solaris 8. I have a few questions:

  1. How do I determine if I have the CC compiler? I know it isn't in my $PATH, so how do I find it?
  2. How do you install wget? I have read the INSTALL file, but I am not familar with the switches, i.e. ./configure --? . The file dosen't say specifically how to install. It is very fague for me as a new user of wget and GCC/CC compilers.

Thanks.
Roam

Try typing "gcc" at the command prompt. 'cc' is a purchased Sun compiler that most folks don't have. If that doesn't work, try:

$ grep gcc /var/sadm/install/contents

That might tell you where it was installed if it's a package installation. Otherwise you can try

# find / -name gcc -print

Note that you're root on that one.

If you want to install gcc, head out to http://www.sunfreeware.com and download it. There should be instructions on the site on how to install packages. If you're looking for gcc just so you can install wget, just retrieve wget from sunfreeware instead and install that.

Carl

On Solaris, (usually) if you haven't explicitly installed a C compiler, you won't be having one. Run 'pkginfo | grep -i compiler' or some such and check. If you don't get anything, you probably don't have it installed.

If you want to install gcc, I suggest that you go to sunfreeware.com and download the package directly. Don't fiddle around with the sources. Once you get that, just pkgadd and voila! You have gcc.

Regarding wget, just download the sources, extract from the tar. Then go to the directory where you have extracted the source and run "./configure". If you want to specify a specific path to install to, you can specify "./configure --prefix=your_install_path". There are a several other ways to configure, just check the README file. After the configuration is done, run "make" and then "make install". After this, with the default options, you will have wget in the /usr/local/bin directory.

you could use the original Sun Studio an optimized C, C++, and Fortran compiler for the Solaris OS on SPARC from Sun.

but if you don't know what to do with a compiler, i would recommend like blowtorch mentioned, download the binary package for wget from sunfreeware...

regards pressy

Here is the output I received from grep gcc /var/sadm/install/contents

/usr/local/lib/libgcc_s.so=libgcc_s.so.1 s none SMClibgcc
/usr/local/lib/libgcc_s.so.1 f none 0644 bin bin 165280 24277 1089505610 SMClibgcc
/usr/local/lib/libstdc++.a f none 0644 bin bin 7294388 50147 1089505612 SMClibgcc
/usr/local/lib/libstdc++.la f none 0755 bin bin 1159 31501 1089505612 SMClibgcc
/usr/local/lib/libstdc++.so=libstdc++.so.6.0.1 s none SMClibgcc
/usr/local/lib/libstdc++.so.6=libstdc++.so.6.0.1 s none SMClibgcc
/usr/local/lib/libstdc++.so.6.0.1 f none 0755 bin bin 5348004 43669 1089505614 SMClibgcc
/usr/local/lib/sparcv9 d none 0755 bin bin SMClibgcc
/usr/local/lib/sparcv9/libgcc_s.so.1 f none 0644 bin bin 199936 65055 1089505615 SMClibgcc
/usr/local/lib/sparcv9/libgcc_s_sparcv9.so=libgcc_s.so.1 s none SMClibgcc
/usr/local/lib/sparcv9/libstdc++.a f none 0644 bin bin 10088392 40581 1089505619 SMClibgcc
/usr/local/lib/sparcv9/libstdc++.la f none 0755 bin bin 1368 50022 1089505619 SMClibgcc
/usr/local/lib/sparcv9/libstdc++.so=libstdc++.so.6.0.1 s none SMClibgcc
/usr/local/lib/sparcv9/libstdc++.so.6=libstdc++.so.6.0.1 s none SMClibgcc
/usr/local/lib/sparcv9/libstdc++.so.6.0.1 f none 0755 bin bin 6126992 30880 1089505621 SMClibgcc

Based on this information, I am assuming it is installed.
New question? Is there a switch to turn it on, because I am still getting gcc not found when trying to run ./configure?

Roam

No, it is not. You have libgcc, but not gcc installed.

Thanks for the update. I willl proceed to install gcc. Wish me luck!

Hello Again,

I retreived gcc-3.4.6.tar.gz and gunzip and untarred it. I completed the following commands:

cd gcc-3.4.6
mkdir objdir
cd objdir
../configure

Here is what I received:

loading cache ./config.cache
checking host system type... sparc-sun-solaris2.8
checking target system type... sparc-sun-solaris2.8
checking build system type... sparc-sun-solaris2.8
checking for a BSD compatible install... ./install-sh -c
/usr/ucb/cc: language optional software package not installed
*** The command 'cc -o conftest -g conftest.c' failed.
*** You must set the environment variable CC to a working compiler.

I tried the following command from the gcc.gnu.org installation page:

../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-share --enable-language-c

loading cache ./config.cache
checking host system type... sparc-sun-solaris2.8
checking target system type... sparc-sun-solaris2.8
checking build system type... sparc-sun-solaris2.8
checking for a BSD compatible install... ../install-sh -c
../configure: cc: not found
*** The command 'cc -o conftest -g conftest.c' failed.
*** You must set the environment variable CC to a working compiler.

I received the same results...What am I doing incorrectly? How do I set the environment variable CC to a working compiler?

Roam

You're having this problem becasue you are trying to compile the compiler, but you have no other compiler installed.

Go to sunfreeware.com and download the gcc package, then add it with pkgadd.

Greetings Reborg,

Just to clarify, I can install all packages that have .tar.gz with pkgadd. I was under the impression that in order to install packages with pkgadd, the term "pkgadd" must appear in the bundled software name. ex: "software.pkgadd" The package I retrieved was from sunfreeware. I checked again and there isn't a package with pkgadd in the name.

Thanks.
Roam

you need to gunzip the .gz you then will have a file called

<something>-local

pkgadd -d <something>-local

the name has nothing whatsoever to do with it. All of the main links are packages on sunfreeware.

Thanks Reborg. Will give that a try today.

Roam

Here is what I have installed with pkgadd...

$ pkginfo | grep SMC
application SMCgcc gcc
application SMCliconv libiconv
application SMClintl libintl

The packages were:

libiconv-1.9.2-sol8-sparc-local
libintl-3.4.0-sol8-sparc-local
gcc-3.4.6-sol8-sparc-local

Do I need anything else?

Anyway, here is my test program:

#include <stdio.h>

main()
{
        printf("hello\n");
}

Here is what happens when I try to compile it:

$ gcc test.c -o test
In file included from test.c:1:
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:36:27: iso/stdio_iso.h: No such file or directory
In file included from test.c:1:
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:194: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:229: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:230: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:236: error: syntax error before "size_t"
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:241: error: syntax error before "size_t"
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:250: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:252: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:276: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:285: error: syntax error before '*' token
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:286: error: syntax error before "FILE"
/usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.6/include/stdio.h:287: error: syntax error before '*' token

:eek:

Anybody know what's wrong here?

Thanks.

Hello Lyonsd,

I also installed openssl-0.9.8d-sol8-sparc-local. I installed all of those to get pkg-get and wget installed and running. It is my understanding that pkg-get downloads and compiles everything for you, but I am very new to all of this...I could be wrong. I googled your problem and found this website: http://www.openldap.org/lists/openldap-software/200112/index.html\#00426
Look at the "RE: Newbie - Simple? installation problem"

Roam

pkg-get does not compile anything. It downloads and installs binaries.

so how do I compile...?

Do I need to compile gcc outside of trying to run scripts? Why did I need to have gcc inorder to install wget and/or pkg-get. I've been back and forth with this for so long I've forgotten why I needed gcc in the first place.

If you are compiling wget from source, you'll need a gcc compiler. If you retrieve the wget binary package from http://www.sunfreeware.com, you can just use pkgadd and have it install the binary and you're ready to go. You might also need the openssl package if the wget binary expects it an you haven't compiled and installed it (you can retrieve the openssl package from the same site and install the binary).

If you really want a c compiler (and I personally believe a unix sysadmin should be able to read and compile source code), retrieve the gcc compiler from http://www.sunfreeware.com, install the package, read the README and INSTALL files for the openssl package. Follow those instructions. Read the README and INSTALL files for the wget package. Follow those instructions.

Once you've compiled and installed the two pieces of software, you'll be good to go.

Carl

To answer the previous question.

You didn't need gcc, you needed gcc or libgcc. wget is dynamically linked against the gcc libraries and requies them to be present in order to run.

Well, it would appear that I may have installed the wrong version.

I thought Solaris 8 was installed on this system:

# uname -a
SunOS dncsatm 5.8 Generic_108528-22 sun4u sparc SUNW,Ultra-250

I thought SunOs 5.8 was the same as Solaris 8.

When I compile I the header file path contains:

sparc-sun-solaris2.8

So it appears I have installed the Solaris 2.8 gcc compiler.

But the original file I installed from is this:

gcc-3.4.6-sol8-sparc-local

Which looks to me like Solaris 8.

:confused: :confused: :confused: :confused: :confused: