Please forgive my ignorance... I only use Solaris for testing C/C++ libraries I have an interest in. I'm not a Solaris admin or Solaris user.

I installed GCC-5 on Solaris 11.3, x86 because I needed a C++ compiler that supports -std=c++11 (see below for the package output). Sun's native GCC is 4.8, and it does not support C++11 well (or at all).

Unfortunately, I cannot find it after the install:

$ g++-5 --version
-bash: g++-5: command not found  

$ sudo find /usr -name gcc-5
$ sudo find /bin -name gcc-5

And for completeness:

$ /bin/gcc --version
gcc (GCC) 4.8.2

$ ls -l /usr/bin/gcc
lrwxrwxrwx   1 root   root   18 Jun  7  2016 /usr/bin/gcc -> ../gcc/4.8/bin/gcc

$ which gcc-5
no gcc-5 in /usr/local/bin /usr/local/sbin /bin /sbin /usr/bin /usr/sbin /usr/sfw/bin

Where is the compiler located?

According to Installing GCC on Oracle Solaris 11 on Stack Overflow, its supposed to be in /usr/bin/gcc as a symlink. But the answer appears to be off a bit:

$ /usr/bin/gcc --version
gcc (GCC) 4.8.2

According to GCC missing from Solaris 11, and server already deployed on Server Fault:

/usr/sfw/bin is the bundled gcc path with Solaris 10. On Solaris 11.1, gcc is, when installed, directly available in /usr/bin as a symlink that points to /usr/gcc/<version>/bin/gcc

The answer appears to be off a bit, too.

$ sudo pkg install --accept gcc-5
Package: pkg://solaris/release/[email protected],5.12-
License: evaluation

This software has been made available for evaluation purposes only.
See http://www.oracle.com/technetwork/server-storage/solaris11/technologies/foss-evaluation-program-2586275.html for further information.        

           Packages to install:  2
       Create boot environment: No
Create backup boot environment: No

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                                2/2           8/8      0.0/0.0 17.4k/s

PHASE                                          ITEMS
Installing new actions                         37/37
Updating package state database                 Done
Updating package cache                           0/0
Updating image state                            Done
Creating fast lookup database                   Done
Updating package cache                           2/2

After installing gcc-5:

$ find / -name 'gcc*' 2>/dev/null


~$ pkg search -l gcc | grep ^basename
basename             dir    opt/developerstudio12.5/lib/compilers/CC-gcc/lib/gcc               pkg:/developer/developerstudio-125/library/[email protected]
basename             dir    opt/solarisstudio12.4/lib/compilers/CC-gcc/lib/gcc                 pkg:/developer/solarisstudio-124/library/[email protected]
basename             dir    usr/include/gc/atomic_ops/sysdeps/gcc                              pkg:/library/[email protected]
basename                    link   usr/bin/gcc                                                        pkg:/developer/gcc-4/[email protected]
basename                    file   usr/gcc/4.8/bin/gcc                                                pkg:/developer/gcc-4/[email protected]
pkg: Search performance is degraded.
  • Try to use : gcc --version and not gcc-5 --version
    – Slh47
    Jan 22, 2017 at 12:18
  • 1
    Is /usr/gcc a softlink?
    – FloHe
    Jan 22, 2017 at 12:21
  • @FloHe - Both /bin/gcc and /usr/bin/gcc are GCC 4.8. I updated the question with the output of the commands.
    – user56041
    Jan 22, 2017 at 12:23
  • are you certain the install completed correctly?
    – Rory Alsop
    Jan 22, 2017 at 12:24
  • Maybe try: which gcc-5
    – FloHe
    Jan 22, 2017 at 12:25

3 Answers 3



# pkg change-facet \
      version-lock.system/library/gcc/gcc-c-runtime=false \

and try again.

So the issue is that gcc-5 is what's known as a "group" package. That is, it consists (at least primarily) of a bunch of group dependencies. A group dependency is one that will be installed if possible, but ignored if not. In this case, it was not possible to install one or more of the dependencies of gcc-5, so they were ignored, and you ended up with less than you expected.

When that happens (whether it's fewer packages, or packages at a different version), the first thing you should do is tell pkg what you actually expect. (Now, the disconnect here is how to know what to expect; without knowing how to inspect gcc-5 for that information, or even knowing that you might have to, I'm not sure how to answer that.) In this case, choose one of its dependencies to see if it helps; say, gcc-c-5 (you followed this step for gcc-c++-5, which gave you the same problem as I show here, but I wanted to put it all together in one answer). This tells pkg not to ignore its inability to install gcc-c-5, but to actually complain in detail about why it couldn't be installed. Hopefully there will be something in the output to give us a clue about what to do next:

