diff --git a/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch b/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch
new file mode 100644
index 000000000..bbabf688d
--- /dev/null
+++ b/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch
@@ -0,0 +1,36 @@
+From 5fd0918df2bb30e8f3edb2ee895d178edbf26f40 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 4 Sep 2017 22:38:03 -0700
+Subject: [PATCH 1/2] build_detect_platform: Check for __SSE4_2__
+
+just using -msse4.2 is not enough, especially with clang
+where it may accept -msse4.2 even during cross compiling
+for say arm, however the difference is that builtin defines
+wont be defined.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ build_detect_platform | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: git/build_detect_platform
+===================================================================
+--- git.orig/build_detect_platform
++++ git/build_detect_platform
+@@ -230,13 +230,12 @@ EOF
+     rm -f $CXXOUTPUT 2>/dev/null
+ 
+     # Test if gcc SSE 4.2 is supported
+-    $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -msse4.2 2>/dev/null  <<EOF
++    $CXX $CXXFLAGS -Werror -x c++ - -o $CXXOUTPUT -msse4.2 -dD -E 2>/dev/null | fgrep __SSE4_2__ $CXXOUTPUT 2>/dev/null  <<EOF
+       int main() {}
+ EOF
+     if [ "$?" = 0 ]; then
+         PLATFORM_SSEFLAGS="-msse4.2"
+     fi
+-
+     rm -f $CXXOUTPUT 2>/dev/null
+ fi
+ 
diff --git a/meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch b/meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch
new file mode 100644
index 000000000..fc708b23a
--- /dev/null
+++ b/meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch
@@ -0,0 +1,43 @@
+From 1ed8cec1fcf666904bb3ebd29fc85e235b72d122 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 4 Sep 2017 22:40:49 -0700
+Subject: [PATCH 2/2] makefile: build SHARED_MEMENVLIB
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index f7cc7d7..cb42278 100644
+--- a/Makefile
++++ b/Makefile
+@@ -126,12 +126,12 @@ SHARED_VERSION_MINOR = 20
+ SHARED_LIB1 = libleveldb.$(PLATFORM_SHARED_EXT)
+ SHARED_LIB2 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR)
+ SHARED_LIB3 = $(SHARED_LIB1).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
+-SHARED_LIBS = $(SHARED_OUTDIR)/$(SHARED_LIB1) $(SHARED_OUTDIR)/$(SHARED_LIB2) $(SHARED_OUTDIR)/$(SHARED_LIB3)
++SHARED_LIBS = $(SHARED_OUTDIR)/$(SHARED_LIB1) $(SHARED_OUTDIR)/$(SHARED_LIB2) $(SHARED_OUTDIR)/$(SHARED_LIB3) $(SHARED_MEMENVLIB)
+ $(SHARED_OUTDIR)/$(SHARED_LIB1): $(SHARED_OUTDIR)/$(SHARED_LIB3)
+ 	ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB1)
+ $(SHARED_OUTDIR)/$(SHARED_LIB2): $(SHARED_OUTDIR)/$(SHARED_LIB3)
+ 	ln -fs $(SHARED_LIB3) $(SHARED_OUTDIR)/$(SHARED_LIB2)
+-SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.a
++SHARED_MEMENVLIB = $(SHARED_OUTDIR)/libmemenv.$(PLATFORM_SHARED_EXT).$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR)
+ endif
+ 
+ $(SHARED_OUTDIR)/$(SHARED_LIB3): $(SHARED_LIBOBJECTS)
+@@ -294,7 +294,7 @@ endif
+ 
+ $(SHARED_MEMENVLIB):$(SHARED_MEMENVOBJECTS)
+ 	rm -f $@
+-	$(AR) -rs $@ $(SHARED_MEMENVOBJECTS)
++	$(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(basename $(notdir $(SHARED_MEMENVLIB))) $(SHARED_MEMENVOBJECTS) -o $(SHARED_MEMENVLIB) $(LIBS)
+ 
+ $(STATIC_OUTDIR)/db_bench:db/db_bench.cc $(STATIC_LIBOBJECTS) $(TESTUTIL)
+ 	$(CXX) $(LDFLAGS) $(CXXFLAGS) db/db_bench.cc $(STATIC_LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
+-- 
+2.14.1
+
diff --git a/meta-oe/recipes-extended/leveldb/leveldb_git.bb b/meta-oe/recipes-extended/leveldb/leveldb_git.bb
index d44aa14d2..93ae2fdea 100644
--- a/meta-oe/recipes-extended/leveldb/leveldb_git.bb
+++ b/meta-oe/recipes-extended/leveldb/leveldb_git.bb
@@ -8,7 +8,9 @@ SRCREV = "a53934a3ae1244679f812d998a4f16f2c7f309a6"
 PV = "1.20+git${SRCPV}"
 
 SRC_URI = "git://github.com/google/${BPN}.git \
-"
+           file://0001-build_detect_platform-Check-for-__SSE4_2__.patch \
+           file://0002-makefile-build-SHARED_MEMENVLIB.patch \
+           "
 
 S = "${WORKDIR}/git"
 
@@ -17,7 +19,7 @@ inherit utils
 do_compile() {
     # do not use oe_runmake. oe_runmake pass to make compilation arguments and override
     # leveldb makefile variable CFLAGS and broke leveldb build.
-    CFLAGS="${CFLAGS}" make || die
+    CFLAGS="${CFLAGS}" make ${PARALLEL_MAKE}|| die
 }
 
 do_install() {
