gcc install on Solaris

This is probably an FAQ, but I haven't had any luck finding an answer yet that works.

On a brand-new UltraSparc workstation with Solaris 2.6, how can I install the latest gcc )and whatever libraries it wants), given that Sun doesn't supply any sort of C compiler?  

I tried copying over a working gcc 2.7.something from a Sparc 2, but it seems that a lot of required libraries and include files are missing, wrong version, wrong path, etc.  I suspect that some of the path info is hardwired into the installed version I tried to copy, so I don't know how to proceed from here.

All ideas and suggestions would be greatly appreciated.

Justin Harlow
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

on your existing Sparc2 ldd tells you which shared libraries it uses:

    ldd `which gcc`

At least these libs must be on your new system. I.g. gcc only uses libc.so dynamically.
On Solaris gcc has its own include tree (patched files from /usr/include), these must also be present on your new system.

If this doesn't help, please post the messages produced by gcc.

harlowAuthor Commented:
OK; here's the status.

1. I copied gcc and libc.so.1 over to the new machine.  Here is the lib situation:

22 pinhead:/usr/local/tarfiles/gcc-2.7.2> ldd `which gcc`
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
24 pinhead:/usr/local/tarfiles/gcc-2.7.2> ls -al /usr/lib/libc*
-rw-r--r--   1 bin      bin      1585072 Jul 15  1997 /usr/lib/libc.a
lrwxrwxrwx   1 root     root          11 Dec 16 16:46 /usr/lib/libc.so -> ./libc.so.1*
-rwxr-xr-x   1 bin      bin      1000252 Jul 15  1997 /usr/lib/libc.so.1*
lrwxrwxrwx   1 root     root          14 Dec 16 16:49 /usr/lib/libc2.a -> ./libc2stubs.a
lrwxrwxrwx   1 root     root          17 Dec 16 16:46 /usr/lib/libc2.so -> ./libc2stubs.so.1*
lrwxrwxrwx   1 root     root          17 Dec 16 16:46 /usr/lib/libc2.so.1 -> ./libc2stubs.so.1*
-rw-r--r--   1 bin      bin        26940 Jul 16  1997 /usr/lib/libc2stubs.a
lrwxrwxrwx   1 root     root          17 Dec 16 16:46 /usr/lib/libc2stubs.so -> ./libc2stubs.so.1*
-rwxr-xr-x   1 bin      bin        21064 Jul 16  1997 /usr/lib/libc2stubs.so.1*
25 pinhead:/usr/local/tarfiles/gcc-2.7.2> ls -al /usr/lib/libdl*
lrwxrwxrwx   1 root     root          12 Dec 16 16:46 /usr/lib/libdl.so -> ./libdl.so.1*
-rwxr-xr-x   1 bin      bin         4320 Jul 15  1997 /usr/lib/libdl.so.1*

2. Now I will try to compile gcc 2.7.2 from a fresh tar file I downloaded:

28 pinhead:/usr/local/tarfiles/gcc-2.7.2> ./configure
This appears to be a sparc-sun-solaris2.6 system.
Using `./config/sparc/sparc.c' to output insns.
Using `./config/sparc/sparc.md' as machine description file.
Using `./config/sparc/sol2.h' as target machine macro file.
Using `./config/sparc/xm-sol2.h' as host machine macro file.
Merged sparc/x-sysv4.
Merged sparc/t-sol2.
Merged c++ fragment(s).
Created `./Makefile'.
Merged sparc/x-sysv4.
Merged sparc/t-sol2.
Created `cp/Makefile'.
Links are now set up to build a native compiler for sparc-sun-solaris2.6.
29 pinhead:/usr/local/tarfiles/gcc-2.7.2> make CC=gcc
gcc  -DIN_GCC -DSVR4  -g     -I. -I. -I./config \
  -DGCC_INCLUDE_DIR=\"/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2/include\" \
  -DGPLUSPLUS_INCLUDE_DIR=\"/usr/local/lib/g++-include\" \
  -DLOCAL_INCLUDE_DIR=\"/usr/local/include\" \
  -DCROSS_INCLUDE_DIR=\"/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2/sys-include\" \
  -DTOOL_INCLUDE_DIR=\"/usr/local/sparc-sun-solaris2.6/include\" \
  -c `echo ./cccp.c | sed 's,^\./,,'`
