简体   繁体   English

如何在Mac OS X 10.9.5上构建QuantLib

[英]How to build QuantLib on mac os x 10.9.5

So far I'm unable to build QuantLib 1.5 on os x 10.9.5 following the official instructions http://quantlib.org/install/macosx.shtml 到目前为止,我无法按照官方说明http://quantlib.org/install/macosx.shtml在os x 10.9.5上构建QuantLib 1.5

./configure --enable-static --with-boost-include=/opt/local/include/ \
        --with-boost-lib=/opt/local/lib/ --prefix=/opt/local/ \
        CXXFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6" \
        LDFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6"

configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type:  
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gawk... (cached) awk
checking for -gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `~/Downloads/qlib/QuantLib-1.5':
configure: error: C compiler cannot create executables
See `config.log' for more details

$ make && sudo make install
make: *** No targets specified and no makefile found.  Stop.

So what may be wrong? 那怎么可能出问题了? And how can I fix it? 我该如何解决?

Here is an excerpt from Config log: 这是Config日志的摘录:

## ----------- ##
## Core tests. ##
## ----------- ##

configure:2416: checking for a BSD-compatible install
configure:2484: result: /usr/bin/install -c
configure:2495: checking whether build environment is sane
configure:2550: result: yes
configure:2701: checking for a thread-safe mkdir -p
configure:2740: result: config/install-sh -c -d
configure:2747: checking for gawk
configure:2777: result: no
configure:2747: checking for mawk
configure:2777: result: no
configure:2747: checking for nawk
configure:2777: result: no
configure:2747: checking for awk
configure:2763: found /usr/bin/awk
configure:2774: result: awk
configure:2785: checking whether make sets $(MAKE)
configure:2807: result: yes
configure:2836: checking whether make supports nested variables
configure:2853: result: yes
configure:2987: checking for gawk
configure:3014: result: awk
configure:3069: checking for -gcc
configure:3099: result: no
configure:3109: checking for gcc
configure:3125: found /usr/bin/gcc
configure:3136: result: gcc
configure:3365: checking for C compiler version
configure:3374: gcc --version >&5
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
configure:3385: $? = 0
configure:3374: gcc -v >&5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
configure:3385: $? = 0
configure:3374: gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3385: $? = 1
configure:3374: gcc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:3385: $? = 1
configure:3405: checking whether the C compiler works
configure:3427: gcc   -I/opt/local/include -stlib=libstdc++ -mmacosx-version-min=10.6 -L/opt/local/lib conftest.c  >&5
clang: error: unknown argument: '-stlib=libstdc++'
configure:3431: $? = 1
configure:3469: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "QuantLib"
| #define PACKAGE_TARNAME "QuantLib"
| #define PACKAGE_VERSION "1.5"
| #define PACKAGE_STRING "QuantLib 1.5"
| #define PACKAGE_BUGREPORT "quantlib-dev@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define PACKAGE "QuantLib"
| #define VERSION "1.5"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3474: error: in `~/Downloads/qlib/QuantLib-1.5':
configure:3476: error: C compiler cannot create executables
See `config.log' for more details

If you have this problem 如果你有这个问题

checking whether the C compiler works... no

It means that you have not installed the command line tools properly for your Xcode. 这意味着您没有为Xcode正确安装命令行工具。 Please download and install it. 请下载并安装它。

Your clue is in the config.log: "clang: error: unknown argument: '-stlib=libstdc++' " 您的线索位于config.log中:“ c声:错误:未知参数:'-stlib = libstdc ++'”

change -stlib to -stdlib, it should compile and build. 将-stlib更改为-stdlib,应进行编译和构建。

See this related answer on how to configure gcc. 有关如何配置gcc的信息,请参见此相关答案。 The reason is, like me, you probably installed GCC with homebrew or something, therefore not using Apple's default. 原因是和我一样,您可能在GCC上安装了自制软件或其他软件,因此未使用Apple的默认设置。

I installed GCC 5.3 with homebrew. 我用自制软件安装了GCC 5.3。

Worked for me by just taking out -stdlib option all together. 通过一起删除-stdlib选项为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM