Skip to contentSkip to conversation

protobuf: static link tools when generating sdk

PATCH Superseded Sinan Kaya 2 participants 7 messages Aug 17, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH v2 1/3 protobuf: static link tools when generating sdk

Dynamically linked protoc.exe is failing as follows:

[libprotobuf ERROR google/protobuf/descriptor_database.cc:641] File already exists in database: google/protobuf/descriptor.proto [libprotobuf FATAL google/protobuf/descriptor.cc:1371] CHECK failed:
GeneratedDatabase()->Add(encoded_file_descriptor, size):

Switch to static linkage per upstream recommendation.

---
 recipes-devtools/protobuf/protobuf_%.bbappend | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 recipes-devtools/protobuf/protobuf_%.bbappend
recipes-devtools/protobuf/protobuf_%.bbappend new file +1 -0
new file mode 100644
index 0000000..b53b22d
@@ -0,0 +1 @@
+EXTRA_OECONF:append:sdkmingw32 = " --disable-shared"
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 2/3 protobuf-c: static link when generating sdk

[libprotobuf ERROR google/protobuf/descriptor_database.cc:641] File already exists in database: google/protobuf/descriptor.proto [libprotobuf FATAL google/protobuf/descriptor.cc:1371] CHECK failed:
GeneratedDatabase()->Add(encoded_file_descriptor, size):

Switch to static linkage per upstream recommendation.

---
 recipes-devtools/protobuf-c/protobuf-c_%.bbappend | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 recipes-devtools/protobuf-c/protobuf-c_%.bbappend
recipes-devtools/protobuf-c/protobuf-c_%.bbappend new file +1 -0
new file mode 100644
index 0000000..b53b22d
@@ -0,0 +1 @@
+EXTRA_OECONF:append:sdkmingw32 = " --disable-shared"
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v2 3/3 grpc: static link tools when generating SDK

In reply to Sinan Kaya

[libprotobuf ERROR google/protobuf/descriptor_database.cc:641] File already exists in database: google/protobuf/descriptor.proto [libprotobuf FATAL google/protobuf/descriptor.cc:1371] CHECK failed:
GeneratedDatabase()->Add(encoded_file_descriptor, size):

Switch to static linkage per upstream recommendation.

---
 recipes-devtools/grpc/grpc_%.bbappend | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 recipes-devtools/grpc/grpc_%.bbappend
recipes-devtools/grpc/grpc_%.bbappend new file +2 -0
new file mode 100644
index 0000000..4fcd8b9
@@ -0,0 +1,2 @@
+EXTRA_OECMAKE:remove:sdkmingw32 = "-DBUILD_SHARED_LIBS=ON"
+EXTRA_OECMAKE:append:sdkmingw32 = " -DBUILD_SHARED_LIBS=OFF"
Signature · 1 line
2.17.1
#3 lore raw
In reply to Sinan Kaya
Quoted 21 lines · Sinan Kaya

Dynamically linked protoc.exe is failing as follows:

[libprotobuf ERROR google/protobuf/descriptor_database.cc:641] File already exists in database: google/protobuf/descriptor.proto [libprotobuf FATAL google/protobuf/descriptor.cc:1371] CHECK failed:
GeneratedDatabase()->Add(encoded_file_descriptor, size):

Switch to static linkage per upstream recommendation.

---
  recipes-devtools/protobuf/protobuf_%.bbappend | 1 +
  1 file changed, 1 insertion(+)

create mode 100644 recipes-devtools/protobuf/protobuf_%.bbappend

recipes-devtools/protobuf/protobuf_%.bbappend new file +0 -0
new file mode 100644
index 0000000..b53b22d

recipes-devtools/protobuf/protobuf_%.bbappend line 1

Quoted 1 line
recipes-devtools/protobuf/protobuf_%.bbappend new file +1 -0
@@ -0,0 +1 @@
+EXTRA_OECONF:append:sdkmingw32 = " --disable-shared"

Apologies, this should use the :mingw32 override, since it's not *specific* to the SDK, but MinGW in general. Anyway, I fixed this up for you since I wasn't clear; this is in master-next and I'll get it tested shortly

#4 lore raw

These 3 recipes are in meta-oe, not OE-core which means that the bbappends are going to cause a dangling appends error/warning. Please add a dynamic BBFILES pattern[1] so that these are conditionally applied only if meta-oe is present, something like:

 BBFILES_DYNAMIC += "\
openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bb \
openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend \
 "

[1]: https://docs.yoctoproject.org/ref-manual/variables.html#term-BBFILES_DYNAMIC

Quoted 28 lines · Joshua Watt
Quoted 21 lines · Sinan Kaya

Dynamically linked protoc.exe is failing as follows:

[libprotobuf ERROR google/protobuf/descriptor_database.cc:641] File already exists in database: google/protobuf/descriptor.proto [libprotobuf FATAL google/protobuf/descriptor.cc:1371] CHECK failed:
GeneratedDatabase()->Add(encoded_file_descriptor, size):

Switch to static linkage per upstream recommendation.

---
  recipes-devtools/protobuf/protobuf_%.bbappend | 1 +

  1 file changed, 1 insertion(+)

  create mode 100644 recipes-devtools/protobuf/protobuf_%.bbappend

recipes-devtools/protobuf/protobuf_%.bbappend new file +0 -0
new file mode 100644
index 0000000..b53b22d

recipes-devtools/protobuf/protobuf_%.bbappend line 1

Quoted 1 line
recipes-devtools/protobuf/protobuf_%.bbappend new file +1 -0
@@ -0,0 +1 @@
+EXTRA_OECONF:append:sdkmingw32 = " --disable-shared"

Apologies, this should use the :mingw32 override, since it's not *specific* to the SDK, but MinGW in general. Anyway, I fixed this up for you since I wasn't clear; this is in master-next and I'll get it tested shortly

author
#5 lore raw
Quoted 12 lines · Joshua Watt

These 3 recipes are in meta-oe, not OE-core which means that the bbappends are going to cause a dangling appends error/warning. Please add a dynamic BBFILES pattern[1] so that these are conditionally applied only if meta-oe is present, something like:

 BBFILES_DYNAMIC += "\
openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bb \
openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/recipes-*/*/*.bbappend \
 "

Quoted 2 lines

[1]:
https://docs.yoctoproject.org/ref-manual/variables.html#term-BBFILES_DYNAMIC

I wasn't aware of this functionality. Will post v3.

author
#6 lore raw
In reply to Joshua Watt
Quoted 6 lines · Joshua Watt
Quoted 1 line

+EXTRA_OECONF:append:sdkmingw32 = " --disable-shared"

Apologies, this should use the :mingw32 override, since it's not *specific* to the SDK, but MinGW in general. Anyway, I fixed this up for you since I wasn't clear; this is in master-next and I'll get it tested shortly

My reading of the problem says that the problem only happens on win32 platforms due to how DLLs initialize the heap.

We have use cases of both dynamic and static linkage for the target build that we have not seen any issues with.

I'd like to keep target builds same.