我遇到了一个链接库的问题。
我通过brew安装了它的一个版本,但后来我发现我需要在构建中添加环境标志:
CXXFLAGS="-stdlib=libstdc++ -mmacosx-version-min=10.6" \
LDFLAGS="-stdlib=libstdc++ -mmacosx-version-min=10.6"因此,我在opt/local/lib安装了另一个版本,它是使用这些标志构建的。我的问题是操作系统仍然在使用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发布于 2015-09-20 12:54:19
关于问题的后半部分,如何使用标志构建brew版本,您可以在安装函数中使用ENV.append在OSX上构建quantlib homebrew配方:
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"
endhttps://stackoverflow.com/questions/32487283
复制相似问题