< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] resiprocate and stlport


I tried to compile reSIProcate (5678 revision - cannot get HEAD because of problems with repository) with the last release of STLport (5.0) on windows (VC7.1) and get some errors:

rutil/SysLogBuf.cxx:
"EOF undefined" (after adding line #include <cstdio> works fine)

rutil/HashMap.hxx:
problems with HASH_MAP_NAMESPACE and HASH_MAP_NAMESPACE::hash (works after some additions - look at the attached patch-file), stlport definitions is a cross between GCC and MSVC versions

resip/dum/Handled.cxx:
"ostream undefined" (works after adding line #include <iostream>)

resip/stack/stun/stun.cxx:
"sprintf and sscanf undefined" (works after adding #include <cstdio>)

And finally in debug versions of VS-projects I defined constant _STLP_DEBUG=1 (optional, but I use it in MY projects which use reSIProcate).


You can see all this modifications in attached resip.patch file which is output of "svn diff"-command in main directory.
Index: rutil/rutil_7_1.vcproj
===================================================================
--- rutil/rutil_7_1.vcproj      (revision 5678)
+++ rutil/rutil_7_1.vcproj      (working copy)
@@ -20,7 +20,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)../contrib/ares&quot;;&quot;$(ProjectDir)../&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_ARES;USE_IPV6"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_ARES;USE_IPV6;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
Index: rutil/SysLogBuf.cxx
===================================================================
--- rutil/SysLogBuf.cxx (revision 5678)
+++ rutil/SysLogBuf.cxx (working copy)
@@ -2,6 +2,7 @@
 #include <syslog.h>
 #endif
 
+#include <cstdio> // FIXME: stlport 5.0 - EOF undefined error
 #include <cassert>
 #include "rutil/SysLogBuf.hxx"
 
Index: rutil/HashMap.hxx
===================================================================
--- rutil/HashMap.hxx   (revision 5678)
+++ rutil/HashMap.hxx   (working copy)
@@ -1,6 +1,8 @@
 #if !defined(RESIP_HASHMAP_HXX)
 #define RESIP_HASHMAP_HXX 
 
+#include <cerrno> // FIXME: stlport 5.0 - you MUST include some STL header 
here for defining _STLPORT_VERSION constant
+
 // !cj! if all these machine have to use map then we can just delete them and 
use the default 
 
 #  if ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) )
@@ -36,6 +38,39 @@
 }                                   
 #define HashValueImp(type, ret) size_t 
HASH_MAP_NAMESPACE::hash<type>::operator()(const type& data) const { return 
ret; }
 
+#  elif defined( _STLPORT_VERSION )
+#    include <hash_map>
+#    include <hash_set>
+#    define HASH_MAP_NAMESPACE std
+#    define HashMap HASH_MAP_NAMESPACE::hash_map
+#    define HashSet HASH_MAP_NAMESPACE::hash_set
+
+// this allows us to hash on a pointer as the key 
+namespace HASH_MAP_NAMESPACE
+{
+
+template <class T>
+struct hash<T*>
+{
+      size_t operator()(const T* t) const
+      {
+         return size_t(t);
+      }
+};
+ 
+}
+
+#define HashValue(type)                           \
+namespace HASH_MAP_NAMESPACE                      \
+{                                                 \
+template <>                                       \
+struct hash<type>                                 \
+{                                                 \
+      size_t operator()(const type& data) const;  \
+};                                                \
+}                                   
+#define HashValueImp(type, ret) size_t 
HASH_MAP_NAMESPACE::hash<type>::operator()(const type& data) const { return 
ret; }
+
 #  elif  defined(__INTEL_COMPILER )
 #    include <hash_map>
 #    define HASH_MAP_NAMESPACE std
Index: resip/dum/dum_7_1.vcproj
===================================================================
--- resip/dum/dum_7_1.vcproj    (revision 5678)
+++ resip/dum/dum_7_1.vcproj    (working copy)
@@ -22,7 +22,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)/../../&quot;;&quot;$(ProjectDir)/../../../&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;USE_ARES;LEAK_CHECK;USE_IPV6"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;USE_ARES;LEAK_CHECK;USE_IPV6;_STLP_DEBUG=1"
                                MinimalRebuild="FALSE"
                                BasicRuntimeChecks="0"
                                RuntimeLibrary="3"
