Building on Solaris with the g++ compiler

Article ID: 1122
Last updated: 31 Jan, 2008
Article ID: 1122
Last updated: 31 Jan, 2008
Revision: 1
Views: 7446
Posted: 01 Feb, 2001
by Dean J.
Updated: 31 Jan, 2008
by Dean J.
Problem


Multithreaded and shared buildtypes of Rogue Wave libraries fail to build when using the g++ compiler on the Solaris operating system.

The shared library buildtype fails to build with the following error:

ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status

The multithreaded buildtype fails to build with the following error:

cc1plus: Invalid option `t'
make: *** [bintree.o] Error 1

 

 

 

 




Cause


When trying to build the shared library, the linker fails because it tries to use the command g++ -shared.  Although this command works with the SunPro compiler (CC -shared) and on many platforms, it fails with the g++ compiler and on Solaris and SunOS.

When trying to build the multithreaded build type, the standard Solaris option for multithreaded is -mt. This flag is used with the SunPro compiler, but is not recognized by the g++ compiler.

 

 

 

 

 

 

 

 

 




Action


To fix these problems, you must modify two comptests as shown below. After you have made the changes, remove the workspaces directory and rebuild the libraries.  Be sure to use the correct platform file: solaris_gnu.in

Here is a sample command line build:
rwspm -d -t7 -f solaris_gnu.in -p/build/spm/parts/tls0711u -w /build/spm/workspaces/SOLARIS7/GNU/7d

To fix the shared library problem, you must edit the file /scripts/comptest/test015 as shown below. The new lines are in red.


128: if test '$cppname' = 'g++'; then
129:    case '$RWOS' in
130:    SOLARIS)
131:       try_rwsharedopts=
132:       try_rwshared_ldopts=-G
133:       try_rwlib_shared_ld_link=ld
134:       try_shared_lib_extension=.so
135:    ;;
136:    *)
137:       if test 'X$try_rwsharedopts' != 'X'; then
138:         try_rwsharedopts=-fPIC
139:       fi
140:       try_rwshared_ldopts='-shared $try_rwsharedopts'
141:       try_rwlib_shared_ld_link=$rwcppinvoke
142:    # use try_shared_lib_extension set on basis of RWOS
143:    ;;
144:    esac

To fix the multithread problem, you must edit the file /scripts/comptest/test018 as shown below. The new lines are in red.

449:   SOLARIS)

450:      case $THREADS_TYPE in
451:        POSIX)
452:           rwmtlibs='-lpthread'
453:          case $RWCOMPILER in
454:            SUNPRO)
455:              rwmtopts='-mt'
456:            ;;
457:            *)
458:              rwmtopts=''
459:            ;;
460:          esac

461:        ;;
462:        DCE)
463:           rwmtlibs='-ldce -lpthread'
464:        ;;
465:        Solaris | SOLARIS)
466:          case $RWCOMPILER in
467:            SUNPRO)
468:              rwmtopts='-mt'
469:            ;;
470:            *)
471:              rwmtopts=''
472:            ;;
473:          esac

474:        ;;
475:      esac
476:    ;;

 

 

 

 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 1122
Last updated: 31 Jan, 2008
Revision: 1
Views: 7446
Posted: 01 Feb, 2001 by Dean J.
Updated: 31 Jan, 2008 by Dean J.

Others in this category