This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch branch-1.15.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 316f74c4c90394df107df3d139b532a49e7dadf1
Author: Alexey Serbin <[email protected]>
AuthorDate: Thu Jul 15 22:45:24 2021 -0700

    [cmake] Boost to use /dev/[u]random for UUID generation (take 2)
    
    Since boost's UUID library is a header-only built dependency, it's not
    enough adding -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX into b2's
    cxxflags while building boost in Kudu's thirdparty.  This patch
    addresses the issue, defining the BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX
    macro for the preprocessor while building Kudu binaries themselves.
    This is similar to the treatment of a similar macro for the boost's
    date_time library (the latter is both a binary and a header dependency).
    
    Maybe, the issue might be solved by solely adding the corresponding
    flag into the b2's 'define' flag, but I decided to proceed the same
    way as it is done for another macro for the boost library.
    
    This is a follow-up to 27418145bc60ceb009c663626a88e57748a85c9f.
    
    Change-Id: I5eedb644bd9f1cd7a48254580bc8307053ce6c9f
    Reviewed-on: http://gerrit.cloudera.org:8080/17687
    Reviewed-by: Attila Bukor <[email protected]>
    Tested-by: Alexey Serbin <[email protected]>
    (cherry picked from commit 35b5664f908cd1250c9f01e5dff77b653cfd12b7)
    Reviewed-on: http://gerrit.cloudera.org:8080/17699
    Reviewed-by: Bankim Bhavsar <[email protected]>
    Tested-by: Kudu Jenkins
---
 CMakeLists.txt                  | 9 ++++++++-
 thirdparty/build-definitions.sh | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2980083..c7e8ce3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,8 +205,15 @@ set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -pthread")
 #     fundamental limitations in escape analysis, which can result in subtle 
bad code generation.
 #     This has a small perf hit but worth it to avoid hard to debug crashes.
 set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -fno-strict-aliasing")
-#  -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG: enable nanosecond precision for 
boost
+#  -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
+#     Enable nanosecond precision for boost's date_time library.
 set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} 
-DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG")
+#  -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX
+#     For higher portability of the built binaries, switch to /dev/[u]random
+#     even if getrandom(2) is available. This is to allow for running binaries
+#     built at OS where getrandom(2) is available at OSes where getrandom(2)
+#     isn't supported (e.g., that might happen in containerized deployments).
+set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} 
-DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX")
 
 # We want access to the PRI* print format macros.
 add_definitions(-D__STDC_FORMAT_MACROS)
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 1b6a1c0..a17174e 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -840,7 +840,7 @@ build_boost() {
   # binary jar, when getrandom(2) is not available.
   # 
https://www.boost.org/doc/libs/1_68_0/libs/uuid/doc/uuid.html#Random%20Generator
   BOOST_CFLAGS="$BOOST_CFLAGS -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX"
-  BOOST_CXXFLAGS="$BOOST_CFLAGS -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX"
+  BOOST_CXXFLAGS="$BOOST_CXXFLAGS -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX"
 
   BOOST_LDFLAGS="$EXTRA_LDFLAGS"
 

Reply via email to