lballabio / quantlib-old

The QuantLib C++ library and extensions (warning: out of date)
http://quantlib.org
471 stars 405 forks source link

C# System.AccessViolationException still exists on new version QuantLib-SWIG-1.6 #306

Closed vinaydwivedi closed 7 years ago

vinaydwivedi commented 9 years ago

I upgraded to new version QuantLib-SWIG-1.6 - Still has many System.AccessViolationException. System.AccessViolationException - Is very hard to reproduce and generally comes randomly during very high load, consistent with comment

"This usually occurs because a pointer has a bad value. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. Thus, access violations almost always indicate serious programming errors" https://msdn.microsoft.com/en-us/library/system.accessviolationexception(v=vs.110).aspx

We were using V1.2 with same issues, wondering if anything has been done to solve these issues in V1.6?

Appreciate any help, many thanks.

Application: Pricer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException Stack: at QuantLib.NQuantLibcPINVOKE.delete_DividendVanillaOption(System.Runtime.InteropServices.HandleRef) at QuantLib.DividendVanillaOption.Dispose() at QuantLib.DividendVanillaOption.Finalize()

Application: Pricer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.AccessViolationException Stack: at QuantLib.NQuantLibcPINVOKE.delete_BlackVolTermStructureHandle(System.Runtime.InteropServices.HandleRef) at QuantLib.BlackVolTermStructureHandle.Dispose() at QuantLib.BlackVolTermStructureHandle.Finalize()

lballabio commented 9 years ago

I think it's the issue described by Klaus Spanderen at https://hpcquantlib.wordpress.com/2015/02/28/quantlib-1-5-swig-patch-for-jvm-net/ . He also provides a patch at the same link.

vinaydwivedi commented 9 years ago

Ok - Going to try it, will post my results by tomorrow after load testing. Thanks a lot.

vinaydwivedi commented 9 years ago

ok - I tried to compile QuantLib V1.6.1 with the patch (boost_1_57_0). Having hard time building it. Do you plan to include this patch in the Github's version any time soon?

Following steps,

Error 3 error LNK1181: cannot open input file 'C:\QuantLib-1.6.1\lib\QuantLib-vc100-mt.lib' C:\QuantLib-1.6.1\Examples\MarketModels\LINK MarketModels


