diff mbox series

[oe,meta-oe,V2,2/5] leveldb: Fix build with clang

Message ID 20170907035758.41689-2-raj.khem@gmail.com
State Accepted
Commit a3e6631543caefb1ca200b6b3652924b92ba3875
Headers show
Series [oe,meta-filesystems,1/5] aufs-util: Use cross strip tool | expand

Commit Message

Khem Raj Sept. 7, 2017, 3:57 a.m. UTC
Add build parallelism, since we do not use oe_runmake

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

---
 ...uild_detect_platform-Check-for-__SSE4_2__.patch | 36 ++++++++++++++++++
 .../0002-makefile-build-SHARED_MEMENVLIB.patch     | 43 ++++++++++++++++++++++
 meta-oe/recipes-extended/leveldb/leveldb_git.bb    |  6 ++-
 3 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch
 create mode 100644 meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch

-- 
2.14.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Comments

Martin Jansa Sept. 13, 2017, 9:33 a.m. UTC | #1
I'm keeping this one in master-next for a bit longer because in some builds
I've seen some issues which might be caused by enabled parallelism.

The log doesn't show much, the only error is:

Assembler messages:
Fatal error: can't create out-shared/db/db_bench.o: No such file or
directory
mkdir out-shared/db

So I've removed the parallelism part from this change and re-running the
builds.

On Thu, Sep 7, 2017 at 5:57 AM, Khem Raj <raj.khem@gmail.com> wrote:

> Add build parallelism, since we do not use oe_runmake

>

> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

> ---

>  ...uild_detect_platform-Check-for-__SSE4_2__.patch | 36

> ++++++++++++++++++

>  .../0002-makefile-build-SHARED_MEMENVLIB.patch     | 43

> ++++++++++++++++++++++

>  meta-oe/recipes-extended/leveldb/leveldb_git.bb    |  6 ++-

>  3 files changed, 83 insertions(+), 2 deletions(-)

>  create mode 100644 meta-oe/recipes-extended/leveldb/leveldb/0001-build_

> detect_platform-Check-for-__SSE4_2__.patch

>  create mode 100644 meta-oe/recipes-extended/

> leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch

>

> 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() {

> --

> 2.14.1

>

>

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Khem Raj Sept. 22, 2017, 1:05 a.m. UTC | #2
On Wed, Sep 13, 2017 at 2:33 AM, Martin Jansa <martin.jansa@gmail.com> wrote:
> I'm keeping this one in master-next for a bit longer because in some builds

> I've seen some issues which might be caused by enabled parallelism.

>

> The log doesn't show much, the only error is:

>

> Assembler messages:

> Fatal error: can't create out-shared/db/db_bench.o: No such file or

> directory

> mkdir out-shared/db

>

> So I've removed the parallelism part from this change and re-running the

> builds.


I have reproduced this issue. I have a potential fix. I will send a v3 tonight

>

> On Thu, Sep 7, 2017 at 5:57 AM, Khem Raj <raj.khem@gmail.com> wrote:

>>

>> Add build parallelism, since we do not use oe_runmake

>>

>> Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

>> ---

>>  ...uild_detect_platform-Check-for-__SSE4_2__.patch | 36

>> ++++++++++++++++++

>>  .../0002-makefile-build-SHARED_MEMENVLIB.patch     | 43

>> ++++++++++++++++++++++

>>  meta-oe/recipes-extended/leveldb/leveldb_git.bb    |  6 ++-

>>  3 files changed, 83 insertions(+), 2 deletions(-)

>>  create mode 100644

>> meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch

>>  create mode 100644

>> meta-oe/recipes-extended/leveldb/leveldb/0002-makefile-build-SHARED_MEMENVLIB.patch

>>

>> 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() {

>> --

>> 2.14.1

>>

>

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

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() {