[Question] Compiling a standalone example of QuantLib compiled with XAD configuration #10
Replies: 2 comments 2 replies
-
Hello Marcin, Thank you for your question. We've been investigating this issue and it turns out that using XAD-enabled QuantLib from a standalone application is indeed broken at the moment. The required CMake flags and linking settings are not exported into the installed target correctly. We have created issue #11 to track this and hope to get it fixed soon. In the meantime, as a workaround, you could add the following flags to your code to make it work: find_package(XAD REQUIRED)
...
target_link_libraries(quantlib_examples PRIVATE QuantLib XAD::xad)
target_compile_definitions(quantlib_examples PRIVATE QL_INCLUDE_FIRST=ql/qlxad.hpp) (These are the flags added here in the build file.) Please let us know if this works for you. |
Beta Was this translation helpful? Give feedback.
-
Hi @marcin-rybacki - the issue you had with the integration has now been fixed with this PR #14 - it should be seamless now, if you want to give it a try. |
Beta Was this translation helpful? Give feedback.
-
Hello there,
first of all, thank you for the effort of integrating QuantLib with your library and sharing it with the community.
I was trying to compile (on a Ubuntu machine) some standalone piece of code (a simple CATCH unit test) linked to QuantLib compiled with XAD (as instructed here https://auto-differentiation.github.io/examples/quantlib/#4-quantlib-cmake-configuration)
Here's my code:
I compile it using the following CMake:
While for the standard QuantLib installation this code (with this CMake configuration) compliles and runs fine, it gives an error
undefined reference to QuantLib::blackFormulaForwardDerivative(QuantLib::Option::Type, double, double, double, double, double)
when linking it to QuantLib compiled with XAD configuration. I am guessing that the linker is expecting something more, but I cannot quite figure out what.
Before adding any XAD related code to my example, I wanted to start with something simple (that compiles) and I assumed that this code will, with the usual flags.
I would appreciate any hints or suggestions, thank you!
Beta Was this translation helpful? Give feedback.
All reactions