sh-3.2# pkg-get -i gcc4core Ends with: ## Executing postinstall script. *** NOTICE *** Fixing the system headers for a detailed log see /var/sadm/install/logs/CSWgcc4core-20090205023023 Don't forget: whenever your system headers change run the mkheaders script! pkgadd: ERROR: postinstall script did not complete successfully Installation of failed. ERROR: could not add CSWgcc4core. However the binary is installed and will work if called: /opt/csw/gcc4/bin/gcc The problem appears to be this broken symlink: http://osdir.com/ml/os.solaris.blastwave.user/2008-01/msg00043.html bash-3.2# cd /opt/csw/gcc4/lib/gcc/i386-pc-solaris2.8/4.0.2/include/ bash-3.2# ls -ld X11 lrwxrwxrwx 1 root other 28 Feb 5 01:21 X11 -> root/usr/openwin/include/X11 Fix this broken symlink with: bash-3.2# ln -s /usr/include/X11 X11 Add to path: /opt/csw/gcc4/bin/ bash-3.2# PATH=$PATH:/opt/csw/gcc4/bin/ Download Mercurial Source and install with: http://www.selenic.com/mercurial/wiki/index.cgi/BinaryPackages#head-f90bf04a392bc29d5e90494a6e753bc8f140dbf3 bash-3.2# /opt/csw/bin/python2.5 setup.py install --force bash-3.2# cd /opt/csw/gcc4/bin/ bash-3.2# ln -s /opt/csw/gcc4/bin/gcc ./cc