Message ID | 20170905054618.42430-1-raj.khem@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [oe,meta-oe] leveldb: Fix build with clang | expand |
Fails to build: http://errors.yoctoproject.org/Errors/Details/155161/ On Tue, Sep 5, 2017 at 7:46 AM, Khem Raj <raj.khem@gmail.com> wrote: > Signed-off-by: Khem Raj <raj.khem@gmail.com> > --- > ...uild_detect_platform-Check-for-__SSE4_2__.patch | 40 > ++++++++++++++++++++ > .../0002-makefile-build-SHARED_MEMENVLIB.patch | 43 > ++++++++++++++++++++++ > meta-oe/recipes-extended/leveldb/leveldb_git.bb | 4 +- > 3 files changed, 86 insertions(+), 1 deletion(-) > 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..a44ff883b > --- /dev/null > +++ b/meta-oe/recipes-extended/leveldb/leveldb/0001-build_ > detect_platform-Check-for-__SSE4_2__.patch > @@ -0,0 +1,40 @@ > +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(-) > + > +diff --git a/build_detect_platform b/build_detect_platform > +index d2a20ce..a06d49e 100755 > +--- a/build_detect_platform > ++++ b/build_detect_platform > +@@ -224,13 +224,13 @@ 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 -x c++ -Werror - -o $CXXOUTPUT -msse4.2 -dD -E > 2>/dev/null <<EOF > + int main() {} > + EOF > ++ eval fgrep __SSE4_2__ $CXXOUTPUT 2>/dev/null > + if [ "$?" = 0 ]; then > + PLATFORM_SSEFLAGS="-msse4.2" > + fi > +- > + rm -f $CXXOUTPUT 2>/dev/null > + fi > + > +-- > +2.14.1 > + > 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..dfe4b459a 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" > > -- > 2.14.1 > > -- > _______________________________________________ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-devel > -- _______________________________________________ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel
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..a44ff883b --- /dev/null +++ b/meta-oe/recipes-extended/leveldb/leveldb/0001-build_detect_platform-Check-for-__SSE4_2__.patch @@ -0,0 +1,40 @@ +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(-) + +diff --git a/build_detect_platform b/build_detect_platform +index d2a20ce..a06d49e 100755 +--- a/build_detect_platform ++++ b/build_detect_platform +@@ -224,13 +224,13 @@ 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 -x c++ -Werror - -o $CXXOUTPUT -msse4.2 -dD -E 2>/dev/null <<EOF + int main() {} + EOF ++ eval fgrep __SSE4_2__ $CXXOUTPUT 2>/dev/null + if [ "$?" = 0 ]; then + PLATFORM_SSEFLAGS="-msse4.2" + fi +- + rm -f $CXXOUTPUT 2>/dev/null + fi + +-- +2.14.1 + 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..dfe4b459a 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"
Signed-off-by: Khem Raj <raj.khem@gmail.com> --- ...uild_detect_platform-Check-for-__SSE4_2__.patch | 40 ++++++++++++++++++++ .../0002-makefile-build-SHARED_MEMENVLIB.patch | 43 ++++++++++++++++++++++ meta-oe/recipes-extended/leveldb/leveldb_git.bb | 4 +- 3 files changed, 86 insertions(+), 1 deletion(-) 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