Have not tried following (or I don't need to build QuantLib 1.6 libary)?

  1. Add the full boost lib path and the QuantLib lib path in: Project properties > Configuration Properties > Linker

    General > Additional Library Directories to your SWIG Visual Studio project, which compiles quantlib_wrap.cpp
    (Similar to what is needed to build the test suite.)

  2. build solution
vinaydwivedi commented 9 years ago

Unable to build it with V1.5 QuantLib as well sadly, Multiple errors e.g.

Error 1 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\MarketModels\QuantLib-vc100-mt.lib(settings.obj) MarketModels

Error 2 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\MarketModels\QuantLib-vc100-mt.lib(blackformula.obj) MarketModels

lballabio commented 9 years ago

I'm not familiar with the patch, but from the error it looks like you should add boost_system to the linked libraries.

lballabio commented 9 years ago

(or whatever it's called. It could be libboost_system or something like it.)

klausspanderen commented 9 years ago

w.r.t. the first problem with QL-1.6.1: The interface of the class Observer has changed from version 1.5 to 1.6. In particular the method

void registerWithObservables(const boost::shared_ptr&);

was added. Even though the implementation is straight forward (more or less copy the original implementation plus a mutex lock around the body of the method) I haven't yet had the time to release a version 1.6 of the patch. If you need 1.6 then please just add the method to the patched version.

w.r.t. the second problem: As Luigi mentioned depending on your boost version you'll have to add libboost_system and libboost_thread to your linked libraries.

vinaydwivedi commented 9 years ago

Quick question:

Do I need to rebuild Boost after updating to #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS_2)? My OS is 64 BIT, how to do that in 32 version on a 64 bit OS? I need to compile NQuantLIb in 32 Bit.

Re: Add Libboost_System, libboost_thread to linked libraries - Where can I find these libraries in Boost 1_57 directories, and how to add them - Linker>general>Additional Library Dependencies> C:\local\boost157M\boost_1_57_0\libs?

PS: I primarily program using C#, VC++ is a bit of gray area for me ATM :/

klausspanderen commented 9 years ago

No.

On Tuesday, September 08, 2015 11:05:55 PM vinaydwivedi wrote:

Quick question:

Do I need to rebuild Boost after updating to #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS_2)?


Reply to this email directly or view it on GitHub: https://github.com/lballabio/quantlib/issues/306#issuecomment-138795275

vinaydwivedi commented 9 years ago

okay, Re: Add Libboost_System, libboost_thread to linked libraries - Where can I find these libraries in Boost 1_57 directories, and how to add them - Linker>general>Additional Library Dependencies> C:\local\boost157M\boost_1_57_0\libs? I've already tried that, doesn't work :/

PS: I primarily program using C#, VC++ is a bit of gray area for me ATM :/

klausspanderen commented 9 years ago

Easiest way might be to add these libraries to the auto_link section in test-suite/quantlibtestsuite.cpp, line 30ff should become

#ifdef BOOST_MSVC
#  include <ql/auto_link.hpp>
#  define BOOST_LIB_NAME boost_unit_test_framework
#  include <boost/config/auto_link.hpp>
#  undef BOOST_LIB_NAME

#  define BOOST_LIB_NAME boost_thread
#  include <boost/config/auto_link.hpp>
#  undef BOOST_LIB_NAME

#  define BOOST_LIB_NAME boost_system
#  include <boost/config/auto_link.hpp>
#  undef BOOST_LIB_NAME

The first five lines are unchanged w.r.t. the original version of the file. Thanks for highlighting this issue. I'm going to add the modified quantlibtestsuite.cpp file to the patch,

lballabio commented 9 years ago

Similar code should also be added to the C# wrappers (for system and threads but not the unit test library).

vinaydwivedi commented 9 years ago

Any such changes required in the QuantLib project in the VC++ solution (other than Test-Suite)?

lballabio commented 9 years ago

No, I don't think so.

vinaydwivedi commented 9 years ago

I had excluded testsuite in my earlier QuantLib VC++ builds. I always get an error Error

Still have these errors:

1476 error LNK1104: cannot open file 'libboost_unit_test_framework-vc100-mt-1_57.lib' C:\QuantLib\QuantLib-1.5 - PatchBuild1\QuantLib-1.5\test-suite\LINK testsuite

I've already set VC++ directories, and linker for all projects including TestSuite (other than QuantLib) in VC++ solution is pointed to

C:\local\boost157M\boost_1_57_0\libs C:\QuantLib\QuantLib-1.5\lib

*\ And probably because test-suite is not build - other build errors e.g. unresolved external symbol "class boost::system still persist.

I also tried manually compiling Boost using B2 command, I compiled everything into a different folder - but all those are named vc140 instead of VC100 e.g. I do see libboost_unit_test_framework-vc140-mt-1_57.lib in the folder path passed to B2 command.

I am trying to build my VC++ QUantlib solution in 32 bit on a 64 Windows 7 OS.

Please advice...

vinaydwivedi commented 9 years ago

Trying this command: b2 --toolset=msvc-10.0 --build-type=complete stage to build Boost in 32 Bit with VS2010 compiler - I will update all the Boost Lib paths to Stage\Lib - Hope that will work... Phew!

lballabio commented 9 years ago

What compiler are you using? I thought you were using VC14. If so, you don't need the Boost libraries from VC10, whatever the error says.

vinaydwivedi commented 9 years ago

No, I've been using VS2010 - Never had to compile Boost.

Just Adding Boost (downloaded precompiled v1_57_0) - to include directory, and Boost/Lib to Library directory for all the projects was good to compile both Quantlib VC++ and SWIG GitHub versions. Has been quite difficult to get the patch working - but I need to - Hoping after all this work - AccessViolationException issue would be gone.

I saw a release note: re: QuantLib usage in multiple threads. My pricing code is multi threaded, but threads do not share quantlib members with each other. I am hoping there won't be any problems around that.

May be I will also upload a patched version - (Boost, VC++ QuantLib, and SWIG) - after I get everything compiled well, and working along with steps somewhere. Possibly that may help someone who is not from VC++ background.

You guys have been quite responsive in the forum - many thanks for all the help so far!

vinaydwivedi commented 9 years ago

Still have compilation issues after adding libaries in QUantlibtestsuite.cpp in every project other than QuantLIb and TestSuite (about 1475 compilation errors)

Error 5 error LNK1120: 2 unresolved externals C:\QuantLib-1.5\Examples\MultidimIntegral\bin\MultidimIntegral-vc100-mt.exe MultidimIntegral Error 196 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\Gaussian1dModels\bin\Gaussian1dModels-vc100-mt.exe Gaussian1dModels Error 245 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\LatentModel\bin\LatentModel-vc100-mt.exe LatentModel Error 300 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\BasketLosses\bin\BasketLosses-vc100-mt.exe BasketLosses Error 359 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\CDS\bin\CDS-vc100-mt.exe CDS Error 400 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\MarketModels\bin\MarketModels-vc100-mt.exe MarketModels Error 487 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\CallableBonds\bin\CallableBonds-vc100-mt.exe CallableBonds Error 636 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\Bonds\bin\Bonds-vc100-mt.exe Bonds Error 719 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\FittedBondCurve\bin\FittedBondCurve-vc100-mt.exe FittedBondCurve Error 760 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\DiscreteHedging\bin\DiscreteHedging-vc100-mt.exe DiscreteHedging Error 941 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\BermudanSwaption\bin\BermudanSwaption-vc100-mt.exe BermudanSwaption Error 1006 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\Repo\bin\Repo-vc100-mt.exe Repo Error 1115 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\FRA\bin\FRA-vc100-mt.exe FRA Error 1224 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\ConvertibleBonds\bin\ConvertibleBonds-vc100-mt.exe ConvertibleBonds Error 1285 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\Replication\bin\Replication-vc100-mt.exe Replication Error 1374 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\EquityOption\bin\EquityOption-vc100-mt.exe EquityOption Error 1475 error LNK1120: 4 unresolved externals C:\QuantLib-1.5\Examples\Swap\bin\SwapValuation-vc100-mt.exe Swap Error 2 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\MultidimIntegral\QuantLib-vc100-mt.lib(observable.obj) MultidimIntegral Error 54 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(discretizedswap.obj) Gaussian1dModels Error 55 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(overnightindexedcoupon.obj) Gaussian1dModels

Error 1043 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(cashflowvectors.obj) FRA Error 1044 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(couponpricer.obj) FRA Error 1045 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(voltermstructure.obj) FRA

Error 4 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\MultidimIntegral\QuantLib-vc100-mt.lib(observable.obj) MultidimIntegral Error 125 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(discretizedswap.obj) Gaussian1dModels Error 126 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(overnightindexedcoupon.obj) Gaussian1dModels

Error 1000 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Repo\QuantLib-vc100-mt.lib(bond.obj) Repo Error 1001 error LNK2001: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Repo\QuantLib-vc100-mt.lib(discountingbondengine.obj) Repo Error 1003 error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) C:\QuantLib-1.5\Examples\Repo\QuantLib-vc100-mt.lib(observable.obj) Repo

Error 6 error LNK2001: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(makevanillaswap.obj) Gaussian1dModels Error 7 error LNK2001: unresolved external symbol "void \ cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(makeois.obj) Gaussian1dModels Error 8 error LNK2001: unresolved external symbol "void * __cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(mt19937uniformrng.obj) Gaussian1dModels

Error 1007 error LNK2001: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(floatingratecoupon.obj) FRA Error 1008 error LNK2001: unresolved external symbol "void \ cdecl boost::detail::get_tss_data(void const *)" (?get_tss_data@detail@boost@@YAPAXPBX@Z) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(couponpricer.obj) FRA

Error 30 error LNK2001: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(makevanillaswap.obj) Gaussian1dModels Error 31 error LNK2001: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) C:\QuantLib-1.5\Examples\Gaussian1dModels\QuantLib-vc100-mt.lib(makeois.obj) Gaussian1dModels

