Solved

gcc install on Solaris

Posted on 1998-01-19
10
590 Views
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
0
Comment
Question by:harlow
10 Comments
 
LVL 51

Expert Comment

by:ahoffmann
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 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.

0
 

Author Comment

by:harlow
ID: 1812869
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...

Thanks

JEH


0
 
LVL 51

Expert Comment

by:ahoffmann
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 hoagascht@gmx.net
0
 
LVL 2

Expert Comment

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

http:/smc.vnet.net/solaris2.5.html
0
 

Author Comment

by:harlow
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
                 (Solaris2.5) 2.7.2.1

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:
Processing package instance <GCC2721> from </tmp/gcc-2.7.2.1>
gcc
(Solaris 2.5) 2.7.2.1
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/cc1plus", err
no 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/cpp", errno 2
8, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/gmon.o", errn
o 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/arpa/
nameser.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/curse
s.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/float
ingpoint.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/ieeef
p.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/inet/
led.h", errno 28, No space left on device
cpio: Cannot write "reloc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/math.
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?

Thanks...

JEH

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 51

Expert Comment

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

Author Comment

by:harlow
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-2.7.2.1, 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?

JEH
0
 
LVL 51

Expert Comment

by:ahoffmann
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)
0
 

Accepted Solution

by:
eyu earned 50 total points
ID: 1812876
1. copy all the files:
/usr/local/bin/gcc*
/usr/local/lib/*.a
and the directories:
/usr/local/*-sun-solaris2.6*/
/usr/local/lib/gcc*/
/usr/local/include/
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.
0
 

Author Comment

by:harlow
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.


0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now