在 MacOS Big Sur 上安装 QuantLib 时出现问题:./configure 找不到 boost 头文件/库

时间:2020-12-20 20:04:32

标签: boost quantlib macos-big-sur

您好 QuantLib 用户,

我正在尝试在运行 Big Sur 的 iMac 上安装 QuantLib,遵循以下(有些过时?)步骤:https://www.quantlib.org/install/macosx.shtml

问题

尽管安装了 boost,我还是收到以下错误:

checking for Boost development files... no
configure: error: Boost development files not found

有人知道我为什么会得到这个吗?

背景

我运行了 brew install boost,并验证了

  • /usr/local/lib 下是 boost 库文件,例如 libboost_chrono-mt.a 符号链接到 ../Cellar/boost/1.75.0/lib/ 中的某个位置
  • 符号链接 /usr/local/include/boost 指向 /usr/local/Cellar/boost/1.75.0/include/boost 中的头文件

我运行的配置命令是:

./configure --disable-shared --with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/ --prefix=/usr/local/ CXXFLAGS='-O3 -stdlib=libc++ -mmacosx-version-min=11’ LDFLAGS='-stdlib=libc++’

可以肯定的是,我也运行了以下代码,但得到了同样的错误:

./configure --disable-shared --with-boost-include=/usr/local/Cellar/boost/1.75.0/include/ --with-boost-lib=/usr/local/Cellar/boost/1.75.0/lib/ --prefix=/usr/local/ CXXFLAGS='-O3 -stdlib=libc++ -mmacosx-version-min=11’ LDFLAGS='-stdlib=libc++’

提前感谢任何洞察!!!

############### 在下面回复 Luigi 的建议 ################

我按照你的建议查看了 config.log,有很多失败,但没有提到 boost

第一个是:

#1

configure:4324: g++ -c -O3 -stdlib=libc++ -mmacosx-version-min=11’ LDFLAGS=-stdlib=libc++’  -I/usr/local/include conftest.cpp >&5
clang: error: no such file or directory: 'LDFLAGS=-stdlib=libc++’'
clang: error: invalid version number in '-mmacosx-version-min=11’'
configure:4324: $? = 1

这 --> 来自我对 Big Sur 所需的原始指令的修改可能不正确的猜测(顺便说一句,知道正确的修改应该是什么吗?)

还有 3 种类型的失败(每种都会重复),它们是:

#2

configure:4290: g++ -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:4301: $? = 1

#3

configure:4604: gcc -E  -I/usr/local/include conftest.c
conftest.c:11:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.
configure:4604: $? = 1

#4

configure:6395: ar cru libconftest.a @conftest.lst >&5
ar: @conftest.lst: No such file or directory
configure:6398: $? = 1

这些有没有给你一个线索?

1 个答案:

答案 0 :(得分:0)

如果您完全按照您在问题中复制的方式运行配置命令,即

./configure --disable-shared --with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/ --prefix=/usr/local/ CXXFLAGS='-O3 -stdlib=libc++ -mmacosx-version-min=11’ LDFLAGS='-stdlib=libc++’

您用 CXXFLAGS 而不是 关闭了应该是 ' 的内容。这意味着它并没有真正关闭,而是运行到下一个 ';您可以在上面的格式中看到,它以绿色显示字符串。应该关闭 LDFLAGS 也是如此。相反,使用

./configure --disable-shared --with-boost-include=/usr/local/include/ --with-boost-lib=/usr/local/lib/ --prefix=/usr/local/ CXXFLAGS='-O3 -stdlib=libc++ -mmacosx-version-min=11' LDFLAGS='-stdlib=libc++'

现在,为了确保这对其他人来说不是问题:我已经检查了 QuantLib 站点,那里的命令似乎是正确的。我猜您的浏览器或编辑器试图对引号进行一些花哨的格式化。如果您写下如何将命令从指令复制到终端,这将很有用,因此我们可以对此发出警告。谢谢!