1

The current version of raspbian stretch supports curl 7.52.1, however for an application I'm running I need curl 7.56 or above. How could I manually install the latest version of curl without breaking the linux distro by overwriting the version of curl it relies on?

For background, I know how to manually install curl:

wget https://curl.haxx.se/download/curl-7.64.1.tar.gz
tar -xvf curl-7.64.1.tar.gz
cd curl-7*
./configure
make
sudo make install

But this will overwrite the version of curl without overwriting libcurl, causing issues, for instance executing curl via the terminal will result in the error:

Symbol lookup error undefined symbol: curl_mime_init

Which is because curl_mime_init is defined in the latest version of curl but not in libcurl 7.52.

I will update the symlink in /usr/bin to point to the new installed version of curl:

sudo ln -sf /usr/bin/curl /usr/bin/curl752
sudo ln -sf /usr/local/bin/curl /usr/bin/curl

When I run curl --version after this I get the following output, still with the mime error:

curl 7.64.1 (armv7l-unknown-linux-gnueabihf) libcurl/7.52.1 OpenSSL/1.0.2l zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Release-Date: 2019-03-27

So curl is upgraded, but libcurl is still 7.52.1.... which is likely causing the failures.

5
  • 1
    Does ./configure default to --prefix=/usr/local? If it does have you considered renaming /usr/bin/curl to /usr/bin/curl752 and replacing it with a symbolic link ln -s /usr/local/bin/curl /usr/bin/curl to make your new version the default version.
    – Dougie
    Apr 17 '19 at 22:20
  • it does set the prefix. I hadn't but I just did this and the result was the same error, although now it is easy to turn back the error so I don't completely brick my raspberry pi. I'll update the main post with what error I see.
    – yodama
    Apr 17 '19 at 22:58
  • Looks like you're going to need to grab the latest tarball for libcurl and build that into /usr/local/lib.
    – Dougie
    Apr 17 '19 at 23:16
  • So what I don't understand is that if I get the tarball of curl, it should install libcurl, yes? Otherwise, could you point me in the direction of clear instructions to install a specific version of libcurl that isn't apt-get
    – yodama
    Apr 18 '19 at 0:02
  • askubuntu.com/a/329535
    – Dougie
    Apr 18 '19 at 7:50
1

There are multiple steps to pointing to a new version, one is installing the newer version of the curl. Here are the steps to install a newer version of CURL and to point to the newer version of the libcurl library.

  1. Download curl from source and unpack.
wget https://curl.haxx.se/download/curl-7.64.1.tar.gz
tar -xvf curl-7.64.1.tar.gz
cd curl-7.64.1
  1. Make curl, specifying a custom prefix during configuration.
export CURL_ROOT=~/curl_install
./configure --prefix=$CURL_ROOT
make -j
make install
  1. Finally, point to the new curl lib.
export LD_LIBRARY_PATH=$CURL_ROOT/lib/

Now, when you run the version of curl you have installed, you have to specifically point to it:

~/curl_install/bin/curl

If you just call curl, it will run the curl installed in the system.

NOTE: When doing this, you will now have a local copy of CURL in the curl_install directory, which is great so you aren't messing up the local version of curl (in case there are dependencies), however exporting the LD_LIBRARY_PATH variable will also change the library that the local version of CURL points to. If you need to have the other version of CURL used again, just point the LD_LIBRARY_PATH back to the old curl lib:

export LD_LIBRARY_PATH="usr/local/lib"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.