我正在尝试编译包装.dll的Cython扩展。我已将dll(lonlat_bng.dll
)放在与源.pyx / .c相同的目录中,并且可以在Linux和OSX上正确编译扩展。但是,Windows无法编译它,并给我以下错误(完整的构建输出here):
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. -Iconvertbng -IC:\Python27.10-x64\include -IC:\Python27.10-x64\PC /Tcconvertbng/cutil.c /Fobuild\temp.win-amd64-2.7\Release\convertbng/cutil.obj
cutil.c
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:. /LIBPATH:convertbng /LIBPATH:C:\Python27.10-x64\libs /LIBPATH:C:\Python27.10-x64\PCbuild\amd64 lonlat_bng.lib /EXPORT:initcutil build\temp.win-amd64-2.7\Release\convertbng/cutil.obj /OUT:build\lib.win-amd64-2.7\convertbng\cutil.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\convertbng\cutil.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\convertbng\cutil.pyd.manifest
LINK : fatal error LNK1181: cannot open input file 'lonlat_bng.lib'
我的setup.py
Extension
定义如下:
# suffix is either .pyx or .c, depending on whether Cython is available
Extension("convertbng.cutil",
sources=["convertbng/cutil" + suffix],
libraries=["lonlat_bng"],
include_dirs=['.', 'convertbng'],
library_dirs=['.', 'convertbng']
)
我不确定我还应该在这做什么...