DEV Community

Jake Casto
Jake Casto

Posted on

Using libcurl3 and libcurl4 on Ubuntu 18.04 (Bionic)

image

I'm sure many of us have needed to run libcurl3 and libcurl4 on Ubuntu 18 for some reason at any point in time.

On Ubuntu 18.04 (Bionic) libcurl3 and libcurl4 cannot coexist. Many third party packages, libraries, etc require libcurl3 while curl itself requires libcurl4.

Please note, this solution is only for precompiled commands (and potentially binaries, not tested). This was tested on a C# binary.

First you'll need to get a copy of libcurl3 and save it to your /usr/lib directory. You can do that by running:

$ sudo apt-get install libcurl3 -y
$ cp /usr/lib/x86_64-linux-gnu/libcurl.so.3 /usr/lib/
Enter fullscreen mode Exit fullscreen mode

Then remove libcurl3 and reinstall libcurl4:

$ sudo apt-get install libcurl4 libcurl4-openssl-dev -y
Enter fullscreen mode Exit fullscreen mode

Finally prepend env LD_PRELOAD=/usr/lib/libcurl.so.3 to any commands that require libcurl3.

Top comments (13)

Collapse
 
ahukkanen profile image
Antti Hukkanen

I'd also like to add here that it is not necessary to install the libcurl3 package since you can just download it and extract the .so-file you need from there.

This is what I eventually did:

$ mkdir ~/libcurl3 && cd ~/libcurl3
$ apt-get download -o=dir::cache=~/libcurl3 libcurl3
$ ar x libcurl3* data.tar.xz
$ tar xf data.tar.xz
$ cp -L ~/libcurl3/usr/lib/x86_64-linux-gnu/libcurl.so.4 /usr/lib/libcurl.so.3
$ cd && rm -rf ~/libcurl3

What it does:

  • Create a temporary libcurl3 directory in your home path and go there
  • Download the libcurl3 package to the newly created folder
  • Extract a file named data.tar.xz from that package archive
  • Extract the data.tar.xz file to the current folder
  • Copy the referenced file of the libcurl.so.4 symlink to /usr/lib/libcurl.so.3 (don't mind the .4 suffix, as noted it is actually version 3)
  • Go back home and remove the temporary directory from your home path
Collapse
 
swiftwinds profile image
SwiftWinds

After installing libcurl3, /usr/lib/x86_64-linux-gnu/libcurl.so.3 still did not exist

Collapse
 
ahukkanen profile image
Antti Hukkanen

I believe they have just changed the file name as you can see from the libcurl3 package details:
packages.ubuntu.com/bionic/amd64/l...

As confusing as it is, the file is actually named libcurl.so.4.5.0. So, after installing libcurl3, this should work:

$ cp /usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0 /usr/lib/libcurl.so.3

After that, follow the advice in the original post.

Collapse
 
jake profile image
Jake Casto

It may be a system specific issue, run the find command to locate it.

Collapse
 
izzyb_brah profile image
Izzy B

Happened to me as well, ubuntu 18.04. I'm looking in the /usr/lib directory and the best I got is libcurl-gnutls.so.3

Thread Thread
 
jake profile image
Jake Casto

Hmmm that’s strange, try searching globally for libcurl*.so?

Collapse
 
ribbreaker97 profile image
WITH HATS ON

Interestingly enough, there was a libcurl.so.4 in /usr/lib/x86_64-linux-gnu/. Moving that to usr/lib/ and then installing libcurl4 enabled me to run both libcurl3 and libcurl4 programs. Confusing naming convention to be honest :/

Collapse
 
jake profile image
Jake Casto

Weird (but glad it worked for you) and I agree, it’s totally weird.

Collapse
 
lin4fun profile image
Thomas

Found this at github.com/adobe/brackets/issues/1...
Looks like better solution..

"I just fixed it but had to rebuild the deb package.

Download the .deb installer file
Inside the folder your downloaded the file run dpkg-deb -R ./Brackets.Release.1.12.64-bit.deb Brackets
Edit file Brackets/DEBIAN/control and replace libcurl3 with libcurl4
Rebuild .deb installer running dpkg-deb -b Brackets Brackets-fixed.deb
Install Brackets using the fixed installer running sudo dpkg -i Brackets-fixed.deb
At least the program opens. Don't know if there's anything broken though."

Collapse
 
mafh profile image
Alexandr

I have my liburl3 at /home/user/libcurl.so.3

Getting "The following packages have unmet dependencies: google-chrome-stable : Depends: libcurl3 but it is not going to be installed" with

sudo env LD_PRELOAD=/home/user/libcurl.so.3
sudo apt install ./chrome64_52.0.2743.116.deb

or

sudo env LD_PRELOAD=/home/user/libcurl.so.3 apt install ./chrome64_52.0.2743.116.deb

Any ideas?

Collapse
 
jake profile image
Jake Casto

You’ll have to download manually download the Chrome binary. It doesn’t work with apt commands.

Collapse
 
bozeyman9000 profile image
bozeyman9000 • Edited

any hope or any other info about running both of these simutaneously? The reason being is i want to use both steam and runescape on my linux machine. seems like ill probably be "installing" libcurl3 into a different folder then rerouting runescape to use that folder? To which i would have to ask, where would i find the code to edit such a task?

Collapse
 
david_j_eddy profile image
David J Eddy

Helpful, thank you!