2013-04-26 31 views
17

我正在使用运行OS X 10.8.3的Mac。我正在编译cgminer 3.0.0。在我的./configure第一次运行我得到的消息:如何为./configure指定LDFLAGS和CPPFLAGS?

​​3210

所以我使用自制安装了最新版本的libcurl的:

brew install curl 

似乎这样的伎俩。我得到这个消息:

downloaded: /Library/Caches/Homebrew/curl-7.30.0.tar.gz 
==> ./configure --prefix=/usr/local/Cellar/curl/7.30.0 
==> make install 
==> Caveats 
This formula is keg-only: so it was not symlinked into /usr/local. 

Mac OS X already provides this software and installing another version in 
parallel can cause all kinds of trouble. 

The libcurl provided by Leopard is too old for CouchDB to use. 

Generally there are no consequences of this for you. If you build your 
own software and it requires this formula, you'll need to add to your 
build variables: 

    LDFLAGS: -L/usr/local/opt/curl/lib 
    CPPFLAGS: -I/usr/local/opt/curl/include 

==> Summary 
/usr/local/Cellar/curl/7.30.0: 75 files, 2.0M, built in 61 seconds 

好了,所以它的安装而不是符号链接到/usr/local,这是我没意见。我尝试这样做:

export LDFLAGS=-L/usr/local/opt/curl/lib 
export CPPFLAGS=-I/usr/local/opt/curl/include 
./configure 

但我得到了同样的信息:configure: error: Missing required libcurl dev >= 7.18.2

所以,我想这一点:

env LDFLAGS=-L/usr/local/opt/curl/lib CPPFLAGS=-I/usr/local/opt/curl/include ./configure 

我仍然得到 “缺少必需的libcurl” 的消息。有任何想法吗?

+1

您是否尝试将环境变量的值放在引号中? – jepugs 2013-04-26 22:54:27

+0

@jepugs刚试过上面列出的使用单引号和双引号的两种方法。同样的结果。 – 2013-04-26 22:58:10

+0

有时配置文件在本地重新定义标志变量。如果你感觉冒险,你可以打开配置文件并编辑它来自己设置变量。寻找以'LDFLAGS ='和'CPPFLAGS ='开头的行,并在那里添加你的参数。 – jepugs 2013-04-26 23:01:38

回答

40

经过一些更彻底的调查后,我确定当测试libcurl时,cgminer的configure文件没有注意LDFLAGSCPPFLAGS。相反,它会检查LIBCURL_CFLAGSLIBCURL_LIBS。所以,我想:

export LIBCURL_CFLAGS=-I/usr/local/opt/curl/include 
export LIBCURL_LIBS=-L/usr/local/opt/curl/lib 
./configure 

和我:

checking for LIBCURL... yes 

而配置的其余部分进行得很顺利。成功!