Alessandro Molina created ARROW-12589:
-----------------------------------------

             Summary: [C++] Compiling on windows doesn't work when 
-DARROW_WITH_BACKTRACE=OFF
                 Key: ARROW-12589
                 URL: https://issues.apache.org/jira/browse/ARROW-12589
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
            Reporter: Alessandro Molina


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
{code}
[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
{code}

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

{code}
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()
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to