我遇到了链接库的问题。
我通过brew安装了它的一个版本但我后来发现我需要在构建中添加环境标志:
CXXFLAGS="-stdlib=libstdc++ -mmacosx-version-min=10.6" \
LDFLAGS="-stdlib=libstdc++ -mmacosx-version-min=10.6"
所以我在opt / local / lib上安装了另一个使用flags构建的版本。我的问题是操作系统仍在使用brew安装版本。我已经搜索过,但无法找到如何将os链接到正确构建的库或使用标记构建brew版本。
我认为这是问题的原因是,当为ruby构建quantlib-swig时,我得到以下错误,一些论坛说这些错误与环境标志有关:
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
答案 0 :(得分:0)
关于问题的后半部分,如何使用标志构建brew版本,您可以在安装函数中使用ENV.append
在OSX上构建quantlib自制软件:
def install
...
if MacOS.version >= :mavericks && ENV.compiler == :clang
ENV.append "CXXFLAGS", "-stdlib=libstdc++ -mmacosx-version-min=10.6"
ENV.append "LDFLAGS", "-stdlib=libstdc++ -mmacosx-version-min=10.6"
end
...
system "make", "install"
end