Error 1025 error LNK2001: unresolved external symbol "void cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(floatingratecoupon.obj) FRA Error 1026 error LNK2001: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(couponpricer.obj) FRA Error 1027 error LNK2001: unresolved external symbol "void cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) C:\QuantLib-1.5\Examples\FRA\QuantLib-vc100-mt.lib(imm.obj) FRA

Error 1 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??Eposix_category@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\MultidimIntegral\MultidimIntegral.obj MultidimIntegral Error 121 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??Eposix_category@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\Gaussian1dModels.obj Gaussian1dModels Error 224 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??Eposix_category@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\LatentModel\LatentModel.obj LatentModel

Error 1075 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??Eposix_category@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\FRA\FRA.obj FRA Error 1180 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??Eposix_category@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\ConvertibleBonds\ConvertibleBonds.obj ConvertibleBonds Error 1255 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??Eposix_category@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\Replication\Replication.obj Replication

Error 3 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??Enative_ecat@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\MultidimIntegral\MultidimIntegral.obj MultidimIntegral Error 192 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??Enative_ecat@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\Gaussian1dModels.obj Gaussian1dModels

Error 1002 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??Enative_ecat@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\Repo\Repo.obj Repo Error 1111 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??Enative_ecat@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\FRA\FRA.obj FRA Error 1220 error LNK2019: unresolved external symbol "class boost::system::error_category const & cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??Enative_ecat@system@boost@@YAXXZ) C:\QuantLib-1.5\Examples\ConvertibleBonds\ConvertibleBonds.obj ConvertibleBonds

