Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify LDFLAGS and CPPFLAGS for ./configure?

Tags:

I am using a Mac running OS X 10.8.3. I am trying to compile cgminer 3.0.0. On my first run of ./configure I got the message:

checking for LIBCURL... no checking for LIBCURL... no configure: error: Missing required libcurl dev >= 7.18.2 

So I installed the latest version of libcurl using homebrew:

brew install curl 

That seemed to do the trick. I got this message:

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 

Okay, so it's installed but not symlinked into /usr/local, that's fine with me. I tried this:

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

But I got the same message: configure: error: Missing required libcurl dev >= 7.18.2

So I tried this:

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

I'm still getting the "missing required libcurl" message. Any ideas?

like image 652
Ben Harold Avatar asked Apr 26 '13 22:04

Ben Harold


People also ask

What is CFLAGS and Ldflags?

The make-specific variables (the ones in capital letters) follow a name convention such that: CC refers to the compiler (gcc in this case); CFLAGS contains compiler directives/options; and LDFLAGS is a list of link (or "load") directives (here, instructions to link with the C math library).

How do I add paths to Ldflags?

LDFLAGS are a convention with a C compiler for flags that should be passed to the loader part. In your case, you're most likely going to want to add something like -L/usr/local/lib (or wheverer GMP got put... I would expect you can probably figure it out by searching for libgmp.

How do I add CFLAGS in Makefile?

It should be CFLAGS := -Wall -Wextra $(CFLAGS) , the difference is that CFLAGS is explicitly appended. So for example, you may set -Og , but user don't want optimization and passes CFLAGS=-O0 on command line. By using CFLAGS += -Og your -Og will take over the user provided value.


1 Answers

After some more thorough investigation, I determined that the configure file for cgminer does not pay attention to LDFLAGS or CPPFLAGS when testing for libcurl. Instead, it checks for LIBCURL_CFLAGS and LIBCURL_LIBS. So, I tried:

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

and I got:

checking for LIBCURL... yes 

And the rest of the configuration went off without a hitch. SUCCESS!

like image 125
Ben Harold Avatar answered Sep 20 '22 07:09

Ben Harold