8

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/evaluation@1.0,5.12-5.12.0.0.0.115.0:20170111T175931Z
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
/usr/share/vim/vim73/compiler/gcc.vim
/usr/share/gcc-4.8.2
/usr/share/man/man1/gcc.1
/usr/gcc
/usr/gcc/4.8/bin/gcc-nm
/usr/gcc/4.8/bin/gcc-ranlib
/usr/gcc/4.8/bin/gcc
/usr/gcc/4.8/bin/gcc-ar
/usr/gcc/4.8/lib/gcc
/usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/plugin/include/ada/gcc-interface
/usr/gcc/4.8/lib/gcc/i386-pc-solaris2.11/4.8.2/plugin/include/gcc-plugin.h
/usr/gcc/4.8/share/locale/de/LC_MESSAGES/gcc.mo
/usr/gcc/4.8/share/locale/ja/LC_MESSAGES/gcc.mo
/usr/gcc/4.8/share/locale/fr/LC_MESSAGES/gcc.mo
/usr/gcc/4.8/share/locale/zh_CN/LC_MESSAGES/gcc.mo
/usr/gcc/4.8/share/locale/zh_TW/LC_MESSAGES/gcc.mo
/usr/gcc/4.8/share/locale/es/LC_MESSAGES/gcc.mo
/usr/gcc/4.8/share/gcc-4.8.2
/usr/gcc/4.8/share/info/gccinstall.info
/usr/gcc/4.8/share/info/gccint.info
/usr/gcc/4.8/share/info/gcc.info
/usr/gcc/4.8/share/man/man1/gcc.1
/usr/bin/gcc
/usr/local/share/emacs/24.5/lisp/cedet/semantic/bovine/gcc.el
/usr/local/share/emacs/24.5/lisp/cedet/semantic/bovine/gcc.elc
/usr/include/gc/atomic_ops/sysdeps/gcc
/usr/include/avahi-common/gccmacro.h
/usr/include/pulse/gccmacro.h
/export/home/jwalton/botan/src/scripts/ci/circle/gcc-sanitizer.sh
/export/home/jwalton/botan/src/scripts/ci/circle/gcc-static-debug.sh
/export/home/jwalton/botan/src/scripts/ci/circle/gcc-shared-debug.sh
/export/home/jwalton/botan/src/build-data/cc/gcc.txt
/export/home/jwalton/zlib-1.2.8/contrib/gcc_gvmat64
/opt/developerstudio12.5/lib/compilers/CC-gcc/lib/gcc
/opt/developerstudio12.5/lib/compilers/CC-gcc/gcc_version.map
/opt/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map
/opt/solarisstudio12.4/lib/compilers/CC-gcc/lib/gcc

And:

~$ pkg search -l gcc | grep ^basename
basename             dir    opt/developerstudio12.5/lib/compilers/CC-gcc/lib/gcc               pkg:/developer/developerstudio-125/library/studio-gccrt@12.5-1.0.0.0
basename             dir    opt/solarisstudio12.4/lib/compilers/CC-gcc/lib/gcc                 pkg:/developer/solarisstudio-124/library/studio-gccrt@12.4-1.0.0.0
basename             dir    usr/include/gc/atomic_ops/sysdeps/gcc                              pkg:/library/gc@7.2-0.175.2.0.0.39.0
basename                    link   usr/bin/gcc                                                        pkg:/developer/gcc-4/gcc-c-48@4.8.2-0.175.3.0.0.30.0
basename                    file   usr/gcc/4.8/bin/gcc                                                pkg:/developer/gcc-4/gcc-c-48@4.8.2-0.175.3.0.0.30.0
pkg: Search performance is degraded.
  • Try to use : gcc --version and not gcc-5 --version – Slh47 Jan 22 '17 at 12:18
  • 1
    Is /usr/gcc a softlink? – FloHe Jan 22 '17 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 '17 at 12:23
  • are you certain the install completed correctly? – Rory Alsop Jan 22 '17 at 12:24
  • Maybe try: which gcc-5 – FloHe Jan 22 '17 at 12:25
10

TL;DR:

