Hi
Below is the patch to allow Sun Studio 11 compilers to compile SimGear
on Solaris 10 for SPARC cleanly.
I shall explain what I needed to do. I made changes to 3 files:
a) props.cxx : The declaration of  template class' static data members
was not being accepted. Based on information from
http://docs.sun.com/source/819-3690/Creating_Templates.html#pgfId-342
I made some adjustments specifically for the SUN Studio 11 compilers
for it to compile.
b) compiler.h : some required constants were not defined
c) configure.ac: "-z muldefs" is required to be added to the LDFLAGS
variable to allow for multiple definitions of symbols at link time.
This error was being caused again in the simgear/props directory
because of some SGPropertyChangeListener and SGPropertyNode symbols
being defined in props.o and in props_test.o. So to allow for multiple
definitions this needs to be added.
 With these changes SimGear compiles correctly and all the test apps run fine.

Regards,
Vikas


Index: configure.ac
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/configure.ac,v
retrieving revision 1.101
diff -r1.101 configure.ac
78a79,90
> dnl Specifically for the Sun Solaris 10 Platform
> dnl and the Sun Studio 11 compilers
> case "${host}" in
> *-sun-solaris*)
>     if test "$GCC" != yes ; then
>       LDFLAGS="$LDFLAGS -z muldefs"
>     fi
>     ;;
> *)
>     ;;
> esac
>
Index: simgear/compiler.h
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/compiler.h,v
retrieving revision 1.25
diff -r1.25 compiler.h
338a339,356
> #      define SG_EXPLICIT_FUNCTION_TMPL_ARGS
> #      define SG_NEED_AUTO_PTR
> #      define SG_MEMBER_TEMPLATES
> #      define SG_NAMESPACES
> #      define SG_HAVE_STD
> #      define SG_HAVE_STREAMBUF
> #      define SG_CLASS_PARTIAL_SPECIALIZATION
> #      define SG_HAVE_STD_INCLUDES
> #      define SG_STATIC_DATA_MEMBERS_TEMPLATE
> #      define STL_ALGORITHM  <algorithm>
> #      define STL_FUNCTIONAL <functional>
> #      define STL_IOMANIP    <iomanip>
> #      define STL_IOSTREAM   <iostream>
> #      define STL_ITERATOR   <iterator>
> #      define STL_FSTREAM    <fstream>
> #      define STL_STDEXCEPT  <stdexcept>
> #      define STL_STRING     <string>
> #      define STL_STRSTREAM  <strstream>
Index: simgear/props/props.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/props/props.cxx,v
retrieving revision 1.26
diff -r1.26 props.cxx
77,79c77,94
< template<> const bool SGRawValue<bool>::DefaultValue = false;
< template<> const int SGRawValue<int>::DefaultValue = 0;
< template<> const long SGRawValue<long>::DefaultValue = 0L;
---
> #ifdef SG_STATIC_DATA_MEMBERS_TEMPLATE
> /* Specifically for the Sun Studio compilers */
> template const bool SGRawValue<bool>::DefaultValue;
> template const int  SGRawValue<int>::DefaultValue;
> template const long SGRawValue<long>::DefaultValue;
> template const float SGRawValue<float>::DefaultValue;
> template const double SGRawValue<double>::DefaultValue;
> template const char * const SGRawValue<const char *>::DefaultValue;
> const bool SGRawValue<bool>::DefaultValue = false;
> const int SGRawValue<int>::DefaultValue = 0;
> const long SGRawValue<long>::DefaultValue = 0L;
> const float SGRawValue<float>::DefaultValue = 0.0;
> const double SGRawValue<double>::DefaultValue = 0.0L;
> const char * const SGRawValue<const char *>::DefaultValue = "";
> #else
> template<bool> const bool SGRawValue<bool>::DefaultValue = false;
> template<int> const int SGRawValue<int>::DefaultValue = 0;
> template<long> const long SGRawValue<long>::DefaultValue = 0L;
83c98
<
---
> #endif //SG_STATIC_DATA_MEMBERS_TEMPLATE

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to