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

[C++][Python] Failed to compile on windows platform using arrow

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Not A Problem
    • Affects Version/s: 0.14.0
    • Fix Version/s: None
    • Component/s: C++, Python

      Description

      I am writing a python extension and trying to compile c++ code and link against arrow library on windows platform. (Using visual studio 2017) and compilation failed.

      Unable to find source-code formatter for language: text. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      building 'snowflake.connector.arrow_iterator' extension
      C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Icpp/ArrowIterator/ -Ic:\Users\Haowei\py36env\lib\site-packages\pyarrow\include -IC:\Users\Haowei\AppData\Local\Programs\Python\Python36\include -IC:\Users\Haowei\AppData\Local\Programs\Python\Python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpbuild\cython\arrow_iterator.cpp /Fobuild\temp.win-amd64-3.6\Release\build\cython\arrow_iterator.obj -std=c++11
      cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
      arrow_iterator.cpp
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(852): error C2528: '__timezone': pointer to reference is illegal
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(859): error C2269: cannot create a pointer or reference to a qualified function type (requires pointer-to-member)
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(853): error C2664: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)': cannot convert argument 1 from 'const std::string *' to 'std::initializer_list<_Elem>'
              with
              [
                  _Elem=char
              ]
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(852): note: No constructor could take the source type, or constructor overload resolution was ambiguous
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(859): error C2440: 'return': cannot convert from 'std::string' to 'const std::string *(__cdecl *)(void)'
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(859): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
      c:\Users\Haowei\py36env\lib\site-packages\pyarrow\include\arrow/type.h(1126): error C2528: '__timezone': pointer to reference is illegal
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
      

      I googled a little bit and found similar issue in feather repo. https://github.com/wesm/feather/issues/111

      So I did something similar to their fix:
      Adding following code to the type.h header file (according to https://github.com/wesm/feather/pull/146/files)

      #if _MSC_VER >= 1900
        #undef timezone
      #endif
      

      Not sure if this is the right way to fix it. If yes, I can submit a PR.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                howryu Haowei Yu
              • 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