Error 394 error LNK2019: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) referenced in function "public: class QuantLib::SeedGenerator \ thiscall boost::thread_specific_ptr::get(void)const " (?get@?$thread_specific_ptr@VSeedGenerator@QuantLib@@@boost@@QBEPAVSeedGenerator@QuantLib@@XZ) C:\QuantLib-1.5\Examples\MarketModels\QuantLib-vc100-mt.lib(mt19937uniformrng.obj) MarketModels Error 754 error LNK2019: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) referenced in function "public: class QuantLib::SeedGenerator \ thiscall boost::thread_specific_ptr::get(void)const " (?get@?$thread_specific_ptr@VSeedGenerator@QuantLib@@@boost@@QBEPAVSeedGenerator@QuantLib@@XZ) C:\QuantLib-1.5\Examples\DiscreteHedging\QuantLib-vc100-mt.lib(mt19937uniformrng.obj) DiscreteHedging Error 26 error LNK2019: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) referenced in function "public: class QuantLib::Settings \ thiscall boost::thread_specific_ptr::get(void)const " (?get@?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QBEPAVSettings@QuantLib@@XZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\Gaussian1dModels.obj Gaussian1dModels

Error 1225 error LNK2019: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) referenced in function "public: class QuantLib::Settings \ thiscall boost::thread_specific_ptr::get(void)const " (?get@?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QBEPAVSettings@QuantLib@@XZ) C:\QuantLib-1.5\Examples\Replication\Replication.obj Replication Error 1287 error LNK2019: unresolved external symbol "void * cdecl boost::detail::get_tss_data(void const )" (?get_tss_data@detail@boost@@YAPAXPBX@Z) referenced in function "public: class QuantLib::Settings \ thiscall boost::thread_specific_ptr::get(void)const " (?get@?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QBEPAVSettings@QuantLib@@XZ) C:\QuantLib-1.5\Examples\EquityOption\EquityOption.obj EquityOption

Error 397 error LNK2019: unresolved external symbol "void cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: thiscall boost::thread_specific_ptr::~thread_specific_ptr(void)" (??1?$thread_specific_ptr@VSeedGenerator@QuantLib@@@boost@@QAE@XZ) C:\QuantLib-1.5\Examples\MarketModels\QuantLib-vc100-mt.lib(mt19937uniformrng.obj) MarketModels Error 757 error LNK2019: unresolved external symbol "void cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: thiscall boost::thread_specific_ptr::~thread_specific_ptr(void)" (??1?$thread_specific_ptr@VSeedGenerator@QuantLib@@@boost@@QAE@XZ) C:\QuantLib-1.5\Examples\DiscreteHedging\QuantLib-vc100-mt.lib(mt19937uniformrng.obj) DiscreteHedging Error 50 error LNK2019: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: __thiscall boost::thread_specific_ptr::~thread_specific_ptr(void)" (??1?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QAE@XZ) C:\QuantLib-1.5\Examples\Gaussian1dModels\Gaussian1dModels.obj Gaussian1dModels

