Skip to content

Error building curl with c-ares via pkgconfig #2203

@pszemus

Description

@pszemus

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions