lballabio / quantlib-old

The QuantLib C++ library and extensions (warning: out of date)
http://quantlib.org
471 stars 405 forks source link

Ruby SWIG - Errors on build #304

Closed curtgeen closed 7 years ago

curtgeen commented 9 years ago

Building the ruby version on mac osx 10.10.5:

Not sure if there's an error on my side or it's not compatible with the versions I'm using. To isolate the issue I installed the RQuantLib package for R and it works within R.

ruby setup.rb wrap

swig -ruby -c++ -I../SWIG -o ./quantlib_wrap.cpp quantlib.i
SWIG:1: Warning 125: Use of the include path to find the input file is deprecated and will not work with ccache. Please include the path when specifying the input file.

ruby setup.rb build

creating Makefile
compiling quantlib_wrap.cpp
quantlib_wrap.cpp:2652:6: error: using an old version of QuantLib, please update
    #error using an old version of QuantLib, please update
     ^
In file included from quantlib_wrap.cpp:2649:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/quantlib.hpp:47:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/all.hpp:35:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4035:59: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >'
    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                          ^
quantlib_wrap.cpp:8230:23: note: while substituting deduced template arguments
      into function template 'operator<<' [with _Expr =
      boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >]
                    s << (*self)[i][j];
                      ^
In file included from quantlib_wrap.cpp:2649:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/quantlib.hpp:47:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/all.hpp:35:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4036:46: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >'
               __scalar_expr<typename _Expr::value_type>, _Expr> >
                                             ^
quantlib_wrap.cpp:71997:13: error: no member named 'Israel' in namespace
      'QuantLib'
  QuantLib::Israel::Market arg1 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72000:13: error: no type named 'Israel' in namespace
      'QuantLib'
  QuantLib::Israel *result = 0 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72009:33: error: no member named 'Israel' in namespace
      'QuantLib'
  arg1 = static_cast< QuantLib::Israel::Market >(val1);
                      ~~~~~~~~~~^
quantlib_wrap.cpp:72012:27: error: no member named 'Israel' in namespace
      'QuantLib'
      result = (QuantLib::Israel *)new QuantLib::Israel(arg1);
                ~~~~~~~~~~^
quantlib_wrap.cpp:72012:35: error: expected expression
      result = (QuantLib::Israel *)new QuantLib::Israel(arg1);
                                  ^
quantlib_wrap.cpp:72047:13: error: no type named 'Israel' in namespace
      'QuantLib'
  QuantLib::Israel *result = 0 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72054:27: error: no member named 'Israel' in namespace
      'QuantLib'
      result = (QuantLib::Israel *)new QuantLib::Israel();
                ~~~~~~~~~~^
quantlib_wrap.cpp:72054:35: error: expected expression
      result = (QuantLib::Israel *)new QuantLib::Israel();
                                  ^
quantlib_wrap.cpp:72104:32: error: no type named 'Israel' in namespace
      'QuantLib'
free_QuantLib_Israel(QuantLib::Israel *arg1) {
                     ~~~~~~~~~~^
quantlib_wrap.cpp:72670:13: error: no type named 'Romania' in namespace
      'QuantLib'
  QuantLib::Romania *result = 0 ;
  ~~~~~~~~~~^
quantlib_wrap.cpp:72677:27: error: no member named 'Romania' in namespace
      'QuantLib'
      result = (QuantLib::Romania *)new QuantLib::Romania();
                ~~~~~~~~~~^
quantlib_wrap.cpp:72677:36: error: expected expression
      result = (QuantLib::Romania *)new QuantLib::Romania();
                                   ^
quantlib_wrap.cpp:72694:33: error: no type named 'Romania' in namespace
      'QuantLib'
free_QuantLib_Romania(QuantLib::Romania *arg1) {
                      ~~~~~~~~~~^
quantlib_wrap.cpp:274968:47: error: no member named 'Israel' in namespace
      'QuantLib'
    return (void *)((Calendar *)  ((QuantLib::Israel *) x));
                                    ~~~~~~~~~~^
quantlib_wrap.cpp:274968:55: error: expected expression
    return (void *)((Calendar *)  ((QuantLib::Israel *) x));
                                                      ^
quantlib_wrap.cpp:275037:47: error: no member named 'Romania' in namespace
      'QuantLib'
    return (void *)((Calendar *)  ((QuantLib::Romania *) x));
                                    ~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [quantlib_wrap.o] Error 1
lballabio commented 9 years ago

Are you using a QuantLib-SWIG release or a git checkout?

curtgeen commented 9 years ago

My bad on that. After cloning the correct version it's building but I'm still getting two errors. It seems that these are caused on mac osx 10.9 and 10.10 if you don't use the environment flags. The quantlib that's currently linked was installed via brew. I've searched for a solution but couldn't find it on either 1) how to get the brew installed version to use the environment flags; or 2) how to get the build process to use a different quantlib library where I did use the environment flags (at opt/local/lib). Sorry for the rookie questions, this is my first time trying to integrate a C library in ruby.

creating Makefile
compiling quantlib_wrap.cpp
In file included from quantlib_wrap.cpp:2647:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/quantlib.hpp:47:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/all.hpp:35:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4035:59: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >'
    __val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                          ^
quantlib_wrap.cpp:8228:23: note: while substituting deduced template arguments
      into function template 'operator<<' [with _Expr =
      boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >]
                    s << (*self)[i][j];
                      ^
In file included from quantlib_wrap.cpp:2647:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/quantlib.hpp:47:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/all.hpp:35:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/Cellar/quantlib/1.6.1/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4036:46: error: 
      'value_type' is a private member of
      'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double
      *> >'
               __scalar_expr<typename _Expr::value_type>, _Expr> >
                                             ^
2 errors generated.
make: *** [quantlib_wrap.o] Error 1
lballabio commented 9 years ago

This might help: http://superuser.com/questions/282450/where-do-i-set-dyld-library-path-on-mac-os-x-and-is-it-a-good-idea