Topics

I can confirm Rtools34 + 1.12.1 works

shrektan
 

No segfaults found when using the Rtools34 and the static library v1.12.1 (Need to replace the ext::shared_ptr() with boost::shared_ptr(), see the file attached.)

Well, actually with v1.12.1, Rtools35 can compile and run without issues.

I tried to use the std::shared_ptr() and find that there's no way to link against => It confirms that, as stated in the QuantLib v1.4 release, the boost pointer is used by default. And, the v1.14 static library is using the boost::shared_ptr() => my previous guess is wrong.

Tried using the same flags "-m64 -g0 -O2" => as long as v1.14 being linked, segfaults happen.

One not-that-smart way to narrow down the cause is to build the static library against v1.13 and if works, we can continue to build the middle version...It's just the compiling of QuantLib takes hours and seems like not easy to be built successfully...

I may take a try in the weekends.

Dirk Eddelbuettel
 

On 29 November 2018 at 07:52, shrektan@... wrote:
| No segfaults found when using the Rtools34 and the static library v1.12.1 (Need to replace the ext::shared_ptr() with boost::shared_ptr(), see the file attached.)
|
| Well, actually with v1.12.1, Rtools35 can compile and run without issues.

So you are saying that both rtools versions (when used with the 1.12.1 QL
library version) work?

| I tried to use the std::shared_ptr() and find that there's no way to link against => It confirms that, as stated in the QuantLib v1.4 release, the boost pointer is used by default. And, the v1.14 static library is using the boost::shared_ptr() => my previous guess is wrong.

I don't understand what you are trying to say.

| Tried using the same flags "-m64 -g0 -O2" => as long as v1.14 being linked, segfaults happen.
|
| One not-that-smart way to narrow down the cause is to build the static library against v1.13 and if works, we can continue to build the middle version...It's just the compiling of QuantLib takes hours and seems like not easy to be built successfully...
|
| I may take a try in the weekends.

This is super helpful work. But I am not sure we need the proof with 1.13.

Maybe we need to focus instead on how to configure QL so that it works with
g++ 4.9.3 ? Shall we talk to upstream? I lurk on their lists and could ask...

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | @edd

shrektan
 

So you are saying that both rtools versions (when used with the 1.12.1 QL
library version) work?
Yes. Both Rtools versions work for QL 1.12.1. Just realize that Rtools34 and
Rtools35 both use the gcc4.9.3, so it's expected.

I tried to use the std::shared_ptr() and find that there's no way to link against => It confirms that, as stated in the QuantLib v1.4 release, the boost pointeris used by default. And, the v1.14 static library is using the boost::shared_ptr() => my previous guess is wrong.
One of the big changes in the new QL version is they added an opt-in feature: allowing
the user to use `std::shared_ptr` instead of `boost::shared_ptr`. So my silly guess is
that the static library somehow uses the boost version while the cpp file uses the std version.
Linking each other leads to the segfaults. It can't be linked. My silly guess is wrong.

Maybe we need to focus instead on how to configure QL so that it works with
g++ 4.9.3 ? Shall we talk to upstream? I lurk on their lists and could ask...
+1



Dirk Eddelbuettel
 

On 29 November 2018 at 08:36, shrektan@... wrote:
| > Maybe we need to focus instead on how to configure QL so that it works
| > with
| > g++ 4.9.3 ? Shall we talk to upstream? I lurk on their lists and could
| > ask...
|
| +1

Before doing so I had a look at the installation / configuration options at
https://www.quantlib.org/reference/config.html

For Windows it says

Under a Windows system, they must be (un)defined by editing the file
<ql/userconfig.hpp> and commenting or uncommenting the relevant lines.

and that has

#define QL_USE_STD_SHARED_PTR

If defined, std::shared_ptr and related classes and functions will be used
instead of boost::shared_ptr; this requires you to set your compiler's
standard to at least C++11. If disabled (the default) the Boost facilities
are used. Note that std::shared_ptr does not check access and can cause
segmentation faults.

Should we try another value here? It does suggest Boost is used (as before)
so that would not be a change. Would be worth trying the other value?

Also, how about trying the unit testing framework once? Josh, any luck
getting this going?

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | @edd

Joshua Ulrich
 

On Fri, Nov 30, 2018 at 6:06 AM Dirk Eddelbuettel
<@eddelbuettel> wrote:

Also, how about trying the unit testing framework once? Josh, any luck
getting this going?
Haven't had a chance to try again until now. Hopefully I can make
some progress today or tomorrow.

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | @edd



--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

Dirk Eddelbuettel
 

On 1 December 2018 at 07:16, Joshua Ulrich wrote:
| On Fri, Nov 30, 2018 at 6:06 AM Dirk Eddelbuettel
| <@eddelbuettel> wrote:
| >
| > Also, how about trying the unit testing framework once? Josh, any luck
| > getting this going?
| >
| Haven't had a chance to try again until now. Hopefully I can make
| some progress today or tomorrow.

I should probably wait for that before bugging upstream.

Could you post your script here in case they want to follow-up? Most recent
use was QL 1.14, Boost 1.68 and Rtools 3.5, correct?

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | @edd

shrektan
 

Hi Josh,

I'm trying to rebuild the QuantLib from source on Windows, based on your script https://github.com/rwinlib/quantlib/issues/2 . (P.S. Rtools alone is not enough. Need to install MinGW with some packages. And I need to run "./autogen.sh" in order to generate the ./configure file)
 
