Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on x64 #253

Open
willferreira opened this issue Nov 13, 2019 · 0 comments
Open

Building on x64 #253

willferreira opened this issue Nov 13, 2019 · 0 comments

Comments

@willferreira
Copy link

willferreira commented Nov 13, 2019

I'm trying to build pyql for WIN32 x64 in the following environment:

  • Python 3.6.2 | packaged by conda-forge | (default, Jul 23 2017, 22:58:45) [MSC v.1900 64 bit (AMD64)] on win32
  • Boost 1.71.0
  • QuantLib-1.16
  • MSVC Community 2017 Version 15.9.17

I followed the instructions here

but had to make a few additional tweaks:

  1. add the compiler flag /D QL_HIGH_RESOLUTION_DATE when building QuantLib so that QuantLib::Hour etc. were defined
  2. add the same compiler flag in setup.py get_define_macros()
  3. Put a guard: if sys.platform != 'win32': around the compiler_so code in setup.py pyql_build_ext.build_extensions(), since this code is *nix specific (I think)
  4. Install cygwin with the binutils package in order to get nm (a *nix utility for examining binary files). Put the nm location in your PATH or amend generate_symbols.py symbol_generator_from_obj_file() sp that command = [r'<wherever your cygwin install puts nm\nm', '--extern-only', '--defined-only', object_file]
  5. Futz around with the lib names etc; see this issue

I could then follow the build, def file, build instructions, and subsequently run python setup.py build_ext --inplace or python setup.py build.

When I tried to run the tests I got a bunch of errors all very similar to this:

======================================================================
ERROR: quantlib.test.test_zero_coupon (unittest.loader._FailedTest)

ImportError: Failed to import test module: quantlib.test.test_zero_coupon
Traceback (most recent call last):
File "C:\Users\wxf\Continuum\anaconda3\envs\gresham_pyql\lib\unittest\loader.py", line 428, in _find_test_path
module = self._get_module_from_name(name)
File "C:\Users\wxf\Continuum\anaconda3\envs\gresham_pyql\lib\unittest\loader.py", line 369, in _get_module_from_name
import(name)
File "d:\dev\pyql\quantlib\test\test_zero_coupon.py", line 3, in
from quantlib.settings import Settings
ImportError: DLL load failed: %1 is not a valid Win32 application.

which seems to suggest some sort of 32bit vs x64 conflict, but I can't work out why. Can anyone help?

This is some output from the build stage which seems to indicate that the 64 bit compiler is being used:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -D_WIN64 -DWIN64 -DNDEBUG -D_WINDOWS -DNOMINMAX -DWINNT -D_WINDLL -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DQL_HIGH_RESOLUTION_DATE -ID:\lib\QuantLib-1.16 -ID:\lib\boost_1_71_0 -I. -I./cpp_layer -IC:\Users\wxf\Continuum\anaconda3\envs\gresham_pyql\lib\site-packages\numpy\core\include -IC:\Users\wxf\Continuum\anaconda3\envs\gresham_pyql\include -IC:\Users\wxf\Continuum\anaconda3\envs\gresham_pyql\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpcpp_layer/constraint_support_code.cpp /Fobuild\temp.win-amd64-3.6\Release\cpp_layer/constraint_support_code.obj /GR /FD /Zm250 /EHsc
constraint_support_code.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant