Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-12589

[C++] Compiling on windows doesn't work when -DARROW_WITH_BACKTRACE=OFF

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 5.0.0
    • C++

    Description

      It seems that when compiling with -DARROW_WITH_BACKTRACE=OFF we don't add anymore the -DARROW_EXPORTING definition.

      That definition is what makes ARROW_EXPORT switch between dllimport and dllexport.

      The result is thus that the build fails with errors like

      [4/116] Building CXX object src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_17_cxx.cxx.obj
      FAILED: src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_17_cxx.cxx.obj
      C:/msys64/mingw64/bin/ccache.exe C:\msys64\mingw64\bin\c++.exe -DARROW_HAVE_RUNTIME_AVX2 -DARROW_HAVE_RUNTIME_BMI2 -DARROW_HAVE_RUNTIME_SSE4_2 -DARROW_HAVE_SSE4_2 -DARROW_HDFS -DARROW_WITH_RE2 -DARROW_WITH_UTF8PROC -DARROW_WITH_ZLIB -DAWS_SDK_VERSION_MAJOR=1 -DAWS_SDK_VERSION_MINOR=8 -DAWS_SDK_VERSION_PATCH=149 -DAWS_USE_IO_COMPLETION_PORTS -DURI_STATIC_BUILD -DUSE_IMPORT_EXPORT -DUSE_IMPORT_EXPORT=1 -DUSE_WINDOWS_DLL_SEMANTICS -D_CRT_SECURE_NO_WARNINGS -Darrow_shared_EXPORTS -Isrc -Isrc/generated -isystem thirdparty/flatbuffers/include -isystem /mingw64/include -isystem xsimd_ep/src/xsimd_ep-install/include -isystem thirdparty/hadoop/include -Wno-noexcept-type -Wno-subobject-linkage  -fdiagnostics-color=always -O3 -DNDEBUG  -Wa,-mbig-obj -Wall -fno-semantic-interposition -mxsave -msse4.2 -w -O3 -DNDEBUG -std=c++11 -MD -MT src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_17_cxx.cxx.obj -MF src\arrow\CMakeFiles\arrow_shared.dir\Unity\unity_17_cxx.cxx.obj.d -o src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_17_cxx.cxx.obj -c src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_17_cxx.cxx
      In file included from src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_17_cxx.cxx:3:
      C:/msys64/home/javan/arrow/arrow-master/cpp/src/arrow/filesystem/filesystem.cc:81:28: error: function 'std::ostream& arrow::fs::operator<<(std::ostream&, arrow::fs::FileType)' definition is marked dllimport
         81 | ARROW_EXPORT std::ostream& operator<<(std::ostream& os, FileType ftype) {
            |                            ^~~~~~~~
      [5/116] Building CXX object src/arrow/CMakeFiles/arrow_shared.dir/Unity/unity_2_cxx.cxx.obj
      

      The issue seems to be related to this code block in CMakeLists.txt

      if(ARROW_WITH_BACKTRACE)
        find_package(Backtrace)
      
        foreach(LIB_TARGET ${ARROW_LIBRARIES})
          target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING)
          if(Backtrace_FOUND AND ARROW_WITH_BACKTRACE)
            target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_WITH_BACKTRACE)
          endif()
        endforeach()
      endif()
      

      Attachments

        Issue Links

          Activity

            People

              amol- Alessandro Molina
              amol- Alessandro Molina
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m