Issues during install
JohnSmizz opened this issue · comments
Hi-
I am trying to install pyQL wrapper but am having trouble just BUILDING the pyQL files.
I installed QuantLib, Boost and successfully ran the QuantLib test file- I compiled using MS Visual Studio 2013 - the release 64bit.
Python is the Anaconda build, incl Cython etc, on a Win7 SP1 64-bit machine.
The setup.py has been amended as follows
elif sys.platform == 'win32':
# With MSVC2008, the library is called QuantLib.lib but with MSVC2010, the
# naming is QuantLib-vc100-mt
if sys.version_info >= (3, 0):
QL_LIBRARY = 'QuantLib-vc120-x64'
INCLUDE_DIRS = [
r'C:\QuantLib-1.5', # QuantLib headers
r'C:\local\boost_1_57_0', # Boost headers
r"C:\local\boost_1_57_0\lib64-msvc-12.0",
'.',
SUPPORT_CODE_INCLUDE
]
LIBRARY_DIRS = [
r"C:\QuantLib-1.5\build\vc120\x64\Release", # for the dll lib
r"C:\QuantLib-1.5\lib",
r"C:\local\boost_1_57_0\libs",
r"C:\local\boost_1_57_0\lib64-msvc-12.0",
'.',
r'.\dll',
]
Unfortunately, when I navigate to the folder to where pyQL-master has been extracted to and run command "python setup.py build" I get the following errors...
C:\Anaconda3\pyql-master>python setup.py build
C:\Anaconda3\lib\distutils\extension.py:132: UserWarning: Unknown Extension opti
ons: 'cython_directives'
warnings.warn(msg)
missing cimport in module 'quantlib.pricingengines': quantlib\instruments\credit
_default_swap.pyx
missing cimport in module 'quantlib.time': quantlib\instruments\credit_default_s
wap.pyx
missing cimport in module 'quantlib.pricingengines': quantlib\instruments\option
.pyx
running build
running build_py
running build_ext
building 'quantlib.cashflow' extension
C:\Anaconda3\Scripts\gcc.bat -mdll -O -Wall -D__WIN32__ -DWIN32 -DNDEBUG -D_WIND
OWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEP
RECATE -D_SCL_SECURE_NO_WARNINGS -IC:\QuantLib-1.5 -IC:\local\boost_1_57_0 -IC:\
local\boost_1_57_0\lib64-msvc-12.0 -I. -I./cpp_layer -IC:\Anaconda3\lib\site-pac
kages\numpy\core\include -IC:\Anaconda3\include -IC:\Anaconda3\include -c quantl
ib\cashflow.cpp -o build\temp.win-amd64-3.4\Release\quantlib\cashflow.o /GR /FD
/Zm250 /EHsc
gcc.exe: error: /GR: No such file or directory
gcc.exe: error: /FD: No such file or directory
gcc.exe: error: /Zm250: No such file or directory
gcc.exe: error: /EHsc: No such file or directory
error: command 'C:\\Anaconda3\\Scripts\\gcc.bat' failed with exit status 1
@JohnSmizz you will have to switch your configuration on the python side to build using MSVC and not gcc. The easiest way to do it might be to execute your python setup.py build
inside of the VisualStudio 2013 Command Line which will pre-configure things properly for MSVC to be used by disutils and not gcc.
Thanks! I ran the command
python setup.py build --compiler=msvc
out of the 2013 MS VC Express 64Bit prompt and annoyingly get the following error, suggesting that I need to recompile something, just not sure what?
C:\Anaconda3\pyql-master>python setup.py build --compiler=msvc
C:\Anaconda3\lib\distutils\extension.py:132: UserWarning: Unknown Extension opti
ons: 'cython_directives'
warnings.warn(msg)
missing cimport in module 'quantlib.pricingengines': quantlib\instruments\credit
_default_swap.pyx
missing cimport in module 'quantlib.time': quantlib\instruments\credit_default_s
wap.pyx
missing cimport in module 'quantlib.pricingengines': quantlib\instruments\option
.pyx
running build
running build_py
running build_ext
building 'quantlib.cashflow' extension
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64\cl.exe /c /
nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMIN
MAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_S
CL_SECURE_NO_WARNINGS -IC:\QuantLib-1.5 -IC:\local\boost_1_57_0 -IC:\local\boost
_1_57_0\lib64-msvc-12.0 -I. -I./cpp_layer -IC:\Anaconda3\lib\site-packages\numpy
\core\include -IC:\Anaconda3\include -IC:\Anaconda3\include /Tpquantlib\cashflow
.cpp /Fobuild\temp.win-amd64-3.4\Release\quantlib\cashflow.obj /GR /FD /Zm250 /E
Hsc
cashflow.cpp
c:\anaconda3\include\pymath.h(22) : warning C4273: 'round' : inconsistent dll li
nkage
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(51
6) : see previous definition of 'round'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xtgmath.h(206) :
warning C4273: 'round' : inconsistent dll linkage
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(51
6) : see previous definition of 'round'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64\link.exe /D
LL /nologo /INCREMENTAL:NO /LIBPATH:C:\QuantLib-1.5\build\vc120\x64\Release /LIB
PATH:C:\QuantLib-1.5\lib /LIBPATH:C:\local\boost_1_57_0\libs /LIBPATH:C:\local\b
oost_1_57_0\lib64-msvc-12.0 /LIBPATH:. /LIBPATH:.\dll /LIBPATH:C:\Anaconda3\libs
/LIBPATH:C:\Anaconda3\PCbuild\amd64 QuantLib-vc120-x64-mt.lib /EXPORT:PyInit_ca
shflow build\temp.win-amd64-3.4\Release\quantlib\cashflow.obj /OUT:build\lib.win
-amd64-3.4\quantlib\cashflow.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\quantl
ib\cashflow.lib /MANIFESTFILE:build\temp.win-amd64-3.4\Release\quantlib\cashflow
.pyd.manifest /subsystem:windows /machine:I386
build\temp.win-amd64-3.4\Release\quantlib\cashflow.obj : fatal error LNK1112: mo
dule machine type 'x64' conflicts with target machine type 'X86'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\BIN\\
x86_amd64\\link.exe' failed with exit status 1112
I have, since my last post, created numerous ENV vars all referencing MS VS 12 (SET VC90COMNTOOLS = ...), so thought I must be getting close to having all necessary applications on board by now.
Moreover, I checked how I compiled my QuantLib and its definitely compiled as 64 bit as the TestingQuantLib project runs smoothly on 64bit release.
I am a little bit stumped now.... Any idea what may be causing this?
Welcome to the fun of building extension on Windows ;-)
Looking at it, I wonder if it is not an issue with the extra_linker_args in the setup.py. I see /machine:I386
in the call to the linker which does not sound correct. Can you try removing it from https://github.com/enthought/pyql/blob/master/setup.py#L97 ?
Good spot! I removed it and the build ran for a bit longer, just ended with a new error...
Current/ New Error that kills the build process
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\x86_amd64\link.exe /D
LL /nologo /INCREMENTAL:NO /LIBPATH:C:\QuantLib-1.5\build\vc120\x64\Release /LIB
PATH:C:\QuantLib-1.5\lib /LIBPATH:C:\local\boost_1_57_0\libs /LIBPATH:C:\local\b
oost_1_57_0\lib64-msvc-12.0 /LIBPATH:. /LIBPATH:.\dll /LIBPATH:C:\Anaconda3\libs
/LIBPATH:C:\Anaconda3\PCbuild\amd64 QuantLib-vc120-x64-mt.lib /EXPORT:PyInit_se
ttings build\temp.win-amd64-3.4\Release\quantlib\settings.obj build\temp.win-amd
64-3.4\Release\cpp_layer/ql_settings.obj /OUT:build\lib.win-amd64-3.4\quantlib\s
ettings.pyd /IMPLIB:build\temp.win-amd64-3.4\Release\quantlib\settings.lib /MANI
FESTFILE:build\temp.win-amd64-3.4\Release\quantlib\settings.pyd.manifest /subsys
tem:windows
settings.obj : warning LNK4197: export 'PyInit_settings' specified multiple time
s; using first specification
Creating library build\temp.win-amd64-3.4\Release\quantlib\settings.lib and o
bject build\temp.win-amd64-3.4\Release\quantlib\settings.exp
ql_settings.obj : error LNK2019: unresolved external symbol "__declspec(dllimpor
t) public: static class QuantLib::Settings & __cdecl QuantLib::Singleton<class Q
uantLib::Settings>::instance(void)" (__imp_?instance@?$Singleton@VSettings@Quant
Lib@@@QuantLib@@SAAEAVSettings@2@XZ) referenced in function "void __cdecl QuantL
ib::set_evaluation_date(class QuantLib::Date &)" (?set_evaluation_date@QuantLib@
@YAXAEAVDate@1@@Z)
build\lib.win-amd64-3.4\quantlib\settings.pyd : fatal error LNK1120: 1 unresolve
d externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\BIN\\
x86_amd64\\link.exe' failed with exit status 1120
Other errors that print but don't seem to be too effectual:
c:\anaconda3\include\pymath.h(22) : warning C4273: 'round' : inconsistent dll linkage
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(516) : see previous definition of 'round'
@JohnSmizz I guess you haven't patched QuantLib as needed.
See for the details https://github.com/enthought/pyql/blob/master/docs/source/getting_started.rst#installation-from-source-on-windows
@JohnSmizz any update on your build? If you're stuck I might be able to share some pre-built .dll and .lib.
I'm having a similar problem when trying to follow the steps as linked.
First, I could not find a "settings.py" in /ql/, I think it should be "settings.hpp."
When I change the line in "settings.hpp" as described, I get many warnings during build similar to:
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
Not sure if it matters, since it still does create a bunch of .obj files in my path:
C:\dev\QuantLib-1.5\build\vc90\x64\Release
But when I try to run the "generate_symbols.py" script in pyql, I get the following error:
WindowsError: [Error 2] The system cannot find the file specified
If I change the subprocess call from:
nm_result = subprocess.check_output(command, startupinfo=startupinfo)
to:
nm_result = subprocess.check_output(command, startupinfo=startupinfo, shell=True)
It can find the file, but I get the error:
Traceback (most recent call last):
File "C:\dev\pyql\scripts\generate_symbols.py", line 91, in <module>
main()
File "C:\dev\pyql\scripts\generate_symbols.py", line 87, in main
generate_deffile_from_dir(input_directory, output_file)
File "C:\dev\pyql\scripts\generate_symbols.py", line 80, in generate_deffile_from_dir
for symbol in process_directory(input_directory):
File "C:\dev\pyql\scripts\generate_symbols.py", line 62, in process_directory
for symbol in symbol_generator_from_obj_file(object_file):
File "C:\dev\pyql\scripts\generate_symbols.py", line 17, in symbol_generator_from_obj_file
nm_result = subprocess.check_output(command, startupinfo=startupinfo, shell=True)
File "C:\Python27\lib\subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['nm', '--extern-only', '--defined-only', 'C:\\dev\\QuantLib-1.5\\build\\vc90\\x
64\\Release\\abcd.obj']' returned non-zero exit status 1
This seems reasonable to me because why would the 'nm' command work on the .obj file?
But then again, I am a complete newb to this whole process--I don't know what a ".def" file is or why I need it...
Also, the build doesn't complete successfully in VS2008 when I do this step:
Change "General" -> "Configuration type" to "Dynamic Library (DLL)".
If I leave it as static, it can build in VS2008 properly, but then it still fails when trying to build the pyql setup.
The last few lines of my python setup.py build call (the same both inside and outside of VS2008 command line) are below:
C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of
'boost::noncopyable_::noncopyable'
C:\dev\QuantLib-1.5\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::e
valuationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interf
ace to be used by clients of class 'QuantLib::Settings'
C:\dev\QuantLib-1.5\ql/settings.hpp(41) : see declaration of 'QuantLib::
Settings::DateProxy'
C:\dev\QuantLib-1.5\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::i
ncludeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface
to be used by clients of class 'QuantLib::Settings'
with
[
T=bool
]
C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
C:\Users\ohmeninea\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9
.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\dev\QuantLib-1
.5\build\vc90\x64\Release /LIBPATH:C:\dev\QuantLib-1.5\lib /LIBPATH:. /LIBPATH:.
\dll /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 QuantLib-vc90-
x64-mt.lib /EXPORT:initpiecewise_default_curve build\temp.win-amd64-2.7\Release\
quantlib/termstructures/credit\piecewise_default_curve.obj build\temp.win-amd64-
2.7\Release\cpp_layer/credit_piecewise_support_code.obj /OUT:build\lib.win-amd64
-2.7\quantlib\termstructures\credit\piecewise_default_curve.pyd /IMPLIB:build\te
mp.win-amd64-2.7\Release\quantlib/termstructures/credit\piecewise_default_curve.
lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\quantlib/termstructures/credi
t\piecewise_default_curve.pyd.manifest /subsystem:windows /machine:x64
piecewise_default_curve.obj : warning LNK4197: export 'initpiecewise_default_cur
ve' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.7\Release\quantlib/termstructures/cre
dit\piecewise_default_curve.lib and object build\temp.win-amd64-2.7\Release\quan
tlib/termstructures/credit\piecewise_default_curve.exp
skipping 'quantlib\settings.cpp' Cython extension (up-to-date)
building 'quantlib.settings' extension
C:\Users\ohmeninea\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9
.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32
-DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_C
RT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IC:\dev\QuantLib-1.5 -IC:\dev\
boost_1_57_0 -I. -I./cpp_layer -IC:\Python27\lib\site-packages\numpy\core\includ
e -IC:\Python27\include -IC:\Python27\PC /Tpquantlib\settings.cpp /Fobuild\temp.
win-amd64-2.7\Release\quantlib\settings.obj /GR /FD /Zm250 /EHsc
settings.cpp
C:\Users\ohmeninea\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9
.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32
-DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_C
RT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IC:\dev\QuantLib-1.5 -IC:\dev\
boost_1_57_0 -I. -I./cpp_layer -IC:\Python27\lib\site-packages\numpy\core\includ
e -IC:\Python27\include -IC:\Python27\PC /Tpcpp_layer/ql_settings.cpp /Fobuild\t
emp.win-amd64-2.7\Release\cpp_layer/ql_settings.obj /GR /FD /Zm250 /EHsc
ql_settings.cpp
C:\Users\ohmeninea\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9
.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\dev\QuantLib-1
.5\build\vc90\x64\Release /LIBPATH:C:\dev\QuantLib-1.5\lib /LIBPATH:. /LIBPATH:.
\dll /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 QuantLib-vc90-
x64-mt.lib /EXPORT:initsettings build\temp.win-amd64-2.7\Release\quantlib\settin
gs.obj build\temp.win-amd64-2.7\Release\cpp_layer/ql_settings.obj /OUT:build\lib
.win-amd64-2.7\quantlib\settings.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\qu
antlib\settings.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\quantlib\sett
ings.pyd.manifest /subsystem:windows /machine:x64
settings.obj : warning LNK4197: export 'initsettings' specified multiple times;
using first specification
Creating library build\temp.win-amd64-2.7\Release\quantlib\settings.lib and o
bject build\temp.win-amd64-2.7\Release\quantlib\settings.exp
ql_settings.obj : error LNK2019: unresolved external symbol "__declspec(dllimpor
t) public: static class QuantLib::Settings & __cdecl QuantLib::Singleton<class Q
uantLib::Settings>::instance(void)" (__imp_?instance@?$Singleton@VSettings@Quant
Lib@@@QuantLib@@SAAEAVSettings@2@XZ) referenced in function "class QuantLib::Dat
e __cdecl QuantLib::get_evaluation_date(void)" (?get_evaluation_date@QuantLib@@Y
A?AVDate@1@XZ)
build\lib.win-amd64-2.7\quantlib\settings.pyd : fatal error LNK1120: 1 unresolve
d externals
error: command 'C:\\Users\\ohmeninea\\AppData\\Local\\Programs\\Common\\Microsoft\
\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1
120
I am on windows 64-bit using python 2.7.9 64-bit, boost 1.57 64-bit, quantlib 1.5, and visual studio 2008.
Would love to be able to play with pyql. Any thoughts/help appreciated!
@JohnSmizz let's do things in order.
First, you need a quantlib dll, you have patched the source, and compiled all the obj files, you should also be able to get a dll as output. Could you give me the error you have when trying to build the dll? The first build of the dll will produce nothing because the def file has not been generated yet.
Second, generating the def file should work fine but you will need nm.exe (in the Enthought Canopy world, you just need to install the mingw package). We should be able to do the same using dumpbin to avoid the dependency on mingw but ... Do you have nm.exe on you rmachine?
Third, once you have the .def generated, you will be able to generate the proper dll with all the needed symbols (and the associated .lib which is going to be used by the python build process).
If you've on Python 2.7, I can give you direct access to a QuantLib dll, lib and def file through dropbox.
If you do have them available, yes, please provide the x64 .dll, and .lib. (Would I even need the .def if am not building in VS2008 since I would have the .dll and .lib?)
I was missing the mingw64 package. After obtaining this I restarted the process...Below are my exact steps:
_0. Install VS2008 w/ x64 compilers
_1. Install boost_1_57_0-msvc-9.0-64.exe
_2. Unzip QuantLib-1.5.zip
_3. Open QuantLib_vc9.sln in VS2008
_4. Tools -> Options -> Platform x64 -> Include Files -> Add boost 1.57 headers directory (C:\dev\boost_1_57_0)
_5. Tools -> Options -> Platform x64 -> Library Files -> Add boost 1.57 lib directory (C:\dev\boost_1_57_0\lib64-msvc-9.0)
_6. Build -> Configuration Manager -> Release & x64
_7. View -> Solution Explorer -> Solution -> QuantLib -> settings.hpp -> Change Line 37 to:
class __declspec(dllexport) Settings : public Singleton<Settings> {
_8. Right-Click QuantLib -> Properties -> Configuration Properties -> General -> Configuration Type -> Dynamic Library.dll -> Apply -> OK
_9. Right-Click QuantLib -> Build. Get many warnings, snippet below:
1>------ Build started: Project: QuantLib, Configuration: Release x64 ------
1>Compiling...
1>timegrid.cpp
1>termstructure.cpp
1>stochasticprocess.cpp
1>settings.cpp
1>prices.cpp
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>position.cpp
1>money.cpp
1>interestrate.cpp
1>index.cpp
1>exercise.cpp
1>exchangerate.cpp
1>event.cpp
1>errors.cpp
1>discretizedasset.cpp
1>currency.cpp
1>cashflow.cpp
1>zigguratrng.cpp
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>tcopulapolicy.cpp
1>multidimquadrature.cpp
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>multidimintegrator.cpp
1>gaussiancopulapolicy.cpp
1>expm.cpp
1>convolvedstudentt.cpp
1>yoyoptionlethelpers.cpp
1>yoycapfloortermpricesurface.cpp
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
1>cpicapfloortermpricesurface.cpp
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
1>cpicapfloorengines.cpp
1>discretizedconvertible.cpp
1>convertiblebond.cpp
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
1>C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
1>C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
1>C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
1>.\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'QuantLib::Singleton<T>'
1> with
1> [
1> T=QuantLib::Settings
1> ]
1> C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
1>.\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Settings::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> .\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
1>.\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
1> with
1> [
1> T=bool
1> ]
However, it reports successful with:
1>brownianbridge.cpp
1>Make build directory
1>Linking...
1> Creating library .\build\vc90\x64\Release\QuantLib.lib and object .\build\vc90\x64\Release\QuantLib.exp
1>Embedding manifest...
1>Build log was saved at "file://c:\dev\QuantLib-1.5\build\vc90\x64\Release\BuildLog.htm"
1>QuantLib - 0 error(s), 1489 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
_10. In ...\pyql\scripts\generate_symbols.py, change first lines of main() function to:
def main():
input_directory = r"C:\dev\QuantLib-1.5\build\vc90\x64\Release"
output_file = r'C:\dev\pyql\symbols_x64_vc90.def'
_11. Run ...\pyql\scripts\generate_symbols.py
_12. VS2008 -> Right-Click QuantLib -> Properties -> Configuration Properties -> Linker -> Input -> Module Definition File -> C:\dev\pyql\symbols_x64_vc90.def -> Apply -> OK. Seems to work:
1>------ Build started: Project: QuantLib, Configuration: Release x64 ------
1>Make build directory
1>Linking...
1> Creating library .\build\vc90\x64\Release\QuantLib.lib and object .\build\vc90\x64\Release\QuantLib.exp
1>Embedding manifest...
1>Build log was saved at "file://c:\dev\QuantLib-1.5\build\vc90\x64\Release\BuildLog.htm"
1>QuantLib - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
_13. Copy QuantLib.dll from C:\dev\QuantLib-1.5\build\vc90\x64\Release to C:\dev, and make sure that C:\dev is in PATH environment variable
_14. In ...\pyql\setup.py change relevant lines to:
QL_LIBRARY = 'QuantLib-vc90-x64-mt'
elif sys.platform == 'win32':
INCLUDE_DIRS = [
r'C:\dev\QuantLib-1.5', # QuantLib headers
r'C:\dev\boost_1_57_0', # Boost headers
'.',
SUPPORT_CODE_INCLUDE
]
LIBRARY_DIRS = [
r"C:\dev\QuantLib-1.5\build\vc90\x64\Release", # for the dll lib
r"C:\dev\QuantLib-1.5\lib",
'.',
r'.\dll',
]
def get_extra_link_args():
if sys.platform == 'win32':
args = ['/subsystem:windows','/machine:x64']
_15. In CMD dir ...\pyql\ run: python setup.py build. Get error:
creating build\temp.win-amd64-2.7\Release\quantlib
C:\Users\ohmeninea\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /M
D /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_C
RT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IC:\dev\QuantLib-1.5 -IC:\dev\boost_1_57_0 -I. -I./cpp_layer -IC:\Pyth
on27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tpquantlib\cashflow.cpp /Fobuild\temp.
win-amd64-2.7\Release\quantlib\cashflow.obj /GR /FD /Zm250 /EHsc
cashflow.cpp
C:\Users\ohmeninea\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /I
NCREMENTAL:NO /LIBPATH:C:\dev\QuantLib-1.5\build\vc90\x64\Release /LIBPATH:C:\dev\QuantLib-1.5\lib /LIBPATH:. /LIBPATH:.
\dll /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 QuantLib-vc90-x64-mt.lib /EXPORT:initcashflow build\te
mp.win-amd64-2.7\Release\quantlib\cashflow.obj /OUT:build\lib.win-amd64-2.7\quantlib\cashflow.pyd /IMPLIB:build\temp.win
-amd64-2.7\Release\quantlib\cashflow.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\quantlib\cashflow.pyd.manifest /
subsystem:windows /machine:x64
LINK : fatal error LNK1181: cannot open input file 'QuantLib-vc90-x64-mt.lib'
error: command 'C:\\Users\\ohmeninea\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\am
d64\\link.exe' failed with exit status 1181
_16. Thinking that we need the .lib which only seems to be generated when set to static library, back to VS2008, Right-Click QuantLib -> Properties -> Configuration Type -> Static Library.lib -> Apply -> OK
_17. Right-Click Solution 'QuantLib_vc9' -> Build Solution. Finishes with:
18>Testing caplet LMM Monte-Carlo caplet pricing...
18>
18>Tests completed in 20 m 56 s
18>Test suite "Master Test Suite" passed with:
18> 1001968 assertions out of 1001968 passed
18> 591 test cases out of 591 passed
18>Build log was saved at "file://c:\dev\QuantLib-1.5\test-suite\build\vc90\x64\Release\BuildLog.htm"
18>testsuite - 0 error(s), 520 warning(s)
========== Build: 19 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
_18. Try step (15) again. Snippet of last lines including error:
C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
quantlib/termstructures/credit\piecewise_default_curve.cpp(3314) : warning C4800: 'int' : forcing value to bool 'true' o
r 'false' (performance warning)
C:\Users\ohmenina\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /M
D /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_C
RT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IC:\dev\QuantLib-1.5 -IC:\dev\boost_1_57_0 -I. -I./cpp_layer -IC:\Pyth
on27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tpcpp_layer/credit_piecewise_support_c
ode.cpp /Fobuild\temp.win-amd64-2.7\Release\cpp_layer/credit_piecewise_support_code.obj /GR /FD /Zm250 /EHsc
credit_piecewise_support_code.cpp
C:\dev\QuantLib-1.5\ql/settings.hpp(37) : warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used
as base for dll-interface class 'QuantLib::Singleton<T>'
with
[
T=QuantLib::Settings
]
C:\dev\boost_1_57_0\boost/core/noncopyable.hpp(24) : see declaration of 'boost::noncopyable_::noncopyable'
C:\dev\QuantLib-1.5\ql/settings.hpp(122) : warning C4251: 'QuantLib::Settings::evaluationDate_' : class 'QuantLib::Setti
ngs::DateProxy' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
C:\dev\QuantLib-1.5\ql/settings.hpp(41) : see declaration of 'QuantLib::Settings::DateProxy'
C:\dev\QuantLib-1.5\ql/settings.hpp(124) : warning C4251: 'QuantLib::Settings::includeTodaysCashFlows_' : class 'boost::
optional<T>' needs to have dll-interface to be used by clients of class 'QuantLib::Settings'
with
[
T=bool
]
C:\dev\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
C:\Users\ohmenina\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /I
NCREMENTAL:NO /LIBPATH:C:\dev\QuantLib-1.5\build\vc90\x64\Release /LIBPATH:C:\dev\QuantLib-1.5\lib /LIBPATH:. /LIBPATH:.
\dll /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 QuantLib-vc90-x64-mt.lib /EXPORT:initpiecewise_default
_curve build\temp.win-amd64-2.7\Release\quantlib/termstructures/credit\piecewise_default_curve.obj build\temp.win-amd64-
2.7\Release\cpp_layer/credit_piecewise_support_code.obj /OUT:build\lib.win-amd64-2.7\quantlib\termstructures\credit\piec
ewise_default_curve.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\quantlib/termstructures/credit\piecewise_default_curve.
lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\quantlib/termstructures/credit\piecewise_default_curve.pyd.manifest /
subsystem:windows /machine:x64
piecewise_default_curve.obj : warning LNK4197: export 'initpiecewise_default_curve' specified multiple times; using firs
t specification
Creating library build\temp.win-amd64-2.7\Release\quantlib/termstructures/credit\piecewise_default_curve.lib and obje
ct build\temp.win-amd64-2.7\Release\quantlib/termstructures/credit\piecewise_default_curve.exp
skipping 'quantlib\settings.cpp' Cython extension (up-to-date)
building 'quantlib.settings' extension
C:\Users\ohmenina\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /M
D /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_C
RT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IC:\dev\QuantLib-1.5 -IC:\dev\boost_1_57_0 -I. -I./cpp_layer -IC:\Pyth
on27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tpquantlib\settings.cpp /Fobuild\temp.
win-amd64-2.7\Release\quantlib\settings.obj /GR /FD /Zm250 /EHsc
settings.cpp
C:\Users\ohmenina\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /M
D /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_C
RT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -IC:\dev\QuantLib-1.5 -IC:\dev\boost_1_57_0 -I. -I./cpp_layer -IC:\Pyth
on27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC /Tpcpp_layer/ql_settings.cpp /Fobuild\t
emp.win-amd64-2.7\Release\cpp_layer/ql_settings.obj /GR /FD /Zm250 /EHsc
ql_settings.cpp
C:\Users\ohmenina\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /I
NCREMENTAL:NO /LIBPATH:C:\dev\QuantLib-1.5\build\vc90\x64\Release /LIBPATH:C:\dev\QuantLib-1.5\lib /LIBPATH:. /LIBPATH:.
\dll /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 QuantLib-vc90-x64-mt.lib /EXPORT:initsettings build\te
mp.win-amd64-2.7\Release\quantlib\settings.obj build\temp.win-amd64-2.7\Release\cpp_layer/ql_settings.obj /OUT:build\lib
.win-amd64-2.7\quantlib\settings.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\quantlib\settings.lib /MANIFESTFILE:build\
temp.win-amd64-2.7\Release\quantlib\settings.pyd.manifest /subsystem:windows /machine:x64
settings.obj : warning LNK4197: export 'initsettings' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.7\Release\quantlib\settings.lib and object build\temp.win-amd64-2.7\Release\q
uantlib\settings.exp
ql_settings.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QuantLib::Settin
gs & __cdecl QuantLib::Singleton<class QuantLib::Settings>::instance(void)" (__imp_?instance@?$Singleton@VSettings@Quant
Lib@@@QuantLib@@SAAEAVSettings@2@XZ) referenced in function "class QuantLib::Date __cdecl QuantLib::get_evaluation_date(
void)" (?get_evaluation_date@QuantLib@@YA?AVDate@1@XZ)
build\lib.win-amd64-2.7\quantlib\settings.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\\Users\\ohmenina\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\am
d64\\link.exe' failed with exit status 1120
Where did I go wrong?
In step _15, you don't need a static .lib. When MSVC builds a dll, it also builds a .lib file which just contains the symbols exposed by the dll. That is the .lib file you must use.
Can you send me mail to dpinte at enthought.com so that I can share the needed files with you?
That was my mistake! I was able to build and install after copying "quantlib.lib" from 'C:\dev\QuantLib-1.5\build\vc90\x64\Release' to 'C:\dev\QuantLib-1.5\lib' and using that instead of the 'QuantLib-vc90-x64-mt.lib' in the setup.py.
Thank you! 😃 👍
Great! Closing the ticket.
Hey!
So I am still struggling, but have managed to build and install quantlib via VC10-- it imports successfully via
import quantlib
but none of the underlyings work, eg:
from quantlib.quotes import SimpleQuote
Traceback (most recent call last):
File "<ipython-input-5-1907abb16c3e>", line 1, in <module>
from quantlib.quotes import SimpleQuote
ImportError: DLL load failed: The specified module could not be found.
The steps I had to take in order to get here
A/ Install a functioning x64 compiler
1/ Install MS VS C++ Express 10
2/ Install SDK 7.1
3/ Install MS VC C++ SP1
4/ Install SP1 Compiler patch KB2519277
B/ ohmeninea's steps 1-14, but
- Install boost_1_57_0-msvc-10.0-64.exe
- Unzip QuantLib-1.5.zip
- Open QuantLib_vc10.sln in VS2010
- Change your project configuration + Toolset (See http://stackoverflow.com/questions/1865069/how-to-compile-a-64-bit-application-using-visual-c-2010-express)
5 Tools -> Options -> Platform x64 -> Include Files -> Add boost 1.57 headers directory (C:\dev\boost_1_57_0)- Tools -> Options -> Platform x64 -> Library Files -> Add boost 1.57 lib directory (C:\dev\boost_1_57_0\lib64-msvc-9.0)
- Build -> Configuration Manager -> Release & x64
- View -> Solution Explorer -> Solution -> QuantLib -> settings.hpp -> Change Line 37
- Right-Click QuantLib -> Properties -> Configuration Properties -> General -> Configuration Type -> Dynamic Library.dll -> Apply -> OK
- Right-Click QuantLib -> Build
- In ...\pyql\scripts\generate_symbols.py, change first lines of main() function
ADD MN.EXE directory to Window's EV PATH variable prior to executing generate_symbols.py - VS2010 -> Right-Click QuantLib -> Properties -> Configuration Properties -> Linker -> Input -> Module Definition File -> C:\QuantLib-1.5\symbols_x64_vc100.def -> Apply -> OK and Build.
- Copy QuantLib-vc100-x64-mt.dll from C:\QuantLib-1.5\build\vc100\x64\Release to C:\Anaconda3, and make sure that C:\Anaconda3 is in WINDOWS PATH environment variable (ie not pythonpath)
- In setup.py, I changed to
QL_LIBRARY = 'QuantLib-vc100-x64-mt'
INCLUDE_DIRS = [INCLUDE_DIRS = [
r'C:\QuantLib-1.5', # QuantLib headers
r'C:\local\boost_1_57_0', # Boost headers
'.',
SUPPORT_CODE_INCLUDE
]
LIBRARY_DIRS = [
r"C:\QuantLib-1.5\build\vc100\x64\Release", # for the dll lib
r"C:\QuantLib-1.5\lib",
'.',
r'.\dll',
and added under function get_extra_link_args() the args /machine:x64'
15 Started MS SDK 7.1 Command Prompt and ran
python setup.py build --compiler=msvc
python setup.py install
I can now "import quantlib" but anything beyond that command shows the error given above, where the necessary dll cannot be found. The dll in step 13 is not named like in the getting_started.py file because I am using VS2010 -- have I named it incorrectly somehow? Or am I putting it into the wrong folder?
I think I had a similar issue when I was trying to get it working--I fixed it by adding "C:\dev" to my PATH environment variable and sticking the "QuantLib.dll" file from "C:\dev\QuantLib-1.5\build\vc90\x64\Release" into it.
I suppose you could also just add "C:\QuantLib-1.5\build\vc100\x64\Release" to your PATH?
Although maybe I am remembering the error/solution incorrectly...
@JohnSmizz the dll name you should use is the dll name that VS produced. I think you have the correct one. The dll must be on the PATH so that the quantlib package can load it when needed. If it still does not work, I would suggest inspecting the generated pyd
files with DependencyWalker to see what it depends on.
Out of desperation I have added about 20 different locations to my path variable and also copied the DLL into lots of different places it shouldnt be. That didn't work.
But Dependency Walker indicates that modules like QUOTES.PYD look for a module called QUANTLIB.DLL. However, as this thing was compiled with VS2010 I think there was never a DLL created that was called QUANTLIB.DLL. , instead only QUANTLIB-VC100-X64-MT.DLL.
To experiment, I renamed the file that VS produced, QUANTLIB-VC100-X64-MT.DLL to simply "QUANTLIB.DLL" in one of the twenty locations I've copy-pasted it into.
After renaming the DLL to just Quantlib.dll the module runs finein Python (i tested just SimpleQuote).
I really hope the time I save using pyQL pythonic wrappers rather than SWIG is more than offset by the time I took to install the module... :)
So to conclude, the pyd file looks for quantlib.dll instead of the longer-named dll. This may be a bug when the installation code was written?
Thanks,
@JohnSmizz First, it's great to see you got it working now. Second, the dependency from quotes.pyd to QuantLib.dll was more than likely there because of a previous build. Is that possible? Or did you do a git clean -xfd
or anything else before doing the last build. You had renamed the QL_LIBRARY variable in setup.py
and thus could not have a QuantLib.dll referenced from the pyd's.
Last, if you want a cleaner way to do the installer, I would suggest you use python setup.py bdist_egg
in place of python setup.py install
(which does not uninstall previous code. etc..). The you can easily install and unistall the egg.
@JohnSmizz last comment: it would be great to have your feedback on PyQL vs the SWIG wrappers. Depending on what you plan to do, I guess PyQL will either be great or will require some work to expose things that are not there yet.
Hello.. I followed the instructions here and helped me get the pyql package install. I realized the following and I am not sure if this is normal:
1- The package is included in the *egg file and not standalone
2- When "import quantlib as ql" is initiated I don't see the class item after ".", yet when I call a class from within quantlib, like "import quantlib.cashflow as qlcf", then qlcf will expose the class items after ".".
3- all init files are empty
Is this is the way it should behave, or did I install it wrongly.
Thank you in advance for taking the time answering my question.
Thanks to @dpinte, @JohnSmizz and especially @ohmeninea seems I have managed to compile and install PyQL on winpython 3.5 using QuantLib 1.7.1 x64 win7 with Visual Studio Community 2015.
Hi @dpinte,
I have been struggling with similar issues to JohnSmizz when building. I removed machine:I386 as suggested above and am running from the Visual C++ 32-bit Command Prompt, but I receive a new error. (I patched the settings.hpp file, at the start.)
Thanks in advance for any help that you can provide.
C:\Program Files\pyql>python setup.py build --compiler=msvc
C:\Anaconda\lib\distutils\extension.py:133: UserWarning: Unknown Extension options: 'cython_directives'
warnings.warn(msg)
missing cimport in module '.utility': C:\Anaconda\lib\site-packages\Cython\Includes\libcpp\pair.pxd
missing cimport in module 'quantlib.time': quantlib\instruments\credit_default_swap.pyx
missing cimport in module 'quantlib.pricingengines': quantlib\instruments\credit_default_swap.pyx
missing cimport in module 'quantlib.instruments': quantlib\instruments\implied_volatility.pyx
missing cimport in module 'quantlib.pricingengines': quantlib\instruments\option.pyx
missing cimport in module 'quantlib.methods.finitedifferences.solvers': quantlib\methods\finitedifferences\solvers\fdmba
ckwardsolver.pyx
missing cimport in module 'quantlib.methods.finitedifferences.solvers': quantlib\methods\finitedifferences\solvers\fdmba
ckwardsolver.pxd
missing cimport in module 'quantlib.methods.finitedifferences.solvers': .\quantlib\pricingengines\vanilla\_vanilla.pxd
missing cimport in module 'quantlib.methods.finitedifferences.solvers': .\quantlib\methods\finitedifferences\solvers\fdm
backwardsolver.pxd
running build
running build_py
running egg_info
writing requirements to quantlib.egg-info\requires.txt
writing quantlib.egg-info\PKG-INFO
writing top-level names to quantlib.egg-info\top_level.txt
writing dependency_links to quantlib.egg-info\dependency_links.txt
reading manifest file 'quantlib.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.dll' anywhere in distribution
warning: no files found matching 'quantlib\preload_dlls.txt'
writing manifest file 'quantlib.egg-info\SOURCES.txt'
running build_ext
building 'quantlib.cashflow' extension
C:\Users\Scott\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD
/W3 /GS- /DNDEBUG -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 "-IC:\Program Files\QuantLib-1.7.1" "-IC:\Program Files\boost\boost_1_60_
0" -I. -I./cpp_layer -IC:\Anaconda\lib\site-packages\numpy\core\include -IC:\Anaconda\include -IC:\Anaconda\PC /Tpquantl
ib\cashflow.cpp /Fobuild\temp.win-amd64-2.7\Release\quantlib\cashflow.obj /GR /FD /Zm250 /EHsc
cashflow.cpp
C:\Users\Scott\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INC
REMENTAL:NO "/LIBPATH:C:\Program Files\QuantLib-1.7.1\build\vc90\Win32\Release" "/LIBPATH:C:\Program Files\QuantLib-1.7.
1\lib" /LIBPATH:. /LIBPATH:.\dll /LIBPATH:C:\Anaconda\libs /LIBPATH:C:\Anaconda\PCbuild\amd64 /LIBPATH:C:\Anaconda\PC\VS
9.0\amd64 QuantLib.lib /EXPORT:initcashflow build\temp.win-amd64-2.7\Release\quantlib\cashflow.obj /OUT:build\lib.win-am
d64-2.7\quantlib\cashflow.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\quantlib\cashflow.lib /MANIFESTFILE:build\temp.wi
n-amd64-2.7\Release\quantlib\cashflow.pyd.manifest /subsystem:windows
cashflow.obj : warning LNK4197: export 'initcashflow' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.7\Release\quantlib\cashflow.lib and object build\temp.win-amd64-2.7\Release\q
uantlib\cashflow.exp
cashflow.obj : error LNK2019: unresolved external symbol "public: __cdecl QuantLib::Date::Date(void)" (??0Date@QuantLib@
@QEAA@XZ) referenced in function "struct _object * __cdecl __pyx_pf_8quantlib_8cashflow_8CashFlow_4date___get__(struct _
_pyx_obj_8quantlib_8cashflow_CashFlow *)" (?__pyx_pf_8quantlib_8cashflow_8CashFlow_4date___get__@@YAPEAU_object@@PEAU__p
yx_obj_8quantlib_8cashflow_CashFlow@@@Z)
cashflow.obj : error LNK2019: unresolved external symbol "public: __cdecl QuantLib::SimpleCashFlow::SimpleCashFlow(doubl
e,class QuantLib::Date const &)" (??0SimpleCashFlow@QuantLib@@QEAA@NAEBVDate@1@@Z) referenced in function "int __cdecl _
_pyx_pf_8quantlib_8cashflow_14SimpleCashFlow___init__(struct __pyx_obj_8quantlib_8cashflow_SimpleCashFlow *,double,struc
t __pyx_obj_8quantlib_4time_4date_Date *)" (?__pyx_pf_8quantlib_8cashflow_14SimpleCashFlow___init__@@YAHPEAU__pyx_obj_8q
uantlib_8cashflow_SimpleCashFlow@@NPEAU__pyx_obj_8quantlib_4time_4date_Date@@@Z)
build\lib.win-amd64-2.7\quantlib\cashflow.pyd : fatal error LNK1120: 2 unresolved externals
error: command 'C:\\Users\\Scott\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd6
4\\link.exe' failed with exit status 1120
When I try to compile with winpython 2.7.10.3 I get the following error on x64 visual studio 2015:
build\lib.win-amd64-2.7\quantlib\test\test_cython_bug.pyd : fatal error LNK1169: one or more multiply defined symbols found amd64\\link.exe' failed with exit status 1169