Error 1039 error LNK2019: unresolved external symbol "void cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: thiscall boost::thread_specific_ptr::~thread_specific_ptr(void)" (??1?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QAE@XZ) C:\QuantLib-1.5\Examples\FRA\FRA.obj FRA Error 1140 error LNK2019: unresolved external symbol "void cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: thiscall boost::thread_specific_ptr::~thread_specific_ptr(void)" (??1?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QAE@XZ) C:\QuantLib-1.5\Examples\ConvertibleBonds\ConvertibleBonds.obj ConvertibleBonds Error 1229 error LNK2019: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const ,class boost::shared_ptr,void ,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z) referenced in function "public: __thiscall boost::thread_specific_ptr::~thread_specific_ptr(void)" (??1?$thread_specific_ptr@VSettings@QuantLib@@@boost@@QAE@XZ) C:\QuantLib-1.5\Examples\Replication\Replication.obj Replication

vinaydwivedi commented 9 years ago

Problem is all: I am able to build original GITHub (from Sourceforge) version of QuantLib V1.5, even after making Boost Change related to Patch i.e. (BOOST_SP_ENABLE_DEBUG_HOOKS_2)

but after copying all the files into the destination folders of QuantLib, i.e. in following from Patch folder -

1 **1**** QuantLib\ql\makefile.am QuantLib\ql\qldefine.hpp QuantLib\ql\userconfig.hpp

To C:/QuantLibV1.5\ql

2 **2**** QuantLib\ql\patterns\makefile.am QuantLib\ql\patterns\observable.cpp QuantLib\ql\patterns\observable.hpp QuantLib\ql\patterns\singleton.hpp

to C:/QuantLibV1.5\ql\Patterns

3 **3**** QuantLib\test-suite\makefile.am

to C:/QuantLibV1.5\test-suite\

4 **3**** QuantLib\configure.ac to C:/QuantLibV1.5\

and Finally Updating test-suite/quantlibtestsuite.cpp with Code snippet suggested by Klaus

VC++ Directories - Include Directories: C:\local\boost157M\boost_1_57_0;$(IncludePath) Library Directories: C:\local\boost157M\boost_1_57_0\libs;$(LibraryPath)

Linker: C:\local\boost157M\boost_1_57_0\libs;C:\local\boost157M\boost_1_57_0\stage\lib;C:\QuantLib-1.5\lib

Build - and then all these compilation errors. I start getting these compilation errors!

vinaydwivedi commented 9 years ago

Am I missing anything here?

lballabio commented 9 years ago

It's the same issue you had with the test suite. Add the libraries and the #include code to the other projects, too.

vinaydwivedi commented 9 years ago

Ok, all compiled and running. Will test the new DLLs over next few days, Thanks for all your help!

klausspanderen commented 9 years ago

A new version of the patch for QuantLib 1.6.2 is available: http://hpc-quantlib.de/src/observer-1.6.2.zip. The new version requires boost version 1.58 or higher. This boost version allows for a much cleaner implementation without having to change boost itself and without preprocessor defines like BOOST_SP_ENABLE_DEBUG_HOOKS. Actually most files are touched in order to link boost_thread and boost_system to all libs and .exe. Please find a short description here https://hpcquantlib.wordpress.com/2015/09/20/quantlib-1-6-2-multithreading-patch-for-jvm-net/

Luigi, this version doesn't need ugly workarounds anymore, so maybe we should consider adding it to QL with conditional preprocessor defines?

vinaydwivedi commented 9 years ago

V 1.5 patched version has been running good for last few days, no issues so far (a bit more testing is still pending).

I am going to compile the version that you have added with Boost 1.58, and post the results.

Thanks.

lballabio commented 9 years ago

@klausspanderen Yes, we should add it.

vinaydwivedi commented 9 years ago

I used v1.6.2 patch with V1.6.2 quantlib, I see some similar build issues that I saw earlier with 1.5 version. Would be much more easier to build and integrate if version 1.6 ++ is going to include all these changes in the GIThub version.

PS: I used Boost 1.59.

lballabio commented 9 years ago

Yes, we'll try that, at least as a branch.