mikemccand / chromium-compact-language-detector

Automatically exported from code.google.com/p/chromium-compact-language-detector
160 stars 31 forks source link

Extension does not build on a Windows host #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download and build the cld2 sources (using internal/compile_libs.sh)
2. Build the python extension (python setup.py build)
3. Observe errors

What is the expected output? What do you see instead?
Expected: Success
Actual results:

running build
running build_ext
building 'cld2' extension
creating build
creating build\temp.win32-3.3
creating build\temp.win32-3.3\Release
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tppycldmodule.cc 
/Fobuild\temp.win32-3.3\Release\pycldmodule.obj
pycldmodule.cc
pycldmodule.cc(16) : fatal error C1083: Cannot open include file: 'strings.h': 
No such file or directory
error: command 'cl.exe' failed with exit status 2

---------------------------------------------------------------------

running build
running build_ext
building 'cld2' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tppycldmodule.cc 
/Fobuild\temp.win32-3.3\Release\pycldmodule.obj
pycldmodule.cc
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2092) : 
warning C4530: C++ exception handler used, but unwind semantics are not 
enabled. S
pecify /EHsc
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2083) : while compiling class template member function 'void std::basic_string<_El
em,_Traits,_Ax>::_Copy(unsigned int,unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2221) : see reference to class template instantiation 'std::basic_string<_Elem,_Tr
aits,_Ax>' being compiled
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tpencodings.cc 
/Fobuild\temp.win32-3.3\Release\encodings.obj
encodings.cc
encodings.cc(16) : fatal error C1083: Cannot open include file: 'strings.h': No 
such file or directory
error: command 'cl.exe' failed with exit status 2

--------------------------------------------------------------------

running build
running build_ext
building 'cld2' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tppycldmodule.cc 
/Fobuild\temp.win32-3.3\Release\pycldmodule.obj
pycldmodule.cc
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2092) : 
warning C4530: C++ exception handler used, but unwind semantics are not 
enabled. S
pecify /EHsc
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2083) : while compiling class template member function 'void std::basic_string<_El
em,_Traits,_Ax>::_Copy(unsigned int,unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2221) : see reference to class template instantiation 'std::basic_string<_Elem,_Tr
aits,_Ax>' being compiled
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tpencodings.cc 
/Fobuild\temp.win32-3.3\Release\encodings.obj
encodings.cc
encodings.cc(43) : error C2039: 'UNICODE' : is not a member of 'CLD2'
encodings.cc(43) : error C2065: 'UNICODE' : undeclared identifier
encodings.cc(105) : error C3861: 'strcasecmp': identifier not found
error: command 'cl.exe' failed with exit status 2

---------------------------------------------------------------------

running build
running build_ext
building 'cld2' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tppycldmodule.cc 
/Fobuild\temp.win32-3.3\Release\pycldmodule.obj
pycldmodule.cc
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2092) : 
warning C4530: C++ exception handler used, but unwind semantics are not 
enabled. S
pecify /EHsc
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2083) : while compiling class template member function 'void std::basic_string<_El
em,_Traits,_Ax>::_Copy(unsigned int,unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2221) : see reference to class template instantiation 'std::basic_string<_Elem,_Tr
aits,_Ax>' being compiled
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox 
/MD /W3 /GS- /DNDEBUG -I../cld2/public -I../cld2/internal -IC:\Python33\include
-IC:\Python33\include /Tpencodings.cc 
/Fobuild\temp.win32-3.3\Release\encodings.obj
encodings.cc
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2092) : 
warning C4530: C++ exception handler used, but unwind semantics are not 
enabled. S
pecify /EHsc
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2083) : while compiling class template member function 'void std::basic_string<_El
em,_Traits,_Ax>::_Copy(unsigned int,unsigned int)'
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xstring(2221) : see reference to class template instantiation 'std::basic_string<_Elem,_Tr
aits,_Ax>' being compiled
        with
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
creating build\lib.win32-3.3
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo 
/INCREMENTAL:NO /LIBPATH:C:\Python33\libs /LIBPATH:C:\Python33\PCbuild cld2.lib
/EXPORT:PyInit_cld2 build\temp.win32-3.3\Release\pycldmodule.obj 
build\temp.win32-3.3\Release\encodings.obj /OUT:build\lib.win32-3.3\cld2.pyd 
/IMPLIB:build\temp
.win32-3.3\Release\cld2.lib 
/MANIFESTFILE:build\temp.win32-3.3\Release\cld2.pyd.manifest
LINK : fatal error LNK1181: cannot open input file 'cld2.lib'
error: command 'link.exe' failed with exit status 1181

What version of the product are you using? On what operating system?
Windows 7 SP1 x64
Microsoft Visual C++ 2008 Express with SP1
Python 3.3.1

Please provide any additional information below.
- strings.h is not known to the compiler. however there is string.h with 
_stricmp() instead of strcasecmp()
- UNICODE was removed in r77 from the library source 
(https://code.google.com/p/cld2/source/detail?r=77)
- proposed fix as a patch is in the attachment
- the build still does not work but I will place it in another issue

Original issue reported on code.google.com by radek....@gmail.com on 9 Sep 2013 at 3:08

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, those patches look great; I'll apply them.  I don't have a Windows 
build env setup, so I'll just confirm this doesn't affect Linux and trust you 
that this enables compilation on Windows.

But, from your separate email ... it sounds like setup.py is looking for static 
libs (*.lib) instead of dynamic libs (*.dll); maybe open a separate issue for 
that and put details there?  Thanks.

Original comment by mikemcc...@gmail.com on 9 Sep 2013 at 3:46