You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ra...@apache.org on 2019/04/08 16:41:57 UTC

[arrow] branch master updated: ARROW-5132: [Java] Errors on building gandiva_jni.dll on Windows with Visual Studio 2017

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

ravindra 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 454d598  ARROW-5132: [Java] Errors on building gandiva_jni.dll on Windows with Visual Studio 2017
454d598 is described below

commit 454d598b0db218159f09bfbb4004506ea8b95a4c
Author: Masayuki Takahashi <ma...@gmail.com>
AuthorDate: Mon Apr 8 22:11:34 2019 +0530

    ARROW-5132: [Java] Errors on building gandiva_jni.dll on Windows with Visual Studio 2017
    
    When building gandiva_jni.dll on Windows with Visual Studio 2017, some errors occur.
    
    1. `noexcept` not recognized
    ```
    D:/development/repository/git/arrow/cpp/src/gandiva/precompiled/../../arrow/vendored/datetime/date.h:229:81: error: expected function body after function declarator
    CONSTCD11 month_weekday_last operator/(const weekday_last& wdl, int          m) NOEXCEPT;
    ```
    
    2. Link error
    ```
    error LNK2001: unresolved external symbol "class google::protobuf::internal::ExplicitlyConstructed<class std::basic_string<char,struct std::char_traits,class std::allocator > > google::protobuf::internal::fixed_address_empty_string"
    ```
    
    3. gandiva_jni.dll not found
    
    ```
    gandiva_jni.dll was not found inside JAR.
    ```
    
    This PR fixes above issues.
    
    Author: Masayuki Takahashi <ma...@gmail.com>
    
    Closes #4123 from masayuki038/ARROW-5132 and squashes the following commits:
    
    83d36bfd <Masayuki Takahashi> ARROW-5132:  Errors on building gandiva_jni.dll on Windows with Visual Studio 2017
    923403cf <Masayuki Takahashi> ARROW-5132:  Errors on building gandiva_jni.dll on Windows with Visual Studio 2017
---
 cpp/src/gandiva/jni/CMakeLists.txt         |  4 ++++
 cpp/src/gandiva/precompiled/CMakeLists.txt | 14 ++++++++++----
 java/gandiva/pom.xml                       |  1 +
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/cpp/src/gandiva/jni/CMakeLists.txt b/cpp/src/gandiva/jni/CMakeLists.txt
index 680b6e5..810c82b 100644
--- a/cpp/src/gandiva/jni/CMakeLists.txt
+++ b/cpp/src/gandiva/jni/CMakeLists.txt
@@ -19,6 +19,10 @@ if(CMAKE_VERSION VERSION_LESS 3.11)
   message(FATAL_ERROR "Building the Gandiva JNI bindings requires CMake version >= 3.11")
 endif()
 
+if(MSVC)
+  add_definitions(-DPROTOBUF_USE_DLLS)
+endif()
+
 # Find JNI
 find_package(JNI REQUIRED)
 
diff --git a/cpp/src/gandiva/precompiled/CMakeLists.txt b/cpp/src/gandiva/precompiled/CMakeLists.txt
index 6d3daf2..ac39a62 100644
--- a/cpp/src/gandiva/precompiled/CMakeLists.txt
+++ b/cpp/src/gandiva/precompiled/CMakeLists.txt
@@ -32,10 +32,16 @@ set(PRECOMPILED_SRCS
 
 if(MSVC)
   # clang pretends to be a particular version of MSVC. Version 1900 is
-  # Visual Studio 2015, and the standard library uses C++14 features,
-  # so we have to use that -std version to get the IR compilation to
-  # work
-  set(PLATFORM_CLANG_OPTIONS -std=c++14 -fms-compatibility -fms-compatibility-version=19)
+  # Visual Studio 2015, 191[0-9] is Visual Studio 2017, and the standard
+  # library uses C++14 features, so we have to use that -std version to
+  # get the IR compilation to work
+  if(MSVC_VERSION MATCHES "^191[0-9]$")
+    set(FMS_COMPATIBILITY 19.10)
+  else()
+    set(FMS_COMPATIBILITY 19)
+  endif()
+  set(PLATFORM_CLANG_OPTIONS -std=c++14 -fms-compatibility
+      -fms-compatibility-version=${FMS_COMPATIBILITY})
 else()
   set(PLATFORM_CLANG_OPTIONS -std=c++11)
 endif()
diff --git a/java/gandiva/pom.xml b/java/gandiva/pom.xml
index 6519556..d59250c 100644
--- a/java/gandiva/pom.xml
+++ b/java/gandiva/pom.xml
@@ -111,6 +111,7 @@
             <resource>
                 <directory>${gandiva.cpp.build.dir}</directory>
                 <includes>
+                    <include>**/gandiva_jni.*</include>
                     <include>**/libgandiva_jni.*</include>
                 </includes>
             </resource>