Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: third_party/protobuf/BUILD.gn

Issue 2746493002: Reland of Statically link libprotobuf_lite on Linux (Closed)
Patch Set: Really fix Win dbg Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/BUILD.gn ('k') | third_party/protobuf/README.chromium » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/protobuf/BUILD.gn
diff --git a/third_party/protobuf/BUILD.gn b/third_party/protobuf/BUILD.gn
index 48a8f2395d140118f7eeac2bd33d6234a079b871..f7401c815076950559c1fe48248361ffd03fcd30 100644
--- a/third_party/protobuf/BUILD.gn
+++ b/third_party/protobuf/BUILD.gn
@@ -136,7 +136,32 @@ if (is_win) {
]
}
-component("protobuf_lite") {
+# Do not allow libprotobuf_lite to be dynamically linked on Linux. Later
+# versions of Ubuntu like Xenial and Yakkety link in the system
+# libprotobuf_lite by the following dependency chain: chrome -> gtk ->
+# libmirclient -> libmirprotobuf -> libprotobuf-lite. Trying to load
+# the system libprotobuf-lite after already having loaded the libprotobuf_lite
+# component will result in an immediate crash. (crbug.com/700120)
+if (is_linux && !is_chromeos) {
+ link_target_type = "static_library"
+} else {
+ link_target_type = "component"
+}
+
+if (is_component_build && is_linux && !is_chromeos) {
+ component("protobuf_globals") {
+ configs += [
+ ":protobuf_config",
+ ":protobuf_use_dlls",
+ ]
+ defines = [ "LIBPROTOBUF_EXPORTS" ]
+ sources = [
+ "src/google/protobuf/globals.cc",
+ ]
+ }
+}
+
+target(link_target_type, "protobuf_lite") {
sources = protobuf_lite_sources
configs -= [ "//build/config/compiler:chromium_code" ]
@@ -165,8 +190,14 @@ component("protobuf_lite") {
cflags = protobuf_lite_cflags
+ if (is_component_build && is_linux && !is_chromeos) {
+ deps += [ ":protobuf_globals" ]
+ } else {
+ sources += [ "src/google/protobuf/globals.cc" ]
+ }
+
# Required for component builds. See http://crbug.com/172800.
- if (is_component_build) {
+ if (is_component_build && (!is_linux || is_chromeos)) {
public_configs += [ ":protobuf_use_dlls" ]
defines = [ "LIBPROTOBUF_EXPORTS" ]
}
@@ -215,6 +246,7 @@ static_library("protobuf_full") {
"src/google/protobuf/generated_enum_util.h",
"src/google/protobuf/generated_message_reflection.cc",
"src/google/protobuf/generated_message_reflection.h",
+ "src/google/protobuf/globals.cc",
# gzip_stream.cc pulls in zlib, but it's not actually used by protoc, just
# by test code, so instead of compiling zlib for the host, let's just
« no previous file with comments | « net/BUILD.gn ('k') | third_party/protobuf/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698