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

Issue 2756543002: Statically link libprotobuf_lite on Linux component builds (Closed)

Created:
3 years, 9 months ago by Tom (Use chromium acct)
Modified:
3 years, 9 months ago
Reviewers:
bengr, Peter Kasting
CC:
chromium-reviews, cbentzel+watch_chromium.org, net-reviews_chromium.org, Dirk Pranke, Raghu Simha
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Statically link libprotobuf_lite on Linux component builds Chrome has a direct dependency on a custom libprotobuf_lite in third_party, but Xenial and Yakkety add a dependency on the system libprotobuf-lite via Mir (which gets loaded from Gtk). Our third_party protobuf is not compatible with the upstream protobuf. Combine this with the fact that Xenial uses version 2 while Yakkety uses version 3, and it's basically impossible to make our third_party protobuf cooperate with the system one. The solution is to always statically link protobuf on Linux. This alone, however, is not enough to fix the issue on component builds. If components A and B both have private copies of libprotobuf_lite, they have their own sets of globals. A problematic global is "std::string* google::protobuf::internal::empty_string_". Protobuf does pointer comparison against this string to determine if strings are empty. This is problematic when data is passed from component A to B, each of which have an empty_string_ at a different address. This CL also extracts these types of globals into their own shared library so they can be shared among Chromium components. It also adds a 'cr_' prefix to them so they cannot conflict with the system protobuf. This change only affects desktop Linux component builds. Release binaries and debug binaries on other platforms should be unaffected. Finally, this CL is a hack, and it should be reverted when a longer-term solution is implemented. BUG=79722, 700120 R=pkasting@chromium.org TBR=bengr@chromium.org CC=dpranke@chromium.org,rsimha@chromium.org CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_dbg_ng;master.tryserver.chromium.mac:mac_chromium_dbg_ng;master.tryserver.chromium.win:win_chromium_dbg_ng patch from issue 2746493002 at patchset 260001 (http://crrev.com/2746493002#ps260001) Review-Url: https://codereview.chromium.org/2756543002 Cr-Commit-Position: refs/heads/master@{#458016} Committed: https://chromium.googlesource.com/chromium/src/+/77bec4dfd9e172a99543b9bfe9daf2580721bfdd

Patch Set 1 #

Total comments: 4

Patch Set 2 : Extract all global data to globals.cc #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1147 lines, -179 lines) Patch
M net/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/protobuf/BUILD.gn View 1 3 chunks +40 lines, -2 lines 0 comments Download
M third_party/protobuf/README.chromium View 1 3 chunks +22 lines, -3 lines 0 comments Download
A third_party/protobuf/patches/0012-extract-globals.patch View 1 1 chunk +844 lines, -0 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/arena.h View 1 2 chunks +3 lines, -1 line 0 comments Download
M third_party/protobuf/src/google/protobuf/arena.cc View 1 3 chunks +2 lines, -3 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/extension_set.h View 1 6 chunks +17 lines, -15 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/extension_set.cc View 1 5 chunks +32 lines, -54 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/generated_message_util.h View 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/generated_message_util.cc View 1 chunk +4 lines, -6 lines 0 comments Download
A third_party/protobuf/src/google/protobuf/globals.cc View 1 1 chunk +113 lines, -0 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/io/coded_stream.h View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/protobuf/src/google/protobuf/io/coded_stream.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h View 1 7 chunks +9 lines, -7 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc View 1 2 chunks +8 lines, -29 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/common.cc View 1 7 chunks +40 lines, -36 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/structurally_valid.cc View 1 2 chunks +3 lines, -14 lines 0 comments Download
M third_party/protobuf/src/google/protobuf/stubs/strutil.cc View 1 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 48 (41 generated)
Tom (Use chromium acct)
pkasting ptal I removed win_chromium_dbg_ng from CQ_INCLUDE_TRYBOTS because telementry_unittests is currently broken on win dbg ...
3 years, 9 months ago (2017-03-15 19:13:32 UTC) #1
Peter Kasting
I think we need to fix the other globals mentioned on the email thread too ...
3 years, 9 months ago (2017-03-15 21:53:52 UTC) #2
bengr
lgtm otherwise. https://codereview.chromium.org/2756543002/diff/1/third_party/protobuf/src/google/protobuf/globals.cc File third_party/protobuf/src/google/protobuf/globals.cc (right): https://codereview.chromium.org/2756543002/diff/1/third_party/protobuf/src/google/protobuf/globals.cc#newcode1 third_party/protobuf/src/google/protobuf/globals.cc:1: #include <google/protobuf/generated_message_util.h> You might want to add ...
3 years, 9 months ago (2017-03-16 18:38:14 UTC) #3
Tom (Use chromium acct)
There's quite a few changes since PS1 since I moved all data symbols to globals.cc. ...
3 years, 9 months ago (2017-03-19 07:19:11 UTC) #41
Peter Kasting
On 2017/03/19 07:19:11, Tom Anderson wrote: > Symbol versioning seemed the most promising, because it ...
3 years, 9 months ago (2017-03-19 22:37:59 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2756543002/160001
3 years, 9 months ago (2017-03-20 01:39:51 UTC) #45
commit-bot: I haz the power
3 years, 9 months ago (2017-03-20 07:11:20 UTC) #48
Message was sent while issue was closed.
Committed patchset #2 (id:160001) as
https://chromium.googlesource.com/chromium/src/+/77bec4dfd9e172a99543b9bfe9da...

Powered by Google App Engine
This is Rietveld 408576698