Index: resip/dum/test/basicCall_7_1.vcproj
===================================================================
--- resip/dum/test/basicCall_7_1.vcproj (revision 5678)
+++ resip/dum/test/basicCall_7_1.vcproj (working copy)
@@ -21,7 +21,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)/../../../&quot;;&quot;$(ProjectDir)/../../../../&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ARES"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ARES;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
Index: resip/dum/test/basicRegister_7_1.vcproj
===================================================================
--- resip/dum/test/basicRegister_7_1.vcproj     (revision 5678)
+++ resip/dum/test/basicRegister_7_1.vcproj     (working copy)
@@ -21,7 +21,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(SolutionDir)/contrib/ares&quot;;&quot;$(SolutionDir)&quot;"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
Index: resip/dum/test/basicMessage_7_1.vcproj
===================================================================
--- resip/dum/test/basicMessage_7_1.vcproj      (revision 5678)
+++ resip/dum/test/basicMessage_7_1.vcproj      (working copy)
@@ -21,7 +21,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)/../../../&quot;;&quot;$(ProjectDir)/../../../../&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ARES"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ARES;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
Index: resip/dum/Handled.cxx
===================================================================
--- resip/dum/Handled.cxx       (revision 5678)
+++ resip/dum/Handled.cxx       (working copy)
@@ -1,3 +1,4 @@
+#include <iostream> // FIXME: stlport 5.0 - undefined ostream
 #include "resip/dum/HandleManager.hxx"
 #include "resip/dum/Handled.hxx"
 #include "rutil/Log.hxx"
Index: resip/stack/resiprocate_7_1.vcproj
===================================================================
--- resip/stack/resiprocate_7_1.vcproj  (revision 5678)
+++ resip/stack/resiprocate_7_1.vcproj  (working copy)
@@ -22,7 +22,7 @@
                                AdditionalOptions="/Zm300"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)../../contrib/ares&quot;;&quot;$(ProjectDir)../&quot;;&quot;$(ProjectDir)../../&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_ARES;USE_IPV6"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;USE_ARES;USE_IPV6;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
Index: resip/stack/stun/stun.cxx
===================================================================
--- resip/stack/stun/stun.cxx   (revision 5678)
+++ resip/stack/stun/stun.cxx   (working copy)
@@ -1,3 +1,4 @@
+#include <cstdio> // FIXME: stlport 5.0 - sprintf and sscanf undefined
 #include <cassert>
 #include <cstring>
 #include <iostream>
Index: resip/stack/test/test_7_1.vcproj
===================================================================
--- resip/stack/test/test_7_1.vcproj    (revision 5678)
+++ resip/stack/test/test_7_1.vcproj    (working copy)
@@ -22,7 +22,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)../../&quot;;&quot;$(ProjectDir)../../../&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ARES"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_ARES;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"
Index: repro/repro_7_1.vcproj
===================================================================
--- repro/repro_7_1.vcproj      (revision 5678)
+++ repro/repro_7_1.vcproj      (working copy)
@@ -21,7 +21,7 @@
                                Name="VCCLCompilerTool"
                                Optimization="0"
                                
AdditionalIncludeDirectories="&quot;$(ProjectDir)../&quot;;&quot;$(ProjectDir)../resip/stack&quot;;&quot;$(ProjectDir)../contrib/db/build_win32&quot;;&quot;$(ProjectDir)../contrib/pcre&quot;;&quot;$(ProjectDir)../contrib/popt/win32/include&quot;"
-                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_POPT_H;USE_IPV6"
+                               
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_POPT_H;USE_IPV6;_STLP_DEBUG=1"
                                MinimalRebuild="TRUE"
                                BasicRuntimeChecks="3"
                                RuntimeLibrary="3"