Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
914 views
in Technique[技术] by (71.8m points)

ubuntu - How do I install curl with ares enabled

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 slowing down my app.

I've done apt-get install libc-ares2 but I'm not sure how to tell curl to use that library when doing a lookup.

I posted this question to AskUbuntu but was told it was probably better here..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you want installable .deb package instead of putting everything to /usr/local, do this:

sudo apt-get build-dep curl
sudo apt-get install libc-ares-dev build-essential
apt-get source curl
cd curl-*

This will download curl sources with Debian/Ubuntu build files and patches.

Edit file debian/control: add line libc-ares-dev to Build-Depends

Edit file debian/rules: remove --enable-threaded-resolver and add --enable-ares to CONFIGURE_ARGS

Optional: increase version number in the first line of debian/changelog, for example 7.38.0-4+deb8u5 to 7.38.0-4+deb8u6, this way your package will not get overwritten when you install updates to your system.

Now run command

dpkg-buildpackage -us -uc -b -j4

It will generate several .deb files after an unreasonably long compilation time, go drink coffee or something while it is compiling.

You can install your new curl with c-ares support using this command:

cd ..
sudo dpkg -i curl_*.deb libcurl3-*.deb libcurl4-openssl-dev*.deb

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...