diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index d13fbb14d9bccb3fefc25ffc9c47ee351098e8f6..893e485d1a06d62b004d961d6610371f9f8b4a66 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -144,6 +144,8 @@ if (LINUX)
       -fno-strict-aliasing
       -fsigned-char
       -g
+      -msse2
+      -mfpmath=sse
       -pthread
       )
 
@@ -163,10 +165,6 @@ if (LINUX)
       link_directories(/usr/lib/mysql4/mysql)
     endif (EXISTS /usr/lib/mysql4/mysql)
 
-    add_definitions(
-        -msse2
-        -mfpmath=sse
-        )
   endif (SERVER)
 
   if (VIEWER)
diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index 432e9fbcd8a02a8aaf09e0b411840312cb7f6de2..73910ef98df38bf0663f496bc171c47495ef9be3 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -206,7 +206,7 @@ class LLOctreeNode : public LLTreeNode<T>
 	{
 		const LLVector4a& pos = data->getPositionGroup();
 
-		LLVector4a gt = pos.greaterThan(center);
+		LLVector4Logical gt = pos.greaterThan(center);
 
 		LLVector4a up;
 		up = _mm_and_ps(size, gt);
diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h
index 76a3e999ce54e38f5079481a8597753355c91c48..1e0b3bc8547551aa8e2f1b333cc025c1414395f5 100644
--- a/indra/llmath/llvector4a.h
+++ b/indra/llmath/llvector4a.h
@@ -153,7 +153,6 @@ class LLVector4a
 
 	// Prefer this method for read-only access to a single element. Prefer the templated version if the elem is known at compile time.
 	template <int N> LL_FORCE_INLINE LLSimdScalar getScalarAt() const;
-	template <> LL_FORCE_INLINE LLSimdScalar getScalarAt<0>() const;
 
 	// Set to an x, y, z and optional w provided
 	inline void set(F32 x, F32 y, F32 z, F32 w = 0.f);
diff --git a/indra/llmath/tests/llquaternion_test.cpp b/indra/llmath/tests/llquaternion_test.cpp
index 2d27d1eb32d85f3b9c1f7a1fbd42df12aed92b6e..451b0ecc601423b565ed853f8a027d7213c2a7af 100644
--- a/indra/llmath/tests/llquaternion_test.cpp
+++ b/indra/llmath/tests/llquaternion_test.cpp
@@ -35,12 +35,12 @@
 #include "linden_common.h"
 #include "../test/lltut.h"
 
-#include "../llquaternion.h"
 #include "../v4math.h"
 #include "../v3math.h"
 #include "../v3dmath.h"
 #include "../m4math.h"
 #include "../m3math.h"
+#include "../llquaternion.h"
 
 namespace tut
 {
diff --git a/indra/llmath/tests/v3dmath_test.cpp b/indra/llmath/tests/v3dmath_test.cpp
index 894b6200f5dc1a2a3059ddaec4669bcdd8f3b6ac..734b8f8b8077e8fe26505b4d8b1ab0809df87868 100644
--- a/indra/llmath/tests/v3dmath_test.cpp
+++ b/indra/llmath/tests/v3dmath_test.cpp
@@ -36,11 +36,11 @@
 #include "llsd.h"
 #include "../test/lltut.h"
 
-#include "../llquaternion.h"
 #include "../m3math.h"
 #include "../v4math.h"
 #include "../v3dmath.h"
 #include "../v3dmath.h"
+#include "../llquaternion.h"
 
 namespace tut
 {
diff --git a/indra/llmath/tests/v3math_test.cpp b/indra/llmath/tests/v3math_test.cpp
index d5c8dd2f9cdc883dbc5286892b31265a40c3cdc5..e6354c2b8637467d4ff5aecdc9caa12670ea121f 100644
--- a/indra/llmath/tests/v3math_test.cpp
+++ b/indra/llmath/tests/v3math_test.cpp
@@ -36,12 +36,12 @@
 #include "../test/lltut.h"
 #include "llsd.h"
 
-#include "../llquaternion.h"
-#include "../llquantize.h"
 #include "../v3dmath.h"
 #include "../m3math.h"
 #include "../v4math.h"
 #include "../v3math.h"
+#include "../llquaternion.h"
+#include "../llquantize.h"
 
 
 namespace tut
diff --git a/indra/llmath/tests/v4math_test.cpp b/indra/llmath/tests/v4math_test.cpp
index e919c90efa72006fb38fba1a65c4727bd436a51c..61fc10848868281309960748be280e3d4e08e13e 100644
--- a/indra/llmath/tests/v4math_test.cpp
+++ b/indra/llmath/tests/v4math_test.cpp
@@ -36,9 +36,9 @@
 #include "../test/lltut.h"
 #include "llsd.h"
 
-#include "../llquaternion.h"
 #include "../m4math.h"
 #include "../v4math.h"
+#include "../llquaternion.h"
 
 namespace tut
 {
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 5dd983d818c8ed74a610a2a17b8c365c98a1de87..a283be7aa729d2503c7f7897466fbd16e2176145 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1703,7 +1703,7 @@ LLImportMaterial LLModelLoader::profileToMaterial(domProfile_COMMON* material)
 									std::string filename = cdom::uriToNativePath(init->getValue().str());
 																					
 									mat.mDiffuseMap = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + filename, TRUE, LLViewerTexture::BOOST_PREVIEW);
-									mat.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, this->mPreview, NULL, NULL);
+									mat.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, this->mPreview, NULL, FALSE);
 
 									mat.mDiffuseMap->forceToSaveRawImage();
 									mat.mDiffuseMapFilename = filename;
@@ -2656,8 +2656,8 @@ void LLModelPreview::updateStatusMessages()
 					const F32 ratio = 0.5f;
 					const S32 required_verts = 128;
 
-					F32 scaler = powf(0.5f, lod_high-lod);
-					S32 max_verts = verts[lod_high][i]*scaler;
+					F32 scaler = powf(ratio, lod_high-lod);
+					S32 max_verts = (S32)(verts[lod_high][i]*scaler);
 
 					if (max_verts > required_verts)
 					{ //some model in this slot might have more than 128 vertices
@@ -2691,8 +2691,8 @@ void LLModelPreview::updateStatusMessages()
 				{
 					const F32 ratio = 0.5f;
 					
-					F32 scaler = powf(0.5f, lod_high-lod);
-					S32 max_verts = verts[lod_high][i]*scaler;
+					F32 scaler = powf(ratio, lod_high-lod);
+					S32 max_verts = (S32)(verts[lod_high][i]*scaler);
 
 					if (verts[lod][i] > max_verts)
 					{