You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by yi...@apache.org on 2021/09/15 08:45:02 UTC

[arrow] branch master updated: ARROW-13976: [C++] Add path to libjvm.so in ARM CPU

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

yibocai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new a3097af  ARROW-13976: [C++] Add path to libjvm.so in ARM CPU
a3097af is described below

commit a3097af3c62bb12cb40028801760396a883e62cf
Author: wuzhuoming <31...@users.noreply.github.com>
AuthorDate: Wed Sep 15 08:42:36 2021 +0000

    ARROW-13976: [C++] Add path to libjvm.so in ARM CPU
    
    resolve issue ARROW-13976, add path in hdfs_internal.cc to find libjvm.so in ARM CPU.
    
    Closes #11135 from wuzhuoming/master
    
    Lead-authored-by: wuzhuoming <31...@users.noreply.github.com>
    Co-authored-by: Yibo Cai <yi...@arm.com>
    Signed-off-by: Yibo Cai <yi...@arm.com>
---
 cpp/src/arrow/io/hdfs_internal.cc | 61 +++++++++++++++++++++++----------------
 1 file changed, 36 insertions(+), 25 deletions(-)

diff --git a/cpp/src/arrow/io/hdfs_internal.cc b/cpp/src/arrow/io/hdfs_internal.cc
index 6d9f71c..4592392 100644
--- a/cpp/src/arrow/io/hdfs_internal.cc
+++ b/cpp/src/arrow/io/hdfs_internal.cc
@@ -187,35 +187,46 @@ Result<std::vector<PlatformFilename>> get_potential_libjvm_paths() {
 // SFrame uses /usr/libexec/java_home to find JAVA_HOME; for now we are
 // expecting users to set an environment variable
 #else
+#if defined(__aarch64__)
+  const std::string prefix_arch{"arm64"};
+  const std::string suffix_arch{"aarch64"};
+#else
+  const std::string prefix_arch{"amd64"};
+  const std::string suffix_arch{"amd64"};
+#endif
   ARROW_ASSIGN_OR_RAISE(
       search_prefixes,
       MakeFilenameVector({
-          "/usr/lib/jvm/default-java",                // ubuntu / debian distros
-          "/usr/lib/jvm/java",                        // rhel6
-          "/usr/lib/jvm",                             // centos6
-          "/usr/lib64/jvm",                           // opensuse 13
-          "/usr/local/lib/jvm/default-java",          // alt ubuntu / debian distros
-          "/usr/local/lib/jvm/java",                  // alt rhel6
-          "/usr/local/lib/jvm",                       // alt centos6
-          "/usr/local/lib64/jvm",                     // alt opensuse 13
-          "/usr/local/lib/jvm/java-8-openjdk-amd64",  // alt ubuntu / debian distros
-          "/usr/lib/jvm/java-8-openjdk-amd64",        // alt ubuntu / debian distros
-          "/usr/local/lib/jvm/java-7-openjdk-amd64",  // alt ubuntu / debian distros
-          "/usr/lib/jvm/java-7-openjdk-amd64",        // alt ubuntu / debian distros
-          "/usr/local/lib/jvm/java-6-openjdk-amd64",  // alt ubuntu / debian distros
-          "/usr/lib/jvm/java-6-openjdk-amd64",        // alt ubuntu / debian distros
-          "/usr/lib/jvm/java-7-oracle",               // alt ubuntu
-          "/usr/lib/jvm/java-8-oracle",               // alt ubuntu
-          "/usr/lib/jvm/java-6-oracle",               // alt ubuntu
-          "/usr/local/lib/jvm/java-7-oracle",         // alt ubuntu
-          "/usr/local/lib/jvm/java-8-oracle",         // alt ubuntu
-          "/usr/local/lib/jvm/java-6-oracle",         // alt ubuntu
-          "/usr/lib/jvm/default",                     // alt centos
-          "/usr/java/latest",                         // alt centos
+          "/usr/lib/jvm/default-java",        // ubuntu / debian distros
+          "/usr/lib/jvm/java",                // rhel6
+          "/usr/lib/jvm",                     // centos6
+          "/usr/lib64/jvm",                   // opensuse 13
+          "/usr/local/lib/jvm/default-java",  // alt ubuntu / debian distros
+          "/usr/local/lib/jvm/java",          // alt rhel6
+          "/usr/local/lib/jvm",               // alt centos6
+          "/usr/local/lib64/jvm",             // alt opensuse 13
+          "/usr/local/lib/jvm/java-8-openjdk-" +
+              prefix_arch,                               // alt ubuntu / debian distros
+          "/usr/lib/jvm/java-8-openjdk-" + prefix_arch,  // alt ubuntu / debian distros
+          "/usr/local/lib/jvm/java-7-openjdk-" +
+              prefix_arch,                               // alt ubuntu / debian distros
+          "/usr/lib/jvm/java-7-openjdk-" + prefix_arch,  // alt ubuntu / debian distros
+          "/usr/local/lib/jvm/java-6-openjdk-" +
+              prefix_arch,                               // alt ubuntu / debian distros
+          "/usr/lib/jvm/java-6-openjdk-" + prefix_arch,  // alt ubuntu / debian distros
+          "/usr/lib/jvm/java-7-oracle",                  // alt ubuntu
+          "/usr/lib/jvm/java-8-oracle",                  // alt ubuntu
+          "/usr/lib/jvm/java-6-oracle",                  // alt ubuntu
+          "/usr/local/lib/jvm/java-7-oracle",            // alt ubuntu
+          "/usr/local/lib/jvm/java-8-oracle",            // alt ubuntu
+          "/usr/local/lib/jvm/java-6-oracle",            // alt ubuntu
+          "/usr/lib/jvm/default",                        // alt centos
+          "/usr/java/latest"                             // alt centos
       }));
-  ARROW_ASSIGN_OR_RAISE(search_suffixes,
-                        MakeFilenameVector({"", "/jre/lib/amd64/server",
-                                            "/lib/amd64/server", "/lib/server"}));
+  ARROW_ASSIGN_OR_RAISE(
+      search_suffixes,
+      MakeFilenameVector({"", "/lib/server", "/jre/lib/" + suffix_arch + "/server",
+                          "/lib/" + suffix_arch + "/server"}));
   file_name = "libjvm.so";
 #endif