You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2021/11/05 21:22:02 UTC
[kudu] branch master updated: KUDU-3334 hide protobuf symbols in
libkudu_client
This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 5d39a74 KUDU-3334 hide protobuf symbols in libkudu_client
5d39a74 is described below
commit 5d39a74a19ecf03071105ac0065dc1124cfd4ea6
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Fri Nov 5 00:02:57 2021 -0700
KUDU-3334 hide protobuf symbols in libkudu_client
As it turns out, there are conflicts during static initialization of
symbols related to protobuf extensions in an application using
libkudu_client and also linking in libprotobuf on its own. That
seems to be attributed to the creation of two independent descriptor
pools in such cases [1]. At least, such issues became apparent when
both the application and libkudu_client started using libprotobuf
3.14.0.
One example of an application described above is impalad. It links in
libkudu_client and libprotobuf: the former is used to talk to Kudu
servers and the latter is necessary to communicate with other Impala's
backend components via KRPC.
This patch adds the --exclude-libs flag for the GNU linker [2] to
completely hide all the symbols inherited by libkudu_client from
libprotobuf which is statically linked into the Kudu C++ library
in case of RELEASE builds.
As for the rest of libraries statically linked into libkudu_client,
it seems no problems encountered so far if those symbols are just made
local using the version script mechanism, so no other libraries are put
under --exclude-libs linker's flag except for libprotobuf.
[1] https://stackoverflow.com/a/29975019
[2] https://www.man7.org/linux/man-pages/man1/ld.1.html
Change-Id: I584e1f726f8a4f368579c2c323a230fe98e29dee
Reviewed-on: http://gerrit.cloudera.org:8080/18000
Tested-by: Kudu Jenkins
Reviewed-by: Attila Bukor <ab...@apache.org>
---
src/kudu/client/CMakeLists.txt | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/kudu/client/CMakeLists.txt b/src/kudu/client/CMakeLists.txt
index bf23d6c..fcf5c2c 100644
--- a/src/kudu/client/CMakeLists.txt
+++ b/src/kudu/client/CMakeLists.txt
@@ -139,9 +139,11 @@ set(CLIENT_VERSION_PATCH 0)
if(NOT APPLE)
# Localize thirdparty symbols using a linker version script. This hides them
- # from the client application. The OS X linker does not support the
- # version-script option.
+ # from the client application. Also, completely remove libprotobuf symbols
+ # (see KUDU-3334 for details). The --version-script and --exclude-libs
+ # GNU ld linker's options are not supported by the OS X linker.
set(LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map")
+ set(LINK_FLAGS "${LINK_FLAGS} -Wl,--exclude-libs=libprotobuf")
endif()
set_target_properties(kudu_client_exported