cccp.c:1192: parse error before `__attribute__'
cccp.c: In function `fancy_abort':
cccp.c:9972: warning: `volatile' function does return
cccp.c: In function `pipe_closed':
cccp.c:10003: warning: `volatile' function does return
cccp.c: In function `memory_full':
cccp.c:10009: warning: `volatile' function does return
make: *** [cccp.o] Error 1
30 pinhead:/usr/local/tarfiles/gcc-2.7.2>

I'm over my head on this one...



Can't reproduce your errors, 'cause I don't have access to Solaris :-(
Anyway, I try to help.
Please send the context of  cccp.c:1192 (ca. lines 1180..1200).
Does gcc compile on you old system?
Please also make a brief check if you have all includes, for example on new and old Solaris:
  ls -R /usr/include |wc
Using -v option of gcc also tells you what are the default settings/defines (for examples for standard include paths).

Because e-e is a bit noicy you may contact me at hoagascht@gmx.net
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

If it helps you could download a compiled copy of gcc, which installs with pkgadd from:

harlowAuthor Commented:
gormenghast's suggestion is the ideal solution.  Unfortunately, there seems to be something else wrong.  When I follow the instructions for installing packages, I get this kind of thing:

The following packages are available:
  1  GCC2721     gcc

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance <GCC2721> from </tmp/gcc->
(Solaris 2.5)
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/", err
no 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/", errno 2
8, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/", errn
o 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/
nameser.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/
s.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/
ingpoint.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/
p.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/
led.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/
hpkgadd: ERROR: attempt to process datastream failed
    - process </usr/bin/cpio -icdumD -C 512> failed, exit code 124
pkgadd: ERROR: unable to unpack datastream

Installation of <GCC2721> failed (internal error).
No changes were made to the system.

I read the cryptic man pages on pkgadd, and tried to figure out where that "reloc" in the paths is coming from, but couldn't find it anywhere.  There is tons of available disk space in every partition, including /tmp, /opt, /usr, etc, since this is a brand new system.  

I suspect this is some trivial setup issue, but I am clueless.  Can anyone help out here?



How about space in  /  for example /var/tmp ?
harlowAuthor Commented:
Here is what is available:

1 pinhead:/export/home/harlow> /usr/ucb/df
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s0      41151   18135   22975    45%    /
/dev/dsk/c0t1d0s6    2012390  248704 1756979    13%    /usr
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
/dev/dsk/c0t0d0s3      25919    5039   20855    20%    /var
/dev/dsk/c0t0d0s7     486999     400  486113     1%    /export/home
/dev/dsk/c0t0d0s5     721751   25260  695589     4%    /opt
/dev/dsk/c0t0d0s1     480919  202768  277671    43%    /usr/openwin
swap                  444176   25064  419112     6%    /tmp
2 pinhead:/export/home/harlow>

I tried installing the gcc-2.7.2 package instead of gcc-, and got similar results.  The libg++-2.7.1 package installed fine, so I don't think there is a problem with pkgadd itself.  

The documentation on pkgadd is very cryptic, but I can't see any indication that it needs to write large files anywhere other than /opt.  What am I missing here?

Aah, tmp and swap share the same partition.
This may only cause a problem if you need a huge swap and a huge /tmp, your 440Mb should be enough.

Probably /var (/var/tmp) is not sufficent. Is /var/tmp a directory, or is it linked to /tmp? If so setting the environment
variable TMP=/tmp may help (please refer to man pkgadd).

BTW, "No space left on device" should also be reported together with the partition in /var/adm/messages (or /var/adm/syslog)
1. copy all the files:
and the directories:
From you Sparc2 to UltraSparc workstation.

2. Another solution is:
compile the gcc on your Sparc2, then move the whole source directory to your UnltrSparc, then make install on UnltraSparc.

3. If it still doesn't work, uses ldd /usr/local/bin/gcc to see if there are some shared library missing.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
harlowAuthor Commented:
Thanks to everyone.  Ahoffman's last answer was actually the one that solved the problem.  /var/tmp was indeed too small.  I created a new directory /opt/tmp, and made /var/tmp a symbolic link to it.  The package then installed fine.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.