Posted by
Norbert Irmer on
Apr 13, 2010; 1:51pm
URL: http://quantlib.414.s1.nabble.com/Quantlib-with-Sunstudio-12-1-on-Solaris-2-10-Sparc-tp13400p13402.html
Sunstudio is an IDE plus compiler (successor of Sun-Forte, -WorkshopPro, or
whatever names, this product ever had:). The IDE uses NetBeans, and the
Debugging is very professional, reliable and robust on Sparc platforms
(like in Visual Studio, KDevelop+GCC+GDB cannot compare to this!).
At first I used ./configure. After the first problems, i installed "libtool"
and "automake" and recreated the configure script, but I still had the same problems.
Afterwards i used "cmake" (we are using this for our own projects too, much easier
to work with than automake!). I simply extracted the source files via a python
script from the Visual Studio project, and included them in the cmake project,
which simply looks like this:
PROJECT( QuantLib CXX C )
ADD_DEFINITIONS( -mt -library=stlport4 )
SET( CMAKE_EXE_LINKER_FLAGS "-mt -library=stlport4" )
INCLUDE_DIRECTORIES( /opt/diii_foreign/include /home/nir/tmp/original/QuantLib-1.0 )
INCLUDE( sources.cmake )
ADD_LIBRARY( QuantLib SHARED ${SOURCES} )
(if you are interested, i can send the project files / python script to you).
The first error message with unresolved math symbols is:
/opt/diii_foreign/bin/cmake -E cmake_progress_report /home/nir/tmp/original/QuantBuild/CMakeFiles
[ 0%] Building CXX object CMakeFiles/QuantLib.dir/home/nir/tmp/original/QuantLib-1.0/ql/math/distributions/bivariatenormaldistribution.o
/opt/sunstudio12.1/bin/CC -DQuantLib_EXPORTS -KPIC -I/opt/diii_foreign/include -I/home/nir/tmp/original/QuantLib-1.0 -mt -library=stlport4 -o CMakeFiles/QuantLib.dir/home/nir/tmp/original/QuantLib-1.0/ql/math/distributions/bivariatenormaldistribution.o -c /home/nir/tmp/original/QuantLib-1.0/ql/math/distributions/bivariatenormaldistribution.cpp
"/home/nir/tmp/original/QuantLib-1.0/ql/math/array.hpp", line 593: Warning (Anachronism): Formal argument __x of type double(*)(double) in call to std::ptr_fun<double, double>(double(*)(double)) is being passed extern "C" double(*)(double).
"/home/nir/tmp/original/QuantLib-1.0/ql/math/array.hpp", line 600: Warning (Anachronism): Formal argument __x of type double(*)(double) in call to std::ptr_fun<double, double>(double(*)(double)) is being passed extern "C" double(*)(double).
"/home/nir/tmp/original/QuantLib-1.0/ql/math/array.hpp", line 607: Warning (Anachronism): Formal argument __x of type double(*)(double) in call to std::ptr_fun<double, double>(double(*)(double)) is being passed extern "C" double(*)(double).
"/home/nir/tmp/original/QuantLib-1.0/ql/math/array.hpp", line 614: Warning (Anachronism): Formal argument __x of type double(*)(double) in call to std::ptr_fun<double, double>(double(*)(double)) is being passed extern "C" double(*)(double).
"/home/nir/tmp/original/QuantLib-1.0/ql/math/distributions/bivariatenormaldistribution.cpp", line 85: Error: M_PI is not defined.
"/home/nir/tmp/original/QuantLib-1.0/ql/math/distributions/bivariatenormaldistribution.cpp", line 204: Error: M_PI is not defined.
"/home/nir/tmp/original/QuantLib-1.0/ql/math/distributions/bivariatenormaldistribution.cpp", line 239: Error: M_PI is not defined.
3 Error(s) and 4 Warning(s) detected.
*** Error code 3
The content of "bivariatenormaldistribution.cpp", line 85, is
result = std::sqrt(1.0 - rho_*rho_)/M_PI*sum;
The problem with "sqrt" etc. seems to arise only, where these functions are used without the "std::"
modifier (I think <cmath> simply includes math.h in namespace std). To find one of those locations again,
I simply unpacked quantlib-1.0.tar.gz and defined M_PI, M_PI_2 and M_LN2 on the compiler command line
to get past the undefined constant errors. The first location I found was:
/opt/diii_foreign/bin/cmake -E cmake_progress_report /home/nir/tmp/original/QuantBuild/CMakeFiles
[ 0%] Building CXX object CMakeFiles/QuantLib.dir/home/nir/tmp/original/QuantLib-1.0/ql/termstructures/inflation/seasonality.o
/opt/sunstudio12.1/bin/CC -DQuantLib_EXPORTS -KPIC -I/opt/diii_foreign/include -I/home/nir/tmp/original/QuantLib-1.0 -mt -library=stlport4 -DM_PI="3.14" -DM_PI_2="3.14/2.0" -DM_LN2="0.69" -o CMakeFiles/QuantLib.dir/home/nir/tmp/original/QuantLib-1.0/ql/termstructures/inflation/seasonality.o -c /home/nir/tmp/original/QuantLib-1.0/ql/termstructures/inflation/seasonality.cpp
"/home/nir/tmp/original/QuantLib-1.0/ql/termstructures/inflation/seasonality.cpp", line 84: Error: The function "fabs" must have a prototype.
"/home/nir/tmp/original/QuantLib-1.0/ql/termstructures/inflation/seasonality.cpp", line 151: Error: The function "abs" must have a prototype.
"/home/nir/tmp/original/QuantLib-1.0/ql/termstructures/inflation/seasonality.cpp", line 203: Error: The function "pow" must have a prototype.
3 Error(s) detected.
*** Error code 3
-----Ursprüngliche Nachricht-----
Von: Luigi Ballabio [mailto:
[hidden email]]
Gesendet: Dienstag, 13. April 2010 11:09
An: Norbert Irmer
Cc:
[hidden email]
Betreff: Re: [Quantlib-dev] Quantlib with Sunstudio 12.1 on Solaris 2.10/Sparc
On Fri, 2010-04-09 at 13:15 +0200, Norbert Irmer wrote:
> I finally solved my problems.
>
> I had 4 unresolved symbols.
>
> 3 were due to functions, which were declared and defined with
> different signatures, e.g.
Ok, I'll fix those for next release.
> As i previously wrote, when compiling Quantlib with Sunstudio i got a
> lot of undefined "M_PI", "sqrt" etc..
>
> I solved these by simply adding lots of "#include <math.h>" to the
> sources, perhaps this could be done more elegantly at a central
> location.
Strange. Does adding '#include <cmath>' work instead? Also, does the
compiler complain about 'sqrt' or 'std::sqrt'? May you send me the exact
message?
Finally, I'm not familiar with Sunstudio---is it just a set of compilers
or an IDE? That is, do you run './configure' and 'make' or what?
Thanks,
Luigi
--
Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away.
-- Antoine de Saint-Exupery
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev