gcc install on Solaris

Posted on 1998-01-19
Last Modified: 2013-12-16
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
Question by:harlow
LVL 51

Expert Comment

ID: 1812868
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 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.


Author Comment

ID: 1812869
OK; here's the status.

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

22 pinhead:/usr/local/tarfiles/gcc-2.7.2> ldd `which gcc` =>     /usr/lib/ =>    /usr/lib/
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/ -> ./*
-rwxr-xr-x   1 bin      bin      1000252 Jul 15  1997 /usr/lib/*
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/ -> ./*
lrwxrwxrwx   1 root     root          17 Dec 16 16:46 /usr/lib/ -> ./*
-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/ -> ./*
-rwxr-xr-x   1 bin      bin        21064 Jul 16  1997 /usr/lib/*
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/ -> ./*
-rwxr-xr-x   1 bin      bin         4320 Jul 15  1997 /usr/lib/*

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/' 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...



LVL 51

Expert Comment

ID: 1812870
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.


Expert Comment

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


Author Comment

ID: 1812872
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?



LVL 51

Expert Comment

ID: 1812873
How about space in  /  for example /var/tmp ?

Author Comment

ID: 1812874
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?

LVL 51

Expert Comment

ID: 1812875
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)

Accepted Solution

eyu earned 50 total points
ID: 1812876
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.

Author Comment

ID: 1812877
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.


Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using Grep to Find a file 8 93
Virtualizing TAPE on dual VIOS 3 88
Authenticate using sesu from script 7 35
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question