tre icon indicating copy to clipboard operation
tre copied to clipboard

Fail to build python extension in Windows with MSVC2012

Open superfan89 opened this issue 10 years ago • 1 comments

First thanks very much for making such great software available for free!

I've checked the latest codes and built successfully using the solution files in win32 directory with MSVC2012. Then I tried to compile the python extensions, but the compiler couldn't locate tre.h:

tre-python.c(16) : fatal error C1083: Cannot open include file: 'tre/tre.h': No such file or directory

I added "../include" to include_dirs in python.py, and the compiler located the header this time, but came up with the following errors:

running install
running build
running build_ext
building 'tre' extension
D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DHAVE_CONFIG_H -I../lib -I../win32 -I../include -IC:\Anaconda\include -IC:\Anaconda\PC /Tctre-python.c /Fobuild\temp.win-amd64-2.7\Release\tre-python.obj
tre-python.c
tre-python.c(270) : warning C4028: formal parameter 2 different from declaration
tre-python.c(377) : warning C4133: 'function' : incompatible types - from 'PyObject *' to 'PyUnicodeObject *'
tre-python.c(508) : warning C4133: 'function' : incompatible types - from 'PyUnicodeObject *' to 'PyObject *'
D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Anaconda\libs /LIBPATH:C:\Anaconda\PCbuild\amd64 ../win32/Release\tre.lib /EXPORT:inittre build\temp.win-amd64-2.7\Release\tre-python.obj /OUT:build\lib.win-amd64-2.7\tre.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\tre.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\tre.pyd.manifest
tre-python.obj : warning LNK4197: export 'inittre' specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\tre.lib and object build\temp.win-amd64-2.7\Release\tre.exp
tre-python.obj : error LNK2019: unresolved external symbol tre_regerror referenced in function _set_tre_err
tre-python.obj : error LNK2019: unresolved external symbol tre_regfree referenced in function newTreMatchObject
tre-python.obj : error LNK2019: unresolved external symbol tre_regncomp referenced in function newTrePatternObject
tre-python.obj : error LNK2019: unresolved external symbol tre_regwncomp referenced in function newTrePatternObject
tre-python.obj : error LNK2019: unresolved external symbol tre_reganexec referenced in function newTreMatchObject
tre-python.obj : error LNK2019: unresolved external symbol tre_regawnexec referenced in function newTreMatchObject
tre-python.obj : error LNK2019: unresolved external symbol tre_regaparams_default referenced in function _set_tre_err
build\lib.win-amd64-2.7\tre.pyd : fatal error LNK1120: 7 unresolved externals
error: command '"D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

I've built TRE both statically and dynamically. I'm using Python 2.7 and the OS is Windows 7 64bit.

Thanks again!

superfan89 avatar Mar 28 '14 08:03 superfan89

I have a fix in my branch that makes this work (tested us VS 2008, which is required for Python 2.7).

bjones1 avatar Dec 16 '14 20:12 bjones1