I downloaded the source of boost and modified the variable value but it still throws the error that "Boost development files not found". I guess I may need a compiled boost version? Because "QuantLib installation on Linux" says "./configure --with-boost-include=/home/foo/include --with-boost-lib=/home/foo/lib". And I don't understand why there's no "--with-boost-lib" in your script.

In addition, I notice a detail in your script, where the CXXFlags contains "
--enable-shared". In contrast to QuantLib installation on Mac OS X :

Also, if you only intend to build the QuantLib Python module, you might want to pass the --disable-shared option to ./configure to only build a static library and avoid problems with dynamic loading.
It looks like we should use "--disable-shared" as well...

Dirk Eddelbuettel
 

On 1 December 2018 at 07:36, shrektan@... wrote:
| Hi Josh,
|
| I'm trying to rebuild the QuantLib from source on Windows, based on your script https://github.com/rwinlib/quantlib/issues/2 . (P.S. Rtools alone is not enough. Need to install MinGW with some packages. And I need to run "./autogen.sh" in order to generate the ./configure file )
|  
| I downloaded the source of boost and modified the variable value but it still throws the error that "Boost development files not found". I guess I may need a compiled boost version? Because "QuantLib installation on Linux" says "./configure --with-boost-include=/home/foo/include --with-boost-lib=/home/foo/lib". And I don't understand why there's no " --with-boost-lib" in your script.
|
| In addition, I notice a detail in your script, where the CXXFlags contains " --enable-shared". In contrast to QuantLib installation on Mac OS X ( https://www.quantlib.org/install/macosx.shtml ) :
|
| >
| > *Also, if you only intend to build the QuantLib Python module* , you might
| > want to pass the --disable-shared option to ./configure to only build a
| > static library and avoid problems with dynamic loading.
|
| It looks like we should use "--disable-shared" as well...

Yep. And we should probably nail down a script and post it here and/or in the
rquantlib repo. PRs welcome!

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | @edd

Joshua Ulrich
 

On Sat, Dec 1, 2018 at 11:12 AM Dirk Eddelbuettel
<@eddelbuettel> wrote:


On 1 December 2018 at 07:36, shrektan@... wrote:
| Hi Josh,
|
| I'm trying to rebuild the QuantLib from source on Windows, based on your script https://github.com/rwinlib/quantlib/issues/2 . (P.S. Rtools alone is not enough. Need to install MinGW with some packages. And I need to run "./autogen.sh" in order to generate the ./configure file )
|
Both points are correct. I believe the top of the script says that it
was only tested with MinGW and msys1.0. I should have said that it's
only "known to work" with those tools. I initially tried with just
Rtools and the Windows command line, but that didn't work. And I
believe the QuantLib readme says that you need the autogen.sh command
to build from GitHub. I build from the latest release.

| I downloaded the source of boost and modified the variable value but it still throws the error that "Boost development files not found". I guess I may need a compiled boost version? Because "QuantLib installation on Linux" says "./configure --with-boost-include=/home/foo/include --with-boost-lib=/home/foo/lib". And I don't understand why there's no " --with-boost-lib" in your script.
|
You only need the boost headers, unless you want to run the QuantLib
unit tests (they require the boost test framework library). Make sure
--with-boost-include is pointing to the location of the unpacked boost
source files.

| In addition, I notice a detail in your script, where the CXXFlags contains " --enable-shared". In contrast to QuantLib installation on Mac OS X ( https://www.quantlib.org/install/macosx.shtml ) :
|
| >
| > *Also, if you only intend to build the QuantLib Python module* , you might
| > want to pass the --disable-shared option to ./configure to only build a
| > static library and avoid problems with dynamic loading.
|
| It looks like we should use "--disable-shared" as well...

Yep. And we should probably nail down a script and post it here and/or in the
rquantlib repo. PRs welcome!
Both --enable-shared and --enable-static are true by default in my
./configure file. We use the static library for RQuantLib. Disabling
the shared library might get us a small QuantLib build-time speedup,
but it shouldn't affect RQuantLib.

Dirk

--
http://dirk.eddelbuettel.com | @eddelbuettel | @edd



--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
R/Finance 2018 | www.rinfinance.com

shrektan
 

You only need the boost headers, unless you want to run the QuantLib
| unit tests (they require the boost test framework library). Make sure
| --with-boost-include is pointing to the location of the unpacked boost
| source files.

I finally make the script work by putting the `CXXFLAGS=` after `
$QUANTLIB_SRC/configure` 
(before it was `
CXXFLAGS="-m64 -g0 -O2" $QUANTLIB_SRC/configure --prefix=$QUANTLIB_ROOT`)

I add some comments on https://github.com/rwinlib/quantlib/issues/2 regarding the MinGW and MSYS set-ups.
Maybe they are useful when we want to document the whole steps later...

I have just finished the building of the QuantLib 1.13. I can confirm that the segfaults happen for QL 1.13 on the same line...

shrektan
 

Hi,

I build QL 1.12.1 using the same script but surprisingly find the segfault still happen.
It should not happen because I've tested it using the static library built by Josh...

I'll try to build QL 1.12.1 again, using Rtools34 instead of Rtools35...
If no segfaults happen, it must be something related to the tool chain changes made in Rtools35.

Regards,
Xianying