Haowei Yu created ARROW-6028:
--------------------------------

             Summary: Failed to compile on windows platform using arrow
                 Key: ARROW-6028
                 URL: https://issues.apache.org/jira/browse/ARROW-6028
             Project: Apache Arrow
          Issue Type: Improvement
          Components: C++, Python
    Affects Versions: 0.14.0
            Reporter: Haowei Yu


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. 

{code:text}
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
{code}

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)
{code:c++}
#if _MSC_VER >= 1900
  #undef timezone
#endif
{code}

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






--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to