# pkg install -nv gcc-5 gcc-c-5
Creating Plan (Solver setup): |
pkg install: No matching version of developer/gcc-5 can be installed:
  Reject:  pkg://solaris/developer/[email protected]
  Reason:  No version matching 'group' dependency developer/gcc/gcc-c++-5 can be installed
    Reject:  pkg://solaris/developer/gcc/[email protected]
    Reason:  No version matching 'require' dependency developer/gcc/gcc-c-5 can be installed
      Reject:  pkg://solaris/developer/gcc/[email protected]
      Reason:  No version matching 'require' dependency system/library/gcc/[email protected],5.11- can be installed
        Reject:  pkg://solaris/system/library/gcc/[email protected]
        Reason:  No version matching 'require' dependency system/library/gcc/[email protected],5.11- can be installed
          Reject:  pkg://solaris/system/library/gcc/[email protected]
          Reason:  This version is excluded by installed incorporation consolidation/userland/[email protected]
        Reason:  This version is excluded by installed incorporation consolidation/userland/[email protected]
No matching version of developer/gcc/gcc-c-5 can be installed:
  Reject:  pkg://solaris/developer/gcc/[email protected]
  Reason:  [already rejected; see above]

When you get a mess of solver output like this, you typically want to look for the deepest-indented issue and see if you can correct that. In this case, you see that it's unable to install [email protected] because it's excluded by an installed incorporation.

Perhaps a digression is necessary: what's an incorporation? Like a group package, it's a package that primarily delivers dependencies, in this case, incorporate dependencies. These dependencies never actually cause packages to be installed; they simply place constraints on packages that may be installed. Specifically, incorporating [email protected] means that if foo is installed, it must be in the version range [1.2, 1.3); that is, a minimum of 1.2 (inclusive), and a maximum of 1.3 (exclusive), or anything that matches 1.2.x.y.z.....

In this case, the incorporation userland-incorporation that's already installed on the system has placed a constraint on gcc-c-runtime that's incompatible with the version of gcc-c-runtime that installing gcc-c-5 requires.

That's where we run into one of the oddities of the Solaris FOSS evaluation program. The packages made available there are not well integrated with the rest of the system; they're designed to be installed on a newer version of Solaris. But they've been built such that the system can at least be sanely massaged into letting them be installed. In this case, you have to change a few facets.

Most of the FOSS packages in Solaris are incorporated in such a way that the constraint delivered by that incorporate dependency can be relaxed. You can do that by changing the facet named by version-lock.<pkg-name> to false. In this case, gcc-c-runtime and gcc-c++-runtime are the two packages blocking the installation you want, so (as above):

# pkg change-facet \
      version-lock.system/library/gcc/gcc-c-runtime=false \

This will give a bit of output, but not seemingly do much. Once it's done, though, we can try again:

# pkg install -nv gcc-5 gcc-c-5
           Packages to install:      20
            Packages to update:       2
           Mediators to change:       1
            Services to change:       1
     Estimated space available: 8.54 GB
Estimated space to be consumed: 1.49 GB
       Create boot environment:      No
Create backup boot environment:     Yes
          Rebuild boot archive:      No

Changed mediators:
  mediator gcc:
           version: None -> 5 (system default)

Changed packages:
    None -> 0.5.11,5.11-
    None -> 5.4.0,5.12-
    None -> 5.4.0,5.12-
    None -> 5.4.0,5.12-
    None -> 5.4.0,5.12-
    None -> 5.4.0,5.12-
    None -> 5.4.0,5.12-
    None -> 2.23.1,5.11-
    None -> 4.3.2,5.11-
    None -> 0.12.2,5.12-
    None -> 0.9,5.11-
    None -> 2.4.2,5.11-
    None -> 1.0,5.12-
    None -> 0.5.11,5.11-
    None -> 5.4.0,5.12-
    None -> 5.4.0,5.12-
    None -> 4.8.2,5.11-
    None -> 5.4.0,5.12-
    None -> 4.8.2,5.11-
    None -> 5.4.0,5.12-
    4.8.2,5.11- -> 5.4.0,5.12-
    4.8.2,5.11- -> 5.4.0,5.12-