# pkg change-facet \
      version-lock.system/library/gcc/gcc-c-runtime=false \
      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/gcc-5@5.4.0-5.12.0.0.0.115.0
  Reason:  No version matching 'group' dependency developer/gcc/gcc-c++-5 can be installed
    ----------------------------------------
    Reject:  pkg://solaris/developer/gcc/gcc-c++-5@5.4.0-5.12.0.0.0.115.0
    Reason:  No version matching 'require' dependency developer/gcc/gcc-c-5 can be installed
      ----------------------------------------
      Reject:  pkg://solaris/developer/gcc/gcc-c-5@5.4.0-5.12.0.0.0.115.0
      Reason:  No version matching 'require' dependency system/library/gcc/gcc-c++-runtime@5.4.0,5.11-5.12.0.0.0.115.0 can be installed
        ----------------------------------------
        Reject:  pkg://solaris/system/library/gcc/gcc-c++-runtime@5.4.0-5.12.0.0.0.115.0
        Reason:  No version matching 'require' dependency system/library/gcc/gcc-c-runtime@5.4.0,5.11-5.12.0.0.0.115.0 can be installed
          ----------------------------------------
          Reject:  pkg://solaris/system/library/gcc/gcc-c-runtime@5.4.0-5.12.0.0.0.115.0
          Reason:  This version is excluded by installed incorporation consolidation/userland/userland-incorporation@0.5.11-0.175.3.19.0.2.0
          ----------------------------------------
        Reason:  This version is excluded by installed incorporation consolidation/userland/userland-incorporation@0.5.11-0.175.3.19.0.2.0
        ----------------------------------------
      ----------------------------------------
    ----------------------------------------
No matching version of developer/gcc/gcc-c-5 can be installed:
  Reject:  pkg://solaris/developer/gcc/gcc-c-5@5.4.0-5.12.0.0.0.115.0
  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 gcc-c-runtime@5.4.0-5.12.0.0.0.115.0 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 foo@1.2 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 \
      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:
solaris
  developer/assembler
    None -> 0.5.11,5.11-0.175.3.9.0.2.0:20160528T012706Z
  developer/gcc-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T170530Z
  developer/gcc/gcc-c++-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T164822Z
  developer/gcc/gcc-c-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T165027Z
  developer/gcc/gcc-common-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T165220Z
  developer/gcc/gcc-gfortran-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T165431Z
  developer/gcc/gcc-gobjc-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T165624Z
  developer/gnu-binutils
    None -> 2.23.1,5.11-0.175.3.0.0.30.0:20150821T164528Z
  library/gmp
    None -> 4.3.2,5.11-0.175.3.0.0.30.0:20150821T165358Z
  library/isl
    None -> 0.12.2,5.12-5.12.0.0.0.115.0:20170111T171737Z
  library/mpc
    None -> 0.9,5.11-0.175.3.0.0.30.0:20150821T165558Z
  library/mpfr
    None -> 2.4.2,5.11-0.175.3.0.0.30.0:20150821T165559Z
  release/evaluation
    None -> 1.0,5.12-5.12.0.0.0.115.0:20170111T175931Z
  system/header
    None -> 0.5.11,5.11-0.175.3.19.0.2.0:20170328T014052Z
  system/library/gcc/gcc-c++-runtime-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T181800Z
  system/library/gcc/gcc-c-runtime-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T181840Z
  system/library/gcc/gcc-gfortran-runtime
    None -> 4.8.2,5.11-0.175.3.0.0.30.0:20150821T172507Z
  system/library/gcc/gcc-gfortran-runtime-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T181902Z
  system/library/gcc/gcc-gobjc-runtime
    None -> 4.8.2,5.11-0.175.3.0.0.30.0:20150821T172513Z
  system/library/gcc/gcc-gobjc-runtime-5
    None -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T181919Z
  system/library/gcc/gcc-c++-runtime
    4.8.2,5.11-0.175.3.0.0.30.0:20150821T172447Z -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T181825Z
  system/library/gcc/gcc-c-runtime
    4.8.2,5.11-0.175.3.0.0.30.0:20150821T172458Z -> 5.4.0,5.12-5.12.0.0.0.115.0:20170111T181848Z

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 '17 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. – Danek Duvall Dec 28 '17 at 22:11
1

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 '17 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. – Andrew Henle Jan 22 '17 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. – Andrew Henle Jan 22 '17 at 13:06
  • @jww Line 287: basename file usr/gcc/5.3/bin/gcc pkg:/developer/gcc/gcc-c-53@5.3.0-5.12.0.0.0.95.0 That seems to indicate you should have a /usr/gcc/5.3/bin/gcc installed. Line 289 also shows a 5.3.0-5.12.0.0.0.105.1 version. What does pkg search -l gcc | grep ^basename show? That should show just the files named gcc that are actually installed. – Andrew Henle Jan 22 '17 at 13:21
  • Added to the question (last block). – user56041 Jan 22 '17 at 13:37
1

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/gcc-c++-5@5.4.0-5.12.0.0.0.115.0 with Reason: No version matching 'require' dependency system/library/gcc/gcc-c-runtime@5.4.0,5.11-5.12.0.0.0.115.0 can be installed. – user56041 Jan 25 '17 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. – sleepyweasel Jan 26 '17 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy