diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index b8df3cbfe74470e8487d86fc67911eaaa93645d8..dc84350987db1fdfaa8c6186f68e74070d7f03ba 100644
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -9,6 +9,7 @@
 #ifndef LL_INDRA_CONSTANTS_H
 #define LL_INDRA_CONSTANTS_H
 
+#include "stdtypes.h"
 #include "lluuid.h"
 
 // Viewer object cache version, change if object update
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 45d7acd417459fb31b61dd38d5c689e0d25d74eb..aa4cba99d1af1a4fec76f2570d97cb0c27b3cec7 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -8,6 +8,7 @@
 
 #include "llsd.h"
 
+#include <sstream>
 #include <math.h>
 #include "../llmath/llmath.h"
 #include "llformat.h"
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h
index 09042b6dc3dd82a4efbdd5e5cb533d5644db569e..8949ef011242a915ac8b553994da54670323614f 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -12,13 +12,17 @@
 #include "llerror.h"
 #include "llmath.h"
 
-#include "llsd.h"
+#ifndef NO_RTTI
+// LLSD includes LLString which is incompatible with some other
+// stuff (Havok) that requires -fno-rtti
+#	include "llsd.h"
+#endif
 class LLVector4;
 class LLMatrix3;
 class LLVector3d;
 class LLQuaternion;
 
-//  Llvector3 = |x y z w|
+//  LLvector3 = |x y z w|
 
 static const U32 LENGTHOFVECTOR3 = 3;
 
@@ -41,6 +45,9 @@ class LLVector3
 		inline explicit LLVector3(const F32 *vec);				// Initializes LLVector3 to (vec[0]. vec[1], vec[2])
 		explicit LLVector3(const LLVector3d &vec);				// Initializes LLVector3 to (vec[0]. vec[1], vec[2])
 		explicit LLVector3(const LLVector4 &vec);				// Initializes LLVector4 to (vec[0]. vec[1], vec[2])
+#ifndef NO_RTTI
+// LLSD includes LLString which is incompatible with some other
+// stuff (Havok) that requires -fno-rtti
 		LLVector3(const LLSD& sd)
 		{
 			setValue(sd);
@@ -67,6 +74,7 @@ class LLVector3
 			setValue(sd);
 			return *this;
 		}
+#endif
 
 		inline BOOL isFinite() const;									// checks to see if all values of LLVector3 are finite
 		BOOL		clamp(F32 min, F32 max);		// Clamps all values to (min,max), returns TRUE if data changed
diff --git a/indra/test/llpipeutil.cpp b/indra/test/llpipeutil.cpp
index 3a15bfdb7edf992c213fdc960b3913132f1e37b2..f4b1b28c1d0f9229a0040588bb1ba002563e8cd8 100644
--- a/indra/test/llpipeutil.cpp
+++ b/indra/test/llpipeutil.cpp
@@ -10,6 +10,7 @@
 #include "llpipeutil.h"
 
 #include <stdlib.h>
+#include <sstream>
 
 #include "llbufferstream.h"
 #include "lldefs.h"
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp
index e99da7195ab9fdac5d0538871e6574a6f2f04f47..6a38a1a8ea5b76795afa6f75572a09c1090936d3 100644
--- a/indra/test/llsd_new_tut.cpp
+++ b/indra/test/llsd_new_tut.cpp
@@ -12,6 +12,7 @@
 #include "lltut.h"
 
 #include "llsd.h"
+#include "llstring.h"
 
 namespace tut
 {