Chromium Code Reviews| 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) { |
|
Peter Kasting
2017/03/15 21:53:52
Nit: This deserves a comment about what it's doing
Tom (Use chromium acct)
2017/03/19 07:19:11
Done.
|
| + 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 |