Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-1074

HOWTO: Compiling stdcxx 4.2.1 on Solaris with Sun Studio 12.3 compiler

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.2.1
    • Fix Version/s: 4.2.1
    • Component/s: Build and Installation
    • Environment:

      Tested on:
      Solaris 10 i386 32bit
      Solaris 11 i386 32bit
      Solaris 10 SPARC 64bit

    • Patch Info:
      Patch Available

      Description

      Set your environment according to your machine type... intel and sparc examples shown

          i386 32bit:
          setenv CC "cc"
          setenv CXX "CC"
          setenv BUILDTYPE 8d
          setenv CFLAGS_I386_COMMON "-m32 -xarch=386 -Xc -features=extinl -xregs=no%frameptr -xO3 -xbuiltin=%none -KPIC -DPIC"
          setenv CFLAGS "${CFLAGS_I386_COMMON}"
          setenv CXXFLAGS_I386_COMMON "-library=Crun -norunpath -Qoption ccfe ++boolflag:sunwcch=false -Qoption ccfe +d2,-xgeninl=system -Qoption ccfe -expand=10000 -features=except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic -instances=global -template=geninlinefuncs -verbose=template -xregs=no%frameptr -xO3  -xbuiltin=%none -KPIC -DPIC -xlang=c99 -xbuiltin=%none -xinline= -xlibmieee -xustr=ascii_utf16_ushort -z ignore -KPIC -DPIC -mt -D_REENTRANT -DNDEBUG -D_IN_BUILD_STDCXX -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=500 -D_XPG5 -D_POSIX_PTHREAD_SEMANTICS -s +w2 -errtags -erroff=hidef"
          setenv CXXFLAGS_BUILD "-library=no%Cstd ${CXXFLAGS_I386_COMMON}"
          setenv CXXFLAGS_TESTS "-library=Cstd ${CXXFLAGS_I386_COMMON}"
      
          sparc 64bit:
          setenv CC "cc -xtarget=ultra -m64 -xcode=pic32"
          setenv CXX "CC -xtarget=ultra -m64 -xcode=pic32"
          setenv BUILDTYPE 8D
          setenv CFLAGS_SPARC_COMMON "-m64 -xarch=sparcvis -xmemalign=16i -Qoption cg -xregs=no%appl -xbuiltin=%none -xO4 -KPIC -DPIC"
          setenv CFLAGS "${CFLAGS_SPARC_COMMON}"
          setenv CXXFLAGS_SPARC_COMMON "-library=Crun -norunpath -Qoption ccfe ++boolflag:sunwcch=false -Qoption ccfe +d2,-xgeninl=system -Qoption ccfe -expand=10000 -features=except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic -instances=global -template=geninlinefuncs -verbose=template -xvis=yes -xregs=no%appl -xO4 -xbuiltin=%none -KPIC -DPIC -xlang=c99 -xbuiltin=%none -xinline= -xlibmieee -xustr=ascii_utf16_ushort -z ignore -KPIC -DPIC -mt -D_REENTRANT -DNDEBUG -D_IN_BUILD_STDCXX -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=500 -D_XPG5 -D_POSIX_PTHREAD_SEMANTICS -s +w2 -errtags -erroff=hidef"
          setenv CXXFLAGS_BUILD "-library=no%Cstd ${CXXFLAGS_SPARC_COMMON}"
          setenv CXXFLAGS_TESTS "-library=Cstd ${CXXFLAGS_SPARC_COMMON}"
      

      Then paste this into your (I'm using tcsh) shell to perform the compile.

          setenv TOPDIR  /var/tmp/stdcxx-4.2.1
          setenv CXXFLAGS "${CXXFLAGS_BUILD}"
          setenv BUILDDIR  "${TOPDIR}/build"
          setenv CPPFLAGS "-I/var/tmp/stdcxx-4.2.1/include/ansi -I/var/tmp/stdcxx-4.2.1/include/tr1 -I/var/tmp/stdcxx-4.2.1/include"
          setenv LDFLAGS "-lpthread -lumem -lm -lc -s -z ignore"
          setenv LD_OPTIONS "-M /usr/lib/ld/map.noexstk -M /usr/lib/ld/map.noexdata -M /usr/lib/ld/map.pagealign -lpthread -lumem -lm -lc -s -z ignore"
          cd /var/tmp
          rm -rf stdcxx-4.2.1
          untgz /usr/local/src/utils/stdcxx-4.2.1.tar.gz
          untgz /usr/local/src/utils/stdcxx-4.2.1.patches.tar.gz
          stdcxx-4.2.1.patches/install_patches_src.sh
          stdcxx-4.2.1.patches/fix_header_files.sh
          cd stdcxx-4.2.1
          mkdir lib
          ${CXX} ${CPPFLAGS} ${CXXFLAGS_BUILD} -c etc/config/src/collapse_static_locals.lib.cpp                          -o lib/collapse_static_locals.lib.o
          ${CXX} ${CXXFLAGS_BUILD} ${LDFLAGS}  -G -hcollapse_static_locals.lib.so lib/collapse_static_locals.lib.o       -o lib/libcollapse_static_locals.lib.so
          ${CXX} ${CPPFLAGS} ${CXXFLAGS_BUILD} -c etc/config/src/collapse_template_statics.lib.cpp                       -o lib/collapse_template_statics.lib.o
          ${CXX} ${CXXFLAGS_BUILD} ${LDFLAGS}  -G -hcollapse_template_statics.lib.so lib/collapse_template_statics.lib.o -o lib/libcollapse_template_statics.lib.so
          ${CXX} ${CPPFLAGS} ${CXXFLAGS_BUILD} -c etc/config/src/collapse_template_locals.lib.cpp                        -o lib/collapse_template_locals.lib.o
          ${CXX} ${CXXFLAGS_BUILD} ${LDFLAGS}  -G -hcollapse_template_locals.lib.so lib/collapse_template_locals.lib.o   -o lib/libcollapse_template_locals.lib.so
          ${CXX} ${CPPFLAGS} ${CXXFLAGS_BUILD} -c etc/config/src/extern_inline.lib.cpp                                   -o lib/extern_inline.lib.o
          ${CXX} ${CXXFLAGS_BUILD} ${LDFLAGS}  -G -hextern_inline.lib.so lib/extern_inline.lib.o                         -o lib/libextern_inline.lib.so
          ${CXX} ${CPPFLAGS} ${CXXFLAGS_BUILD} -c etc/config/src/lib_exceptions.lib.cpp                                  -o lib/lib_exceptions.lib.o
          ${CXX} ${CXXFLAGS_BUILD} ${LDFLAGS}  -G -hlib_exceptions.lib.so lib/lib_exceptions.lib.o                       -o lib/liblib_exceptions.lib.so
          echo setenv LD_OPTIONS "-L/var/tmp/stdcxx-4.2.1/lib -R/var/tmp/stdcxx-4.2.1/lib -L/var/tmp/stdcxx-4.2.1/build/include -R/var/tmp/stdcxx-4.2.1/build/include"
          setenv LD_OPTIONS "-L/var/tmp/stdcxx-4.2.1/lib -R/usr/local/lib -L/var/tmp/stdcxx-4.2.1/build/include -R/usr/local/include"
          gmake BUILDDIR="${BUILDDIR}" BUILDTYPE="${BUILDTYPE}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CONFIG=sunpro.config PREFIX=/usr/local SHELL=/bin/bash CC="${CC}" CXX="${CXX}" BUILDMODE="shared,pthreads" TOPDIR="/var/tmp/stdcxx-4.2.1" CXXFLAGS="${CXXFLAGS_BUILD}" LD_OPTIONS="${LD_OPTIONS}" LDFLAGS="${LDFLAGS} ${LD_OPTIONS}" config
          unsetenv LIBDIR
          unsetenv LD_OPTIONS
          mkdir -p build/lib/.depend build/include
          cp ../stdcxx-4.2.1.patches/atomic-cxx.d build/lib/.depend/.
          touch -acm build/lib/.depend/atomic-cxx.d
          rm -f build/include/rwconfig_std.h
          cp include/config.h build/include/config.h
          cp include/config.h build/include/rwconfig_std.h
          find . -type f -name "core" -exec rm -f {} \; -print
          gmake -C${BUILDDIR} BUILDDIR="${BUILDDIR}" BUILDTYPE="${BUILDTYPE}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CONFIG=sunpro.config PREFIX=/usr/local SHELL=/bin/bash CC="${CC}" CXX="${CXX}" BUILDMODE="shared,pthreads" TOPDIR="/var/tmp/stdcxx-4.2.1" CXXFLAGS="${CXXFLAGS_BUILD}" LDFLAGS="${LDFLAGS}" lib examples util
          mkdir -p build/etc/nls
          ln -s /var/tmp/stdcxx-4.2.1/etc/nls/languages build/etc/nls/languages
          ln -s /var/tmp/stdcxx-4.2.1/etc/nls/encodings build/etc/nls/encodings
          ln -s /var/tmp/stdcxx-4.2.1/etc/nls/countries build/etc/nls/countries
          ln -s /var/tmp/stdcxx-4.2.1/etc/nls/gen_list build/etc/nls/gen_list
          perl -pe 's/-library=no%Cstd/-library=Cstd/g' -i build/makefile.in
          perl -pe 's/-library=no%Cstd/-library=Cstd/g' -i build/include/vars.sh
          perl -pe 's/-library=no%Cstd/-library=Cstd/g' -i etc/config/sunpro.config
          gmake -C${BUILDDIR} BUILDDIR="${BUILDDIR}" BUILDTYPE="${BUILDTYPE}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CONFIG=sunpro.config PREFIX=/usr/local SHELL=/bin/bash CC="${CC}" CXX="${CXX}" BUILDMODE="shared,pthreads" TOPDIR="/var/tmp/stdcxx-4.2.1" LDFLAGS="${LDFLAGS}" CXXFLAGS="${CXXFLAGS_TESTS}" rwtest
          gmake -C${BUILDDIR} BUILDDIR="${BUILDDIR}" BUILDTYPE="${BUILDTYPE}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CONFIG=sunpro.config PREFIX=/usr/local SHELL=/bin/bash CC="${CC}" CXX="${CXX}" BUILDMODE="shared,pthreads" TOPDIR="/var/tmp/stdcxx-4.2.1" LDFLAGS="${LDFLAGS}" CXXFLAGS="${CXXFLAGS_TESTS}" tests
          perl -pe 's#/var/tmp/stdcxx-4.2.1/#/usr/local/#' -i build/include/config.h
          mkdir -p /usr/local/bin /usr/local/lib/pkgconfig /usr/local/share/stdcxx4/locale
          mkdir -p /usr/local/include/rw/config /usr/local/share/man/man3lib
          cp build/include/config.h /usr/local/include/rw/config/rwconfig_std.h
          cp ../stdcxx-4.2.1.patches/libstdcxx4.pc /usr/local/lib/pkgconfig/.
          perl -pe 's#^prefix=.*#prefix=/usr/local#' -i /usr/local/lib/pkgconfig/libstdcxx4.pc
          cp ../stdcxx-4.2.1.patches/libstdcxx4.3lib /usr/local/share/man/man3lib/.
          chmod 644 /usr/local/lib/pkgconfig/libstdcxx4.pc /usr/local/share/man/man3lib/libstdcxx4.3lib
          gmake -i -C${BUILDDIR} BUILDDIR="${BUILDDIR}" BUILDTYPE="${BUILDTYPE}" CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" CONFIG=sunpro.config PREFIX=/usr/local SHELL=/bin/bash CC="${CC}" CXX="${CXX}" BUILDMODE="shared,pthreads" TOPDIR="/var/tmp/stdcxx-4.2.1" LDFLAGS="${LDFLAGS}" CXXFLAGS="${CXXFLAGS_TESTS}" install
          echo /usr/bin/elfedit -e 'dyn:delete RPATH' /usr/local/lib/libstdcxx4.so.4.2.1
          echo /usr/bin/elfedit -e 'dyn:delete RUNPATH' /usr/local/lib/libstdcxx4.so.4.2.1
          chmod 0755 /usr/local/lib/libstdcxx4.so.4.2.1
      

      Attached is a stdcxx-4.2.1.solaris.studio.patches.tar.gz file which contains the Solaris specific patches and scripts to apply them, as well as to install header files critical to the compile. These were sourced from the https://java.net/projects/solaris-userland/sources/gate/show/components/stdcxx?rev=1333 cache.

      The header files could possibly be newer than their compiled files, so set their inode times to be older, assuming /usr is older. Otherwise you get weird errors when the compiler tries to recompile files /usr/local/include.

          find /usr/local/include -print | grep \\.c | xargs touch -acm -r /usr
      

        Attachments

        1. stdcxx-4.2.1.patches.tar.gz
          125 kB
          Mark Solaris

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              marksolaris Mark Solaris
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 1m
                1m
                Remaining:
                Remaining Estimate - 1m
                1m
                Logged:
                Time Spent - Not Specified
                Not Specified