building on Fedora 11

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

building on Fedora 11

Chuck Swiger-4
Gang - Just built QuantLib-0.9.9 on Fedora 11 and got everything working
(AFAIK). 'make check' works. One issue was with apr and apr-util in
log4cxx, appearently something with the new libtool-2.2. Solution was to
just download them ready to configure from apr.apache.org.

Got QuantLib-SWIG to build and Python runs the examples ok but Perl stil
segfaults. Since Perl has a nice Finance::Quote modules I'd like to run
QL there ;)  As it is I have to grab quotes with perl and crunch the
numbers in Python...  There is a pyperl module that allow you to run
perl in python but it has fallen into disrepair and not kept up with
current versions.

--Chuck




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: building on Fedora 11

Luigi Ballabio
On Mon, 2009-11-16 at 15:42 -0500, Chuck Swiger wrote:
> Got QuantLib-SWIG to build and Python runs the examples ok but Perl stil
> segfaults.

Yes, this has bugged me for a long time.  Do you think you can find some
time to try and debug it? (Or to reduce the error to a smaller,
self-contained example we can send to the SWIG mailing list?)

Luigi


--

Vin: It's like this fellow I knew in El Paso. One day, he just took
all his clothes off and jumped in a mess of cactus. I asked him that
same question, "Why?"
Calvera: And?
Vin: He said, "It seemed like a good idea at the time."
-- The Magnificent Seven



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: building on Fedora 11

Chuck Swiger-4
On Wed, 2009-11-18 at 11:01 +0100, Luigi Ballabio wrote:

> On Mon, 2009-11-16 at 15:42 -0500, Chuck Swiger wrote:
> > Got QuantLib-SWIG to build and Python runs the examples ok but Perl stil
> > segfaults.
>
> Yes, this has bugged me for a long time.  Do you think you can find some
> time to try and debug it? (Or to reduce the error to a smaller,
> self-contained example we can send to the SWIG mailing list?)
>
> Luigi
>
>

Running perl in debug mode step-by-step it fails in the SWIG Perl
example (european-option.pl) on the $volatility line. Will look further
too.
--Chuck

------------------------------------------------------

[chuck@linux7 examples]$ strace -o error-2 perl -de 0

Loading DB routines from perl5db.pl version 1.3
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   0
  DB<1> use QuantLib;

  DB<2> $todaysDate  = new QuantLib::Date(15, $QuantLib::May, 1998);

  DB<3> QuantLib::Settings::instance()->setEvaluationDate($todaysDate);

  DB<4> $settlementDate  = new QuantLib::Date(17, $QuantLib::May, 1998);

  DB<5> $cal1 =  new QuantLib::Actual365Fixed;

  DB<6> $riskFreeRate  = new QuantLib::FlatForward($settlementDate,0.05,$cal1);

  DB<7> $exercise  = new QuantLib::EuropeanExercise(new QuantLib::Date(17,$QuantLib::May, 1999));

  DB<8> $payoff  = new QuantLib::PlainVanillaPayoff($QuantLib::Option::Put, 8.0);

  DB<9> $underlying  = new QuantLib::SimpleQuote(7.0);

  DB<10> $cal2 = new QuantLib::Actual365Fixed;

  <typo line>

  DB<12> $volatility  = new QuantLib::BlackConstantVol($todaysDate, new QuantLib::TARGET, 0.10, $
cal2);
Signal SEGV at /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/QuantLib.pm line 283
1
        QuantLib::TARGET::DESTROY('QuantLib::TARGET=HASH(0xa8deafc)') called at /usr/lib/perl5/5.
10.0/perl5db.pl line 641
        eval {...} called at /usr/lib/perl5/5.10.0/perl5db.pl line 641
        DB::eval called at /usr/lib/perl5/5.10.0/perl5db.pl line 3434
        DB::DB called at -e line 1


tail of strace output:

stat64("/usr/lib/perl5/5.10.0/i386-linux-thread-multi/List/Util.pm", {st_mode=S_IFREG|0644, st_size=6698, ...}) = 0
open("/usr/lib/perl5/5.10.0/i386-linux-thread-multi/List/Util.pm", O_RDONLY|O_LARGEFILE) = 6
ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbf861af8) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(6, 0, [0], SEEK_CUR)            = 0
read(6, "# List::Util.pm\n#\n# Copyright (c)"..., 4096) = 4096
_llseek(6, 1066, [1066], SEEK_SET)      = 0
_llseek(6, 0, [1066], SEEK_CUR)         = 0
close(6)                                = 0
stat64("/usr/lib/perl5/5.10.0/i386-linux-thread-multi/auto/List/Util/Util.so", {st_mode=S_IFREG|0755, st_size=49080, ...}) = 0
stat64("/usr/lib/perl5/5.10.0/i386-linux-thread-multi/auto/List/Util/Util.bs", 0x9cec0c0) = -1 ENOENT (No such file or directory)
open("/usr/lib/perl5/5.10.0/i386-linux-thread-multi/auto/List/Util/Util.so", O_RDONLY) = 6
read(6, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\33\0\0004\0\0\0\250"..., 512) = 512
fstat64(6, {st_mode=S_IFREG|0755, st_size=49080, ...}) = 0
mmap2(NULL, 51896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0) = 0x39c000
mmap2(0x3a8000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0xb) = 0x3a8000
close(6)                                = 0
write(5, "Signal SEGV at /usr/local/lib/per"..., 369) = 369
kill(15845, SIGABRT)                    = 0
--- SIGABRT (Aborted) @ 0 (0) ---
+++ killed by SIGABRT +++




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: building on Fedora 11

Chuck Swiger-4
On Wed, 2009-11-18 at 11:21 -0500, Chuck Swiger wrote:
> On Wed, 2009-11-18 at 11:01 +0100, Luigi Ballabio wrote:
> > On Mon, 2009-11-16 at 15:42 -0500, Chuck Swiger wrote:
> > > Got QuantLib-SWIG to build and Python runs the examples ok but Perl stil
> > > segfaults.
> >
> > Yes, this has bugged me for a long time.  Do you think you can find some
> > time to try and debug it? (Or to reduce the error to a smaller,
> > self-contained example we can send to the SWIG mailing list?)

Ok - There seems to be a problem with, what you my call, 'embedded instantiation'.  Doing stuff like this:

   my($exercise) = new QuantLib::EuropeanExercise(
                                 new QuantLib::Date(17,$QuantLib::May, 1999));

or:

   $inst = new $Class1 ( new $Class2 )

By removing all of those, and fixing some function calls, it runs and produces the two answers, /then/ segfaults ;)

--Chuck

----------------------------------

[chuck@linux7 examples]$ ./european-option2.pl
analytic: 0.981572157109905
integral: 0.981572233014292
Segmentation fault


[chuck@linux7 examples]$ cat ./european-option2.pl
#!/usr/bin/perl

use QuantLib;
# use strict;
#
my($todaysDate) = new QuantLib::Date(15, $QuantLib::May, 1998);
QuantLib::Settings::instance()->setEvaluationDate($todaysDate);
my($settlementDate) = new QuantLib::Date(17, $QuantLib::May, 1998);

my($count1) = new QuantLib::Actual365Fixed;
my($riskFreeRate) = new QuantLib::FlatForward($settlementDate,
                                              0.05,
                                              $count1);

my($Ex_Date) = new QuantLib::Date(17,$QuantLib::May, 1999);
my($exercise) = new QuantLib::EuropeanExercise(
                                 $Ex_Date);
my($payoff) = new QuantLib::PlainVanillaPayoff($QuantLib::Option::Put, 8.0);

my($underlying) = new QuantLib::SimpleQuote(7.0);

my($cal) = new QuantLib::TARGET;
my($count2) = new QuantLib::Actual365Fixed;
my($volatility) = new QuantLib::BlackConstantVol($todaysDate,
                                                 $cal,
                                                 0.10,
                                                 $count2);

my($count3) = new QuantLib::Actual365Fixed;
my($dividendYield) = new QuantLib::FlatForward($settlementDate,
                                               0.05,
                                               $count3);

my($quote) = new QuantLib::QuoteHandle($underlying);
my($dividendYieldHandle) = new QuantLib::YieldTermStructureHandle($dividendYield);
my($riskFreeRateHandle) = new QuantLib::YieldTermStructureHandle($riskFreeRate);
my($volatilityHandle) = new QuantLib::BlackVolTermStructureHandle($volatility);
my($process) = new QuantLib::BlackScholesMertonProcess(
                      $quote,
                      $dividendYieldHandle,
                      $riskFreeRateHandle,
                      $volatilityHandle);

# removed $process from the following args
my($option) = new QuantLib::VanillaOption($payoff, $exercise);

# and added it here
$option->setPricingEngine(new QuantLib::AnalyticEuropeanEngine($process));
print "analytic: ", $option->NPV(), "\n";

$option->setPricingEngine(new QuantLib::IntegralEngine($process));
print "integral: ", $option->NPV(), "\n";




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: building on Fedora 11

Chuck Swiger-4
On Wed, 2009-11-18 at 17:16 -0500, Chuck Swiger wrote:

> On Wed, 2009-11-18 at 11:21 -0500, Chuck Swiger wrote:
> > On Wed, 2009-11-18 at 11:01 +0100, Luigi Ballabio wrote:
> > > On Mon, 2009-11-16 at 15:42 -0500, Chuck Swiger wrote:
> > > > Got QuantLib-SWIG to build and Python runs the examples ok but Perl stil
> > > > segfaults.
> > >
> > > Yes, this has bugged me for a long time.  Do you think you can find some
> > > time to try and debug it? (Or to reduce the error to a smaller,
> > > self-contained example we can send to the SWIG mailing list?)
>
> Ok - There seems to be a problem with, what you my call, 'embedded instantiation'.  Doing stuff like this:
>
>    my($exercise) = new QuantLib::EuropeanExercise(
>                                  new QuantLib::Date(17,$QuantLib::May, 1999));
>
> or:
>
>    $inst = new $Class1 ( new $Class2 )
>
> By removing all of those, and fixing some function calls, it runs and produces the two answers, /then/ segfaults ;)
>

and it'll do lots of useful calculations before the ungraceful exit:

--Chuck

------------------------------------------

...

# removed $process from the following args
my($option) = new QuantLib::VanillaOption($payoff, $exercise);

# and added it here
$option->setPricingEngine(new QuantLib::AnalyticEuropeanEngine($process));

%option_prices = ();

for ($price=7.5; $price<8.5; $price+=0.05) {
   $underlying->setValue($price);
   printf("Underlying: %4.2f \tanalytic: %f\n", $price,$option->NPV());
   $option_prices{$price} = $option->NPV();
}

print "\nCalculating IV from the option values\n";
for ($price=7.5; $price<8.5; $price+=0.05) {
   $underlying->setValue($price);
   printf("Underlying: %4.2f \tOption Price: %f \tVolatility: %f\n",$underlying->value(),$option_prices{$price},$option->impliedVolatility($option_prices{$price},$process))
}

print "\n";
$option->setPricingEngine(new QuantLib::IntegralEngine($process));
print "integral: ", $option->NPV(), "\n";

print "\n\nPrepare to crash!\n";




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: building on Fedora 11

Luigi Ballabio
In reply to this post by Chuck Swiger-4
On Wed, 2009-11-18 at 17:16 -0500, Chuck Swiger wrote:
> Ok - There seems to be a problem with, what you my call, 'embedded
> instantiation'.
> [...]
> By removing all of those, and fixing some function calls, it runs and
> produces the two answers, /then/ segfaults ;)

Well, it's a big improvement anyway.  I'll include that in version 1.0,
so that it is at least somewhat usable...

Thanks,
        Luigi


--

Vin: It's like this fellow I knew in El Paso. One day, he just took
all his clothes off and jumped in a mess of cactus. I asked him that
same question, "Why?"
Calvera: And?
Vin: He said, "It seemed like a good idea at the time."
-- The Magnificent Seven



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users