New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building curl with c-ares via pkgconfig #2203

Closed
pszemus opened this Issue Dec 29, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@pszemus

pszemus commented Dec 29, 2017

I did this

PKG_CONFIG_PATH=/opt/WP/common.libs/lib/pkgconfig ./configure --enable-ares

I expected the following

curl will build

what happened

configure script exited with error:

checking that c-ares is good and recent enough... no
configure: error: c-ares library defective or too old

config.log:

configure:40149: checking that c-ares is good and recent enough
configure:40176: gcc -o conftest -Werror-implicit-function-declaration -O2 -Wno-system-headers         conftest.c -lcares -lz  >&5
conftest.c:257:18: fatal error: ares.h: No such file or directory
 #include <ares.h>
                  ^
compilation terminated.

ares.h was not found
c-ares is not installed in default install path, because it was built with --prefix but pkgconfig should deliver that custom path, because libcares.pc includes includedir=/opt/WP/common.libs/include:

# cat /opt/WP/common.libs/lib/pkgconfig/libcares.pc 
#***************************************************************************
# Project        ___       __ _ _ __ ___  ___ 
#               / __|____ / _` | '__/ _ \/ __|
#              | (_|_____| (_| | | |  __/\__ \
#               \___|     \__,_|_|  \___||___/
#
prefix=/opt/WP/common.libs
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: c-ares
URL: http://daniel.haxx.se/projects/c-ares/
Description: asynchronous DNS lookup library
Version: -
Requires: 
Requires.private: 
Cflags: -I${includedir} -DCARES_STATICLIB
Libs: -L${libdir} -lcares
Libs.private:

and to confirm that ares.h exists in that path:

# ll /opt/WP/common.libs/include/ares.h
-rw-r--r-- 1 root root 23253 Nov 29 14:01 /opt/WP/common.libs/include/ares.h

It's not a critical issue, because I can build curl with:

CPPFLAGS=-I/opt/WP/common.libs/include LDFLAGS=-L/opt/WP/common.libs/lib ./configure --enable-ares

(config.log then looks like this:)

configure:40149: checking that c-ares is good and recent enough
configure:40176: gcc -o conftest -Werror-implicit-function-declaration -O2 -Wno-system-headers -isystem /opt/WP/common.libs/include    -L/opt/WP/common.libs/lib    conftest.c -lcares -lz  >&5
configure:40176: $? = 0
configure:40178: result: yes

but I'd like to use pkgconfig in the future.

operating system

curl-7.56.1
c-ares-1.13.0
CentOS Linux release 7.4.1708 (Core)

@pszemus

This comment has been minimized.

Show comment
Hide comment
@pszemus

pszemus Jan 2, 2018

I've figured out another way of doing this:
PKG_CONFIG="pkg-config --static" PKG_CONFIG_PATH=/opt/WP/common.libs/lib/pkgconfig ./configure --enable-ares
outputs:

checking that c-ares is good and recent enough... yes
(...)
configure: Configured to build curl/libcurl:

  curl version:     7.56.1
  (...)
  resolver:         c-ares

Is it the preferable way?

pszemus commented Jan 2, 2018

I've figured out another way of doing this:
PKG_CONFIG="pkg-config --static" PKG_CONFIG_PATH=/opt/WP/common.libs/lib/pkgconfig ./configure --enable-ares
outputs:

checking that c-ares is good and recent enough... yes
(...)
configure: Configured to build curl/libcurl:

  curl version:     7.56.1
  (...)
  resolver:         c-ares

Is it the preferable way?

@bagder bagder added the build label Jan 3, 2018

bagder added a commit that referenced this issue Jun 14, 2018

configure: use pkg-config for c-ares detection
First check if there's c-ares information given as pkg-config info and use
that as first preference.

Fixes #2203
@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Jun 14, 2018

Member

I could repro and then fixed it with #2658.

Member

bagder commented Jun 14, 2018

I could repro and then fixed it with #2658.

@bagder bagder closed this in ed224f2 Jun 14, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Sep 12, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.