enthought / pyql

Cython QuantLib wrappers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can`t generate c code files. Cython-0.21.1 Python2.6 QuantLib-1.4

Hardy5012 opened this issue · comments

D:\sourcefile\python\pyql\pyql-master>setup.py build
C:\Python26\lib\distutils\extension.py:133: UserWarning: Unknown Extension options: 'cython_directiv
es'
warnings.warn(msg)
running build
running build_py
running build_ext
building '' extension
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
creating build\temp.win32-2.6\Release\quantlib
d:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBU
G -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D
CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IE:\share\workplace\code\QuantLib-1.4 -ID:\boost
\include\boost-1_53 -I. -I./cpp_layer -IC:\Python26\lib\site-packages\numpy\core\include -IC:\Python
26\include -IC:\Python26\PC /Tcquantlib/
.c /Fobuild\temp.win32-2.6\Release\quantlib/
.obj /GR /FD /
Zm250 /EHsc /Z7
*.c
c1 : fatal error C1083: 无法打开源文件:“quantlib/_.c”: Invalid argument
error: command '"d:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit
status 2

Sounds like an issue with Cython as they are no .c files. You should only have cpp files. Are you sure Cython is installed correctly? What is the output of cython --version on the command line?

C:\Users\think>cython --version
Cython version 0.21.1

C:\Users\think>

Do you have setuptools installed?

I install it used source zip package

D:\sourcefile\python\Cython-0.21.1>setup.py install
running install
running bdist_egg
running egg_info
writing Cython.egg-info\PKG-INFO
....

Installed c:\python26\lib\site-packages\cython-0.21.1-py2.6-win32.egg
Processing dependencies for Cython==0.21.1
Finished processing dependencies for Cython==0.21.1

Can you confirm that you have either setuptools or distribute installed?

Thank you for your help, I found the cause of the problem.The install cmd must run with administrator rights in window7.

But I encountered another problem.
cashflow.obj : error LNK2019: 无法解析的外部符号 "public: thiscall QuantLib::Date::Date(void)" (??0Date@QuantLib@@QAE@XZ),
该符号在函数 "struct _object * __cdecl __pyx_pf_8quantlib_8cashflow_8CashFlow_4date___get
(struct *pyx_obj_8quantlib_8cashflow_CashFlow )"
(__pyx_pf_8quantlib_8cashflow_8CashFlow_4date___get
@@YAPAU_object@@PAU__pyx_obj_8quantlib_8cashflow_CashFlow@@@z) 中被引用

Have you generated the .def file? And build the .dll with it?

By the way, you can't build pyql for Python 2.6 using VC10, you need VC 2008!

I use VC 2008 to buid QuantLib.lib, has passed the aforementioned problems.But raising an another exception.

ql_settings.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static class Quan
tLib::Settings & __cdecl QuantLib::Singleton::instance(void)" (_imp?inst
ance@?$Singleton@VSettings@QuantLib@@@quantlib@@SAAAVSettings@2@XZ),该符号在函数 "class QuantLib::Date __cdecl QuantLib::get_evaluation_date(void)" (?get_evaluation_date@QuantLib@@ya?AVDate@1@XZ) 中
被引用

Yes ,I have patched.
I run generate_symbols.py scripts there raising an exception. python2.6 subprocess don`t have both STARTF_USESHOWWINDOW and check_output attribute.

File "D:\sourcefile\python\pyql\pyql-master\scripts\generate_symbols.py", line 12, in symbol_generator_from_obj_file
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
AttributeError: 'module' object has no attribute 'STARTF_USESHOWWINDOW'

@Hardy5012 sorry for the slow answer. I can't see any obvious reason why your build does not pass. I can provide you with my .def and .lib files if that can help.

FYI: we've dropped the support for Python 2.6 (meaning that we won't invest much time in supporting it in the future).

Closing this issue for now. 2.6 is deprecated.