0

I'm evaluating C++11 in Solaris 10 with the new Studio 12.4, which I downloaded, extracted to a subdirectory and whose bin dir I added to the PATH environment variable.

I can compile the "Hello world!" program, but if I try to add the "-std=c++11" parameter everything breaks, even if no C++11 specific features are present in the program.

Does someone knows what am I doing wrong? Thanks in advance!

/tmp/jarodrigues/cpp11>CC -V
CC: Sun C++ 5.13 SunOS_i386 2014/10/20
/tmp/jarodrigues/cpp11>CC hello.cpp -o hello
/tmp/jarodrigues/cpp11>./hello
Hello, world!
/tmp/jarodrigues/cpp11>CC -std=c++11 hello.cpp -o hello
ld: fatal: /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map: 1: expected a `=', `:', `|', or `@'
/tmp/jarodrigues/cpp11>CC -v -std=c++11 hello.cpp -o hello 2>&1 | grep gcc_version.map
/usr/ccs/bin/ld -zld32=-S/tmp/lib_link.1426884246.22089.05/libldstab_ws.so -zld64=-S/tmp/lib_link.1426884246.22089.05/amd64/libldstab_ws.so -zld32=-S/tmp/lib_link.1426884246.22089.05/libld_annotate.so -zld64=-S/tmp/lib_link.1426884246.22089.05/amd64/libld_annotate.so -zld32=-S/tmp/lib_link.1426884246.22089.05/libCCexcept.so.1 /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/crti.o /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CCgrti.o /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/crt1x.o /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/values-xa.o -M /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map hello.o -o hello -Y "P,/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/sse2:/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers:/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib:/usr/ccs/lib:/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/lib/:/lib:/usr/lib" -Qy "-R/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib:/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/lib/" -lstdc++ -lgcc_s -lCrunG3 -lm -lc /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CCgrtn.o /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/crtn.o 2> /tmp/ld.1426884246.22089.06.err
ld: fatal: /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map: 1: expected a `=', `:', `|', or `@'
/tmp/jarodrigues/cpp11>head -n 1 /tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map
$mapfile_version 2
/tmp/jarodrigues/cpp11>/usr/ccs/bin/ld -V
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.497
/tmp/jarodrigues/cpp11>cat /etc/release
                       Solaris 10 10/09 s10x_u8wos_08a X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                           Assembled 16 September 2009
  • 1
    Somehow you're running an ld that doesn't like the syntax of the map file. Can you edit your question to include (a) the output of `CC -v -std=c++11 hello.cpp -o hello 2>&1 | grep gcc_version.map` (which will show the full path of `ld`) and (b) the first line of of `/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/‌​compilers/CC-gcc/gcc_version.map` (which should be `$mapfile_version 2`) and (c) the output of `/usr/ccs/bin/ld -V` and (d) the contents of `/etc/release` (Studio 12.4 is supported on Solaris 10u10 and later). – Mark Plotnick Mar 20 '15 at 19:34
  • 1
    The `solarisstudio12.4/lib/compilers/CC-gcc` directory contains g++ shared libraries. When given the `--std=c++11` option, Studio 12.4 uses the g++ ABI and links with a version of the g++ runtime library (http://stackoverflow.com/questions/27490165/sun-studio-linking-gcc-libs-exceptions-do-not-work/27527146#27527146). – Mark Plotnick Mar 20 '15 at 20:06
  • I've added more commands output, as suggested by [Mark Plotnick](http://stackoverflow.com/users/2554472/mark-plotnick). It seems you're trying to check whether the problem lies in the `ld` tool. Its version seems to the one aligned with Solaris 10 and Studio 12.2... An upgrade might do the trick, but now I'm only able to do it on Monday; I'll provide additional details then... – André Rodrigues Mar 20 '15 at 21:04
  • Yes. I set up a freshly-downloaded Solaris 10u11, which has `/usr/ccs/bin/ld` version 5.10-1.1514. The `-std=c++11` option on a Hello, World type of program works fine. Same first line of the map file. – Mark Plotnick Mar 20 '15 at 22:01
  • As a first attempt, I set `LD_ALTEXEC` to `/usr/sfw/bin/gld`, thus specifying the GNU linker that comes with Solaris 10, but I get: `/usr/sfw/bin/gld:/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map: file format not recognized; treating as linker script /usr/sfw/bin/gld:/tmp/jarodrigues/cpp11/SolarisStudio12.4-solaris-x86-bin/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map:1: parse error` I'm going to try yet another linker tomorrow... – André Rodrigues Mar 23 '15 at 15:38
  • I finally understood what's the problem. Oracle Solaris Studio 12.4 indeed supports Solaris 10, but only a few minor versions of it, specifically Solaris 10 8/11 and Solaris 10 1/13. As mine is older (Solaris 10 10/09), I'm out of luck :( – André Rodrigues Apr 17 '15 at 15:56
  • I'm facing the same issue. My solaris OS is Oracle Solaris 10 8/11 s10x_u10wos_17b X86.1) shown ld path as /usr/ccs/bin/ld 2) vi /opt/solarisstudio12.4/lib/compilers/CC-gcc/gcc_version.map $mapfile_version 2 3) /usr/ccs/bin/ld -V ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1514 4) /etc/release: Oracle Solaris 10 8/11 s10x_u10wos_17b X86 Even then why am seeing this error. I am building openjdk8 sourcefor 32-bit in solaris 10. – preethi selvaraju Jun 12 '20 at 02:20

0 Answers0