kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ale...@apache.org
Subject [kudu] 01/02: [master_path_handlers] fix build on macOS
Date Wed, 08 May 2019 18:22:56 GMT
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

commit 5c776b0fa74c3938849a91c0afc5c9d8a4f40087
Author: Alexey Serbin <alexey@apache.org>
AuthorDate: Wed May 8 00:30:33 2019 -0700

    [master_path_handlers] fix build on macOS
    
    A stopgap solution for EasyJson in case when 'size_t' is not the same
    type as 'uint64_t'.  As an alternative, it would be possible to handle
    that in a more generic way in easy_json.cc, but std::enable_if is not
    applicable there.  The option of putting explicit instantiation of
    template member function after its specialization and avoiding
    a warning (-Winstantiation-after-specialization) might be a way to go.
    
    This is a follow-up to fd6155fc00de48d17a65aafd79fbbad584a4f837.
    
    After the patch mentioned above, but prior to this fix, an attempt to
    build on macOS would fail with a linker error like below:
    
    Undefined symbols for architecture x86_64:
      "kudu::EasyJson& kudu::EasyJson::operator=<unsigned long>(unsigned long)",
referenced from:
          kudu::master::MasterPathHandlers::HandleTablePage(kudu::WebCallbackRegistry::WebRequest
const&, kudu::WebCallbackRegistry::WebResponse*) in master_path_handlers.cc.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    Change-Id: Ica806031be9af6cc31d9654d3eaa7ac98f616420
    Reviewed-on: http://gerrit.cloudera.org:8080/13281
    Tested-by: Kudu Jenkins
    Reviewed-by: Will Berkeley <wdberkeley@gmail.com>
---
 src/kudu/master/master_path_handlers.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/kudu/master/master_path_handlers.cc b/src/kudu/master/master_path_handlers.cc
index a8d81f7..61abf90 100644
--- a/src/kudu/master/master_path_handlers.cc
+++ b/src/kudu/master/master_path_handlers.cc
@@ -328,7 +328,12 @@ void MasterPathHandlers::HandleTablePage(const Webserver::WebRequest&
req,
       (*output)["error"] = Substitute("Unable to decode schema: $0", s.ToString());
       return;
     }
-    (*output)["column_count"] = schema.num_columns();
+    // On platforms where !std::is_same<size_t, uint64_t>::value
+    // (e.g., on macOS 'size_t' is a typedef for 'unsigned long',
+    // but 'uint64_t' is a typedef for 'unsigned long long'),
+    // EasyJson does not have appropriate assignment operator defined. Adding
+    // a static_cast<uint64_t> here is a reasonable stopgap for those cases.
+    (*output)["column_count"] = static_cast<uint64_t>(schema.num_columns());
     s = PartitionSchema::FromPB(l.data().pb.partition_schema(), schema, &partition_schema);
     if (!s.ok()) {
       (*output)["error"] =


Mime
View raw message