Solaris - saprykin/plibsys GitHub Wiki

Configurations

Version Compilers Status Tests
11.4.42 (x64) GCC 11.2.0 (x86, x64) Compiled Passed
11.4.42 (x64) GCC 7.5.0 (x86, x64) Compiled Passed
11.4.42 (x64) Clang 11.0.0 (x86, x64) Compiled Passed
11.4.42 (x64) ODS 12.6 (x86, x64) Compiled Passed
11.4.74 (SPARCv9) GCC 14.1.0 (m32, m64) Compiled Passed
11.4.74 (SPARCv9) Clang 19.1.0 (m32, m64) Compiled Passed
11.4.74 (SPARCv9) ODS 12.6 (m32, m64) Compiled Passed
10 1/13 (SPARCv9) GCC 5.5.0 (m32, m64) Compiled Passed
10 1/13 (SPARCv9) OSS 12.6 (m32, m64) Compiled Passed
10 1/13 (SPARCv9) SunPro 5.9 (m32, m64) Compiled Passed
9 (SPARCv8) GCC 4.5.4 (m32) Compiled Passed
9 (SPARCv8) SunPro 5.5 (m32) Compiled Passed

Installation

Solaris 10 is available for free download from Oracle.

Solaris 11 is available for free download from Oracle.

Distribution (usually) comes with GCC in base installation, more packages are available from official repository. Use pkg install <package_name> to install any package automatically (repository is autoconfigured during the system installation). Follow download instructions to get the latest version of Oracle Developer Studio (ODS) (previously named as Oracle Solaris Studio (OSS), or Sun Studio, or Sun WorkShop, or Forte Developer, or SunPro Compilers).

CMake can be built from sources using GCC, but check repositories first.

Updated. Oracle Solaris Studio has been renamed to Oracle Developer Studio since the release version of 12.5.

By default, older versions of GCC and ODS compile x86 binaries so you should explicitly pass -m64 flag to compilers to produce x64 binaries. On the SPARC-based workstation there is the same principle.

QEMU

Solaris 10/11 for x64 hardware should work fine with QEMU considering some caveats:

  • Use older chipset profile like pc with i440FX and PIIX, otherwise the system may not boot.
  • Network card should be set to e1000.
  • Make sure it has enough RAM (like 4GB) and multiple CPU cores (like 2+), otherwise it will be slow.
  • Depending on how you plug a virtual machine into host network, you may need to manually request DHCP for a network interface and configure DNS. Configuring DNS is not as straightforward as on other systems, refer to svccfg manual or other sources.

Below is an example command to run Solaris 11 in QEMU:

qemu-system-x86_64 -m 4096 -M pc,vmport=off,i8042=off,hpet=off \
  -smp cpus=2,sockets=1,cores=2,threads=1 \
  -accel tcg,tb-size=1024 \
  -global PIIX4_PM.disable_s3=1 \
  -global ICH9-LPC.disable_s3=1 \
  -drive if=none,media=disk,id=hdd_main,file=solaris.qcow2 \
  -device ide-hd,bus=ide.1,drive=hdd_main,bootindex=1 \
  -drive if=none,media=cdrom,id=cd_main,readonly=on \
  -device ide-cd,bus=ide.0,drive=cd_main,bootindex=0 \
  -device virtio-rng-pci \
  -usb \
  -device usb-mouse,bus=usb-bus.0 \
  -device usb-kbd,bus=usb-bus.0 \
  -device nec-usb-xhci,id=usb-controller-0 \
  -nic user,model=e1000,hostfwd=tcp::10022-:22

Solaris 10/11 for SPARCv9 hardware, in general, are not supported well, and only limited functionality is present. Solaris 9 and older versions, however, should work well with QEMU, images are available through UTM. Most of required software is available through tgcware repository, where builds for Solaris 7 shall be used. When using tgcware, you need to make sure that proper PATH variable is set (e.g., export PATH=/usr/tgcware/sparc-sun-solaris2.7/bin:/usr/tgcware/bin:$PATH), as well as LD_LIBRARY_PATH (e.g., export LD_LIBRARY_PATH=/usr/tgcware/lib). These variables must be set before building CMake (versions 2.8.x should work). As GCC from tgcware is built on an older system, its internal headers like <sys/types.h> clash with the system headers, hence, re-run header generation: /usr/tgcware/libexec/gcc/sparc-sun-solaris2.7/4.5.4/install-tools/mkheaders. As alternative, Sun Studio 8 compiler can be used.

Solaris 9 image from UTM can be run in QEMU using the command below:

qemu-system-sparc -m 256 -M SS-5 -bios ss5.bin \
  -vga tcx \
  -smp cpus=1,sockets=1,cores=1,threads=1 \
  -accel tcg,tb-size=64 \
  -drive if=none,media=disk,id=main_hdd_0,file=disk-0.qcow2,discard=unmap,detect-zeroes=unmap \
  -device scsi-hd,bus=scsi.0,channel=0,scsi-id=0,drive=main_hdd_0,bootindex=0 \
  -drive if=none,media=disk,id=main_hdd_1,file=disk-1.qcow2,discard=unmap,detect-zeroes=unmap \
  -device scsi-hd,bus=scsi.0,channel=0,scsi-id=1,drive=main_hdd_1,bootindex=1 \
  -drive if=none,media=disk,id=main_hdd_2,file=disk-2.qcow2,discard=unmap,detect-zeroes=unmap \
  -device scsi-hd,bus=scsi.0,channel=0,scsi-id=2,drive=main_hdd_2,bootindex=2 \
  -drive if=none,media=disk,id=main_hdd_3,file=disk-3.qcow2,discard=unmap,detect-zeroes=unmap \
  -device scsi-hd,bus=scsi.0,channel=0,scsi-id=3,drive=main_hdd_3,bootindex=3 \
  -drive if=none,media=disk,id=main_hdd_4,file=disk-4.qcow2,discard=unmap,detect-zeroes=unmap \
  -device scsi-hd,bus=scsi.0,channel=0,scsi-id=4,drive=main_hdd_4,bootindex=4 \
  -drive if=none,media=disk,id=main_hdd_5,file=disk-5.qcow2,discard=unmap,detect-zeroes=unmap \
  -device scsi-hd,bus=scsi.0,channel=0,scsi-id=5,drive=main_hdd_5,bootindex=5 \
  -drive if=none,media=cdrom,id=main_cd,readonly=on \
  -device scsi-cd,bus=scsi.0,channel=0,scsi-id=6,drive=main_cd,bootindex=6 \
  -nic user,model=lance,hostfwd=tcp::10022-:22

GCC

You may have to pass proper directory with GCC libraries when running tests or programs.

When building x86 tests with GCC 3.4.x compiler you may encounter a floating point bug which affects the binary tree test. This bug is similar to GCC Bug 11040. To overcome it, pass -march=pentium4 -msse2 parameters to a C++ compiler.

ODS (OSS) / Sun Studio

If you are building static tests with ODS (OSS) compiler < 12.6, then pass -std=c++03 to C++ compiler flags.

Clang

Last versions of Solaris 11.4 have official Clang added to repositories.