And voila, we get a bunch of packages installed, which actually contain stuff. From here, you should now be able to type gcc --version and see that it is indeed 5.4.0. Note also that the two packages whose facets we unlocked got upgraded, a possibility available after the unlocking.

You might ask why we didn't need to unlock any other facets. The reason for that is that Solaris 11.3 didn't deliver GCC 5, and so didn't deliver any constraints on its package versions. So all the gcc-*-5 packages are already unconstrained, and needn't be unlocked in order to relax constraints.

You might notice that the gcc-gfortran-runtime and gcc-gobjc-runtime packages got installed at their 4.8 versions. That's because they're still constrained, but nothing we did conflicted with those constraints. For consistency, you probably should unlock them as well, and then upgrade them to their 5.x versions (or, if you've gotten this far before trying anything, just unlock them from the start).

  • Thanks @Danek, and sorry for the late reply. I'm on another Solaris testing cycle. I ran pkg change-facet followed by pkg install -nv gcc-5 gcc-c-5. The output was clean, meaning I did not see errors or output like you detailed on the reject path. Afterwards GCC is still 4.8.2 and gcc-5 --version results in gcc-5: command not found. I still seem to be missing something.
    – user56041
    Dec 28, 2017 at 18:43
  • Different versions of gcc are in /usr/gcc. We don't ship /usr/bin/gcc-<version>, though that might be a worthwhile bug to file. You can use /usr/gcc/5/bin/gcc directly, or you can tell the packaging system which thing should be at /usr/bin/gcc: pkg set-mediator -V 5 gcc. Dec 28, 2017 at 22:11

Try this:

ls -l /usr/bin/gcc

You'll probably see something like

... /usr/bin/gcc -> ../gcc/4.8/bin/gcc

GCC 5.x should be in /usr/gcc/5.x/...

My Solaris 11 install has multiple versions of GCC under /usr/gcc.

Update: And none of those versions under /usr/gcc are a 5.x version. Where'd it go?

  • Thanks Andrew. I don't have a /usr/gcc/5.x/ after install. How did you install GCC 5.x?
    – user56041
    Jan 22, 2017 at 12:54
  • @jww I have a bunch of different 4.x versions. No 5, though?!?! Strange. I'm going to have to dig into this. Jan 22, 2017 at 12:58
  • @jww What does pkg search gcc show? The basename entries should show all the versions of the gcc command installed on your system. Jan 22, 2017 at 13:06
  • @jww Line 287: basename file usr/gcc/5.3/bin/gcc pkg:/developer/gcc/[email protected] That seems to indicate you should have a /usr/gcc/5.3/bin/gcc installed. Line 289 also shows a 5.3.0- version. What does pkg search -l gcc | grep ^basename show? That should show just the files named gcc that are actually installed. Jan 22, 2017 at 13:21
  • Added to the question (last block).
    – user56041
    Jan 22, 2017 at 13:37

First, a listing from pkg publisher would be useful. As well as a pkg list |grep gcc

And it doesn't appear it was installed, your output only shows (2) pkgs and (8) files being installed.

You might need to release the constraints to be able to install. Your output from the install hints that you're installing from the FOSS eval chain. Suggest you review along with the link provided in your output:

How to Access Selected FOSS Evaluation Packages for Oracle Solaris 11.3

Also: Normally a pkg search gcc should help find where something was installed, as well as the pkg? A pkg contents <pkg> is also useful for finding what makes up a pkg.

I'd also have expected to see multiple pkgs be installed vs only 2 as I believe the gcc pkg should try to install multiple pkgs for all the developer tools.

Perhaps this is the pkg you want under the release repo? developer/gcc/gcc-c++-5

  • Thanks. sudo pkg install developer/gcc/gcc-c++-5 results in Reject: pkg://solaris/developer/gcc/[email protected] with Reason: No version matching 'require' dependency system/library/gcc/[email protected],5.11- can be installed.
    – user56041
    Jan 25, 2017 at 22:54
  • Try a ` pkg list -a |grep c++` to look for a version of gcc. And prior to the actual install, try a verbose dry run install to see if that gives you any information as to the cause of the failure. ie: pkg install -nv <pkg> Did you check the link above for the using the eval pkgs? I have yet to try using the eval pkgs, but it appears you might need to unlock some of the pkgs to install/update them. Jan 26, 2017 at 22:18

You must log in to answer this question.