5 Replies Latest reply: Jun 27, 2013 11:35 AM by ChrisQuenelle RSS

    Is "version" broken in Solaris Studio 12.2?

    mosquitobytes
      With 12.1, the "{Studio install path}/bin/version" command, when run with no arguments, produces output indicating that Sun Studio 12.1 is installed. With 12.2, there is no output that a script could use to determine which version of Studio is installed. It seems that when verison is invoked with no arguments, it attempts to read from the directory {Studio install path}/inventory. Our 12.1 installation has this directory, but it is not present in our 12.2 installation.

      Does anyone have a Studio 12.2 installation on Solaris 10 that does include an inventory directory?

      This is what my output from version looks like with 12.2:

      Machine hardware:   sun4u
      OS version:         5.10
      Processor type:     sparc
      Hardware:           SUNW,SPARC-Enterprise

      The following components are installed on your system:

      And this is what it looks like with 12.1:

      Machine hardware:   sun4u
      OS version:         5.10
      Processor type:     sparc
      Hardware:           SUNW,SPARC-Enterprise

      The following components are installed on your system:


      Sun Studio 12 update 1
      Sun Studio 12 update 1 C Compiler
      Sun Studio 12 update 1 C++ Compiler
      Sun Studio 12 update 1 Tools.h++ 7.1
      Sun Studio 12 update 1 C++ Standard 64-bit Class Library
      Sun Studio 12 update 1 Garbage Collector
      Sun Studio 12 update 1 Fortran 95
      Sun Studio 12 update 1 Debugging Tools (including dbx)
      Sun Studio 12 update 1 IDE
      Sun Studio 12 update 1 Performance Analyzer (including collect, ...)
      Sun Studio 12 update 1 Performance Library
      Sun Studio 12 update 1 Scalapack
      Sun Studio 12 update 1 LockLint
      Sun Studio 12 update 1 Building Software (including dmake)
      Sun Studio 12 update 1 Documentation Set
      Sun Studio 12 update 1 /usr symbolic links and GNOME menu item

      version of "/opt/sunstudio12.1/bin/../prod/bin/../../bin/cc": Sun C 5.10 SunOS_sparc 2009/06/03
      version of "/opt/sunstudio12.1/bin/../prod/bin/../../bin/CC": Sun C++ 5.10 SunOS_sparc 2009/06/03
      version of "/opt/sunstudio12.1/bin/../prod/bin/../../bin/f90": Sun Fortran 95 8.4 SunOS_sparc 2009/06/03
      version of "/opt/sunstudio12.1/bin/../prod/bin/../../bin/dbx": Sun DBX Debugger 7.7 SunOS_sparc 2009/06/03
      version of "/opt/sunstudio12.1/bin/../prod/bin/../../bin/analyzer": Sun Analyzer 7.7 SunOS_sparc 2009/06/03
      version of "/opt/sunstudio12.1/bin/../prod/bin/../../bin/dmake": Sun Distributed Make 7.9 SunOS_sparc 2009/06/03
        • 1. Re: Is "version" broken in Solaris Studio 12.2?
          NikMolchanov
          Yes, I see the same problem on our system:

          % /opt/sunstudio12.2/bin/version
          Machine hardware: sun4v
          OS version: 5.10
          Processor type: sparc
          Hardware: SUNW,Sun-Fire-T1000

          The following components are installed on your system:


          %

          And it looks like this problem exists in Oracle Solaris Studio 12.3 Beta as well.

          Thanks.
          Nik
          • 2. Re: Is "version" broken in Solaris Studio 12.2?
            ChrisQuenelle
            In previous releases, the list of installed packages didn't really help you
            know which tools were installed. But in recent releases, the packages map
            pretty closely to tools.

            So the "list all" mode of the version utility was removed as unnecessary.
            You can still use it to extract the version information from an individual binary.
            There is a man page for the utility which also tells you how to list the packages
            using the native commands on your OS.

            - On Solaris 10 platforms, type:
            pkginfo | grep SPRO

            - On Linux platforms, type:
            rpm -qa | grep sun-

            - On Solaris 11 platforms, type:
            pkg list | grep -i studio

            These commands are approximations and may show additional packages
            beyond the individual product you might be looking for, but the output
            is generally fairly parsable by humans.
            • 3. Re: Is "version" broken in Solaris Studio 12.2?
              NikMolchanov
              Chris,
              Thank you for the explanation.
              BTW, usually we do not install packages, we simply extract tar files.
              I think utility version could be smart enough to handle this case as well.

              Thanks.
              Nik
              • 4. Re: Is "version" broken in Solaris Studio 12.2?
                mosquitobytes
                Nik - thanks for confirming that we aren't alone in seeing this behavior.

                Chris, thanks for explaining that this is the behavior that we should expect. I spent several hours considering if something might have gone wrong during the installation of Solaris Studio. My colleague who actually performed the installation will likely be almost as gratified as I am to review your explanation.

                By way of feeback, I would like to offer the following comments.

                1) It's regrettable that this functionality was removed without any sort of deprecation notice (at least, none that I could find, and I looked pretty hard). My colleagues and I spent several hours wondering what we did wrong since this wasn't working. Truss shows that the 12.2 bin/version tool still looks for the "inventory" directory and so the fact that it was missing suggested to me that something might have gone wrong with our installation.

                2) While the alternative pkginfo command you suggest is, as you described it, "parsable by humans", it's not especially script-friendly. A build script that only has the simple task of warning that you are using an unsupported older version of the Solaris Studio requires many lines of new logic to deal with this change, and one that has the more complex task of choosing different compiler args depending on the version of Sun/Solaris Studio that is being used really has to work overtime just to accommodate the inconsistent methods of identifying which version is in use.

                3) It would be really nice if there was some simple, script-friendly, way to discover what version is in use, and if that method was consistently supported from one release to the next, and if that method reported version numbers in ways that lend themselves to interpreation by scripts. I'm sure that there's some korn guru out there who can write one line of korn-shell code that will be able to conclude that pkginfo's value of "SPRO-12u2-cc" is greater than the 12.1 version's report of "Sun Studio 12 update 1", but I'm a "C" guy, not a script guru, so I wind up with a paragraph of korn shell code to pull this off. Can't we just have some program or (ideally) cc argument that spits out a string like "12.2"? It would be espeically sweet if it could do this on the first line of output (or even just a consistent offset from the first line).

                Sorry for the rant, I really do appreciate your explanation, and I hope my comments have not offended you.
                • 5. Re: Is "version" broken in Solaris Studio 12.2?
                  ChrisQuenelle

                  No offense taken.

                   

                  I just stumbled on this response from years ago.  I guess answering late is better than answering never.  There are two good ways to get the version of the compiler.  Inside the source code you can test for __SUNPRO_C which has a hex integer value representing the major and minor version of the compiler, from a script you can use "cc -V" or "CC -V" to get the version of the C or C++ compiler.  Recent releases of Studio do not have the ability to install subsets of the packages, so you either have it all or you have none of it.