How do I install curl with ares enabled

后端 未结 3 1468
萌比男神i
萌比男神i 2021-01-12 01:56

I have curl installed on the latest ubuntu via apt-get and that works fine, however I\'ve been reading about the blocking nature of the DNS lookups and discovered that it\'s

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-12 02:20

    You need to install ares separately. You can download it here. Once downloaded, build c-ares (where current working directory is "c-ares-${VERSION}"):

    cd /path/to/c-ares-${VERSION}
    ./configure --prefix=/destination/path/for/ares/install (NOTE: if you specify a destination directory, it must exist already! If you don't specify a prefix, content should be install at location /usr/local/include/)
    make
    make install
    

    following this

    Now that ares is built, you can build libcurl using ares. I had an issue referencing ares so I had to copy the ares source directly into libcurl. To do this, rename the 'include' directory created by 'make install' from configuring ares to 'ares'. Then, copy this directory to libcurl's root directory. You can now build libcurl with the ares option (where current working directory is libcurl):

    cd /path/to/libcurl
    ./configure --enable-ares
    

    Full example:

    cd /User/${USER}/c-ares-1.10.0
    mkdir installation
    make clean
    ./configure --prefix=/User/${USER}/c-ares-1.10.0/installation
    make
    make install
    mv installation/include installation/ares
    cp installation/ares /User/${USER}/libcurl/
    cd /User/${USER}/libcurl/
    ./configure --enable-ares
    make
    make install
    

    EDIT (6/30/2015):

    Know that if you're cross-compiling libcurl, you need to cross-compile c-ares with the same cross-compiler settings (--host option).

    Hope this helps!

提交回复
热议问题