Compilation and Installation QuantLib 0.3.11

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

Compilation and Installation QuantLib 0.3.11

L.Isella
n Tue, 2006-01-24 at 15:20 -0600, Dirk Eddelbuettel wrote:
It is something in the date calcs that must have gotten fixed since 0.3.9.

>
> If we forward the dates from 1998/1999 to 2006/2007, it all works:
>
> edd@joe:~$ grep 200 euopt.cpp
>   Date todaysDate(15, May, 2006);
>   Date settlementDate(17, May, 2006), exerciseDate(17, May, 2007);
> edd@joe:~$ g++ -o euopt euopt.cpp -lQuantLib
> edd@joe:~$ ./euopt
> Black-Scholes value: 0.0823425
>
> even on the Ubuntu system with the older 0.3.9 library.
>
> Dirk


Alright, this seems to be to a good explanation of what I have seen. A small bug in Ubuntu must be the solution.
However, frustrated by what was going on, I downloaded version 0.3.11 from sourceforge.net and I installed it by:
./configure
make
sudo make install

Some waiting time, tons of output and finally;

Libraries have been installed in:
   /usr/local/lib

where allegedly g++ should be able to see them.
I reverted to the code in the previous email by compiling and running it:

lorenzo@mypc:~/Temp$ g++ -o simple simple-option.cc -lQuantLib
lorenzo@mypc:~/Temp$ ./simple
./simple: error while loading shared libraries: libQuantLib-0.3.11.so: cannot open shared object file: No such file or directory


But shouldn't g++ be able to see it if I do not toy with the installation directory by making some non-standard choices?

Best regards

Lorenzo



Reply | Threaded
Open this post in threaded view
|

Re: Compilation and Installation QuantLib 0.3.11

Fred Nastos
On Tuesday 24 January 2006 17:14, L.Isella wrote:
> lorenzo@mypc:~/Temp$ g++ -o simple simple-option.cc -lQuantLib
> lorenzo@mypc:~/Temp$ ./simple
> ./simple: error while loading shared libraries: libQuantLib-0.3.11.so:
> cannot open shared object file: No such file or directory
>
> But shouldn't g++ be able to see it if I do not toy with the installation
> directory by making some non-standard choices?

What happens if you link by hand, like so

]$ g++ simple-option.cc /usr/local/lib/libQuantLib.a


Reply | Threaded
Open this post in threaded view
|

Re: Compilation and Installation QuantLib 0.3.11

eric ehlers
In reply to this post by L.Isella
Hi Lorenzo

> However, frustrated by what was going on, I downloaded version 0.3.11 from sourceforge.net and I installed it by:
> ./configure
> make
> sudo make install
>
> Some waiting time, tons of output and finally;
>
> Libraries have been installed in:
>    /usr/local/lib
>
> where allegedly g++ should be able to see them.
> I reverted to the code in the previous email by compiling and running it:
>
> lorenzo@mypc:~/Temp$ g++ -o simple simple-option.cc -lQuantLib
> lorenzo@mypc:~/Temp$ ./simple
> ./simple: error while loading shared libraries: libQuantLib-0.3.11.so: cannot open shared object file: No such file or directory
>
>
> But shouldn't g++ be able to see it if I do not toy with the installation directory by making some non-standard choices?

Your output above indicates that the program compiled and linked
successfully which would mean that g++ does see the QuantLib library.

When you attempt to launch the executable you get a message about
loading, meaning that it's the loader which fails to find the library.
 Please try:

su
ldconfig
exit
export $LD_LIBRARY_PATH=/usr/local/lib
./simple

(The export command is probably unnecessary depending on the
particulars of your linux distro but it won't hurt).

Regards,
Eric


Reply | Threaded
Open this post in threaded view
|

Re: Compilation and Installation QuantLib 0.3.11

eric ehlers
Oops that should be

> export $LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib


Reply | Threaded
Open this post in threaded view
|

Re: Compilation and Installation QuantLib 0.3.11

L.Isella
In reply to this post by L.Isella
On Wed, 2006-01-25 at 10:02 +0000, eric ehlers wrote:
export $LD_LIBRARY_PATH=/usr/local/lib
>
I did as you suggest.
This way, g++ correctly sees the 0.3.11 QuantLib version and everything goes fine, but if I copy the file into another directory, well, I have to go through this again.
In particular, the command:
sudo ldconfig

simply returns the prompt to me (as far as I can see, I do not know what it does in detail), so there is no need of the exit command (which closes the console).

I also tried:

g++ simple-option.cc /usr/local/lib/libQuantLib.a
lorenzo@mypc:~/Temp$ ./a.out
0.3.11
Black-Scholes value: 0.0823425

So, apart from the funny thing that my system does not remember the location of the quantlib library, I can finally get it working.
It is not too much of a hassle to give the library path and I can now use it inside my IDE.
Thanks a lot.

Lorenzo





Reply | Threaded
Open this post in threaded view
|

Re: Compilation and Installation QuantLib 0.3.11

eric ehlers
Hi Lorenzo

> On Wed, 2006-01-25 at 10:02 +0000, eric ehlers wrote:
> export $LD_LIBRARY_PATH=/usr/local/lib
> >
> I did as you suggest.
> This way, g++ correctly sees the 0.3.11 QuantLib version and everything goes fine, but if I
> copy the file into another directory, well, I have to go through this again.

Yes.  If you move the lib, you have to inform your loader of the new
location, no way around that.  In any case LD_LIBRARY_PATH is not the
most robust way of specifying the location - e.g. you can edit
/etc/ld.so.conf - here's the doc to read:

http://www.dwheeler.com/program-library/Program-Library-HOWTO/index.html

> In particular, the command:
> sudo ldconfig
>
> simply returns the prompt to me (as far as I can see, I do not know what it does in detail),
> so there is no need of the exit command (which closes the console).

Well, I suggested ...

su
ldconfig
exit

... in which case exit returns you from su to your normal login.  But
happily your system is set up for 'sudo ldconfig' which replaces the
above and is preferable.

ldconfig refreshes the cache for the run-time linker.  It's only
necessary when you install a library to a new location and you haven't
yet rebooted.

> Thanks a lot.

My pleasure!

Regards,
Eric


Reply | Threaded
Open this post in threaded view
|

Re: Compilation and Installation QuantLib 0.3.11

Luigi Ballabio
In reply to this post by L.Isella
On Jan 25, 2006, at 2:45 PM, L.Isella wrote:
> lorenzo@mypc:~/Temp$ ./a.out
> 0.3.11
> Black-Scholes value: 0.0823425
>
> So, apart from the funny thing that my system does not remember the
> location of the quantlib library, I can finally get it working.

By the way, I reproduced the error in 0.3.9, so it must have been some
bug in that version.
As you correctly inferred, the solution is to upgrade :)

Later,
        Luigi