summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2019-07-02 14:48:15 +0000
committerKhem Raj <raj.khem@gmail.com>2019-07-10 09:24:32 -0700
commita2fac5a0a4848c2486cb3982f930f45f04469860 (patch)
treecd24abc51f21019eca496faab7345421ce6bd1cd /meta-oe
parent2e3b38f958864c4f26d2518c6624b0817b26f0f6 (diff)
downloadmeta-openembedded-a2fac5a0a4848c2486cb3982f930f45f04469860.tar.gz
protobuf: fix build with gold
* Makefile.am: include descriptor.pb.cc when building libprotoc.so * otherwise plugin.pb.o has undefined symbol scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto and build with gold fails with: core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr/bin/i686-oe-linux/../../libexec/i686-oe-linux/gcc/i686-oe-linux/9.1.0/ld.bfd: ./.libs/libprotoc.so: undefined reference to `descriptor_table_google_2fprotobuf_2fdescriptor_2eproto' core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr/bin/i686-oe-linux/../../libexec/i686-oe-linux/gcc/i686-oe-linux/9.1.0/ld.bfd: ./.libs/libprotoc.so: undefined reference to `scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto' * examples/Makefile: respect CXX,LDFLAGS variables, fix build with gold * move pkg-config call to separate variable, so that the final version of the whole command so it's shown in log.do_compile_ptest_base * add ../src/google/protobuf/.libs/timestamp.pb.o when linking add_person_cpp otherwise it fails to link with gold: i686-oe-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf` /tmp/cccjSJQs.o:addressbook.pb.cc:scc_info_Person_addressbook_2eproto: error: undefined reference to 'scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto' /tmp/cccjSJQs.o:addressbook.pb.cc:descriptor_table_addressbook_2eproto_deps: error: undefined reference to 'descriptor_table_google_2fprotobuf_2ftimestamp_2eproto' collect2: error: ld returned 1 exit status Makefile:43: recipe for target 'add_person_cpp' failed * and the same with list_people_cpp this time with pkg-config already through the variable: i686-oe-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -pthread -Icore2-32-oe-linux/protobuf/3.8.0-r0/git/src -Lcore2-32-oe-linux/protobuf/3.8.0-r0/git/src/.libs -Lcore2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot/usr/lib -lprotobuf list_people.cc addressbook.pb.cc -o list_people_cpp /tmp/ccpaI5Su.o:addressbook.pb.cc:scc_info_Person_addressbook_2eproto: error: undefined reference to 'scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto' /tmp/ccpaI5Su.o:addressbook.pb.cc:descriptor_table_addressbook_2eproto_deps: error: undefined reference to 'descriptor_table_google_2fprotobuf_2ftimestamp_2eproto' collect2: error: ld returned 1 exit status Makefile:49: recipe for target 'list_people_cpp' failed Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch28
-rw-r--r--meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch56
-rw-r--r--meta-oe/recipes-devtools/protobuf/protobuf_3.8.0.bb5
3 files changed, 86 insertions, 3 deletions
diff --git a/meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch b/meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch
new file mode 100644
index 000000000..fc7286122
--- /dev/null
+++ b/meta-oe/recipes-devtools/protobuf/protobuf/0001-Makefile.am-include-descriptor.cc-when-building-libp.patch
@@ -0,0 +1,28 @@
1From 321709837f412e2f590e36e3fe33571bb40036a7 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Thu, 27 Jun 2019 13:27:18 +0000
4Subject: [PATCH] Makefile.am: include descriptor.pb.cc when building libprotoc.so
5
6* otherwise plugin.pb.o has undefined symbol scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto
7 and build with gold fails with:
8 core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr/bin/i686-oe-linux/../../libexec/i686-oe-linux/gcc/i686-oe-linux/9.1.0/ld.bfd: ./.libs/libprotoc.so: undefined reference to `descriptor_table_google_2fprotobuf_2fdescriptor_2eproto'
9 core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr/bin/i686-oe-linux/../../libexec/i686-oe-linux/gcc/i686-oe-linux/9.1.0/ld.bfd: ./.libs/libprotoc.so: undefined reference to `scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto'
10
11Upstream-Status: Pending
12Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
13---
14 src/Makefile.am | 1 +
15 1 file changed, 1 insertion(+)
16
17diff --git a/src/Makefile.am b/src/Makefile.am
18index be18ba761..57e3daec1 100644
19--- a/src/Makefile.am
20+++ b/src/Makefile.am
21@@ -313,6 +313,7 @@ libprotoc_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libprotoc.map
22 EXTRA_libprotoc_la_DEPENDENCIES = libprotoc.map
23 endif
24 libprotoc_la_SOURCES = \
25+ google/protobuf/descriptor.pb.cc \
26 google/protobuf/compiler/code_generator.cc \
27 google/protobuf/compiler/command_line_interface.cc \
28 google/protobuf/compiler/plugin.cc \
diff --git a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
new file mode 100644
index 000000000..029abfdae
--- /dev/null
+++ b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
@@ -0,0 +1,56 @@
1From a28e15092a298e0c73c6fc1ded0913275cf27cb0 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Fri, 28 Jun 2019 13:50:52 +0000
4Subject: [PATCH] examples/Makefile: respect CXX,LDFLAGS variables, fix build
5 with gold
6
7* move pkg-config call to separate variable, so that the final version
8 of the whole command so it's shown in log.do_compile_ptest_base
9* add ../src/google/protobuf/.libs/timestamp.pb.o when linking
10 add_person_cpp otherwise it fails to link with gold:
11 i686-oe-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
12 /tmp/cccjSJQs.o:addressbook.pb.cc:scc_info_Person_addressbook_2eproto: error: undefined reference to 'scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto'
13 /tmp/cccjSJQs.o:addressbook.pb.cc:descriptor_table_addressbook_2eproto_deps: error: undefined reference to 'descriptor_table_google_2fprotobuf_2ftimestamp_2eproto'
14 collect2: error: ld returned 1 exit status
15 Makefile:43: recipe for target 'add_person_cpp' failed
16
17* and the same with list_people_cpp this time with pkg-config already through the variable:
18 i686-oe-linux-g++ -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=core2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -pthread -Icore2-32-oe-linux/protobuf/3.8.0-r0/git/src -Lcore2-32-oe-linux/protobuf/3.8.0-r0/git/src/.libs -Lcore2-32-oe-linux/protobuf/3.8.0-r0/recipe-sysroot/usr/lib -lprotobuf list_people.cc addressbook.pb.cc -o list_people_cpp
19 /tmp/ccpaI5Su.o:addressbook.pb.cc:scc_info_Person_addressbook_2eproto: error: undefined reference to 'scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto'
20 /tmp/ccpaI5Su.o:addressbook.pb.cc:descriptor_table_addressbook_2eproto_deps: error: undefined reference to 'descriptor_table_google_2fprotobuf_2ftimestamp_2eproto'
21 collect2: error: ld returned 1 exit status
22 Makefile:49: recipe for target 'list_people_cpp' failed
23
24Upstream-Status: Pending
25Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
26---
27 examples/Makefile | 6 ++++--
28 1 file changed, 4 insertions(+), 2 deletions(-)
29
30diff --git a/examples/Makefile b/examples/Makefile
31index 4ad605641..31d887639 100644
32--- a/examples/Makefile
33+++ b/examples/Makefile
34@@ -2,6 +2,8 @@
35
36 .PHONY: all cpp java python clean
37
38+PROTOBUF := $(shell pkg-config --cflags --libs protobuf)
39+
40 all: cpp java python
41
42 cpp: add_person_cpp list_people_cpp
43@@ -41,11 +43,11 @@ protoc_middleman_dart: addressbook.proto
44
45 add_person_cpp: add_person.cc protoc_middleman
46 pkg-config --cflags protobuf # fails if protobuf is not installed
47- c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
48+ $(CXX) $(LDFLAGS) $(PROTOBUF) ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc addressbook.pb.cc -o add_person_cpp
49
50 list_people_cpp: list_people.cc protoc_middleman
51 pkg-config --cflags protobuf # fails if protobuf is not installed
52- c++ list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
53+ $(CXX) $(LDFLAGS) $(PROTOBUF) ../src/google/protobuf/.libs/timestamp.pb.o list_people.cc addressbook.pb.cc -o list_people_cpp
54
55 add_person_dart: add_person.dart protoc_middleman_dart
56
diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.8.0.bb b/meta-oe/recipes-devtools/protobuf/protobuf_3.8.0.bb
index 476d1e309..be5caa4da 100644
--- a/meta-oe/recipes-devtools/protobuf/protobuf_3.8.0.bb
+++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.8.0.bb
@@ -16,6 +16,8 @@ SRC_URI = "git://github.com/google/protobuf.git;branch=3.8.x \
16 file://run-ptest \ 16 file://run-ptest \
17 file://0001-protobuf-fix-configure-error.patch \ 17 file://0001-protobuf-fix-configure-error.patch \
18 file://0001-Added-stubs-map_util.h-to-list-of-installed-headers.patch \ 18 file://0001-Added-stubs-map_util.h-to-list-of-installed-headers.patch \
19 file://0001-Makefile.am-include-descriptor.cc-when-building-libp.patch \
20 file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
19" 21"
20S = "${WORKDIR}/git" 22S = "${WORKDIR}/git"
21 23
@@ -30,9 +32,6 @@ TEST_SRC_DIR = "examples"
30LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}" 32LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
31 33
32do_compile_ptest() { 34do_compile_ptest() {
33 # Modify makefile to use the cross-compiler
34 sed -e "s|c++|${CXX} \$(LDFLAGS)|g" -i "${S}/${TEST_SRC_DIR}/Makefile"
35
36 mkdir -p "${B}/${TEST_SRC_DIR}" 35 mkdir -p "${B}/${TEST_SRC_DIR}"
37 36
38 # Add the location of the cross-compiled header and library files 37 # Add the location of the cross-compiled header and library files