Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcurl not included in ubuntu-latest software #37

Closed
1 of 5 tasks
iMacTia opened this issue Oct 14, 2019 · 11 comments
Closed
1 of 5 tasks

libcurl not included in ubuntu-latest software #37

iMacTia opened this issue Oct 14, 2019 · 11 comments

Comments

@iMacTia
Copy link

iMacTia commented Oct 14, 2019

Describe the bug
This article lists libcurl between the available software for ubuntu-latest, however installing the Patron ruby gem fails with Can't find libcurl or curl/curl.h (RuntimeError).

Virtual environments affected

  • macOS 10.14
  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Windows Server 2016 R2
  • Windows Server 2019

Expected behavior
It should be possible to install the patron gem without first installing any other dependency (apart from bundler).

Actual behavior
Installation of Patron ruby gem fails with Can't find libcurl or curl/curl.h (RuntimeError).
Adding sudo apt-get install libcurl4-openssl-dev to the step fixes the issue, but it should not be necessary.

Workflow job:

  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby: [2.3.x, 2.4.x, 2.5.x, 2.6.x]
    steps:
    - uses: actions/checkout@v1
    - name: Install dependencies
      run: |
        sudo apt-get install libcurl4-openssl-dev
    - name: Set up Ruby
      uses: actions/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
    - name: Build
      run: |
        gem install bundler
        bundle install --jobs 4 --retry 3

Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'

group :test do
  gem 'patron', '>= 0.4.2'
end
@ethomson
Copy link

This article lists libcurl between the available software for ubuntu-latest, however installing the Patron ruby gem fails with Can't find libcurl or curl/curl.h (RuntimeError).

This seems correct. libcurl is documented as being installed, and is installed. We don't document that the development headers are installed, and indeed, they are not.

Your apt-get install ... step seems expected and correct to me?

@iMacTia
Copy link
Author

iMacTia commented Oct 15, 2019

Hi @ethomson thanks for getting back to me.
I may be confusing one thing for another as I'm not the expert with cURL, but my understanding is that curl and libcurl are two completely different things (see this page).

Now, my understanding of the Patron gem is that the latter, libcurl, is necessary as it contains the development libraries, not the Command Line tool (curl).

When you say

libcurl is documented as being installed, and is installed

are you sure you're referring to the development libraries? Or are you referring to the command line tool to make requests?
If libcurl is actually installed as you say, is there another reason you could think of that may cause this?
I can only think of:

  1. I'm installing something else with my command (a third, different thing?!), although my understanding is that I'm installing libcurl (dev libraries) with my command.
  2. libcurl is actually installed, but for some reason gem can't access it while installing Patron; that may be due to permissions or the PATH not set correctly?

@ethomson
Copy link

I may be confusing one thing for another as I'm not the expert with cURL, but my understanding is that curl and libcurl are two completely different things (see this page).

Yes, this is 100% correct, they are different things. However, many Linux distributions split up the distribution of libraries into two different packages:

  1. The compiled library itself (in this case libcurl). This is libcurl-1.2.3.so (where 1.2.3 is the actual version number installed). This allows programs that were compiled against libcurl to use it. So it's useful if you're installing some application (git, for instance) that was linked against libcurl to be able to use it.

  2. The "development headers" for the library (in this case, libcurl-dev). These are the header files (eg curl.h) that allows other developers to build and link against libcurl.

So libcurl itself is operational and usable when only the libcurl package is installed, but you can't build applications against it until you also install libcurl-dev. This is basically the default for Debian-based distributions, to avoid having a lot of header files that you don't need.

(Note that I simplified a little in calling this libcurl-dev. What I described is actually the general case for how things operate in Debian-based distributions. Curl itself is a particularly difficult package to wrangle here since it has so many different variants. You mentioned that you installed libcurl4-openssl-dev - there are other versions of curl that are available for other crypto providers (eg gnuTLS), so you actually have to decide which curl implementation you want.)

@iMacTia
Copy link
Author

iMacTia commented Oct 15, 2019

I see, that was really insightful, thank you @ethomson.
Hopefully this chat can be useful in future to other people with my same doubts 😃.
I'll close the issue then as it seems I'm already doing the correct thing anyway in this case.

Thanks for the clarification!

@iMacTia iMacTia closed this as completed Oct 15, 2019
@ethomson
Copy link

Thanks @iMacTia! 😁 Let us know if you have any other questions or concerns.

@mxcl
Copy link

mxcl commented May 25, 2020

Since installing libcurl-openssl-dev changes libcurl from libcurl3 to libcurl4, this can break some other things you may need, thus you can get the headers by themselves like so:

- name: Install cURL Headers
  run: curl https://curl.haxx.se/download/curl-$V.tar.gz | sudo tar xz -C /usr --strip-components=1 curl-$V/include
  env:
    V: 7.58.0

@shalvah
Copy link

shalvah commented Aug 19, 2021

Thanks for this issue @iMacTia @ethomson . Ran into the exact same issue, and this was very helpful.

olleolleolle added a commit to savonrb/httpi that referenced this issue Oct 5, 2021
pboling added a commit to oauth-xx/oauth-ruby that referenced this issue Oct 31, 2021
@pboling
Copy link

pboling commented Oct 31, 2021

@mxcl I am getting an error with your snippet:

gzip: stdin: not in gzip format

It may be out of date already?

pboling added a commit to oauth-xx/oauth-ruby that referenced this issue Oct 31, 2021
@mxcl
Copy link

mxcl commented Oct 31, 2021

The download failed, check the tarball exists.

pboling added a commit to oauth-xx/oauth-ruby that referenced this issue Nov 1, 2021
pboling added a commit to oauth-xx/oauth-ruby that referenced this issue Nov 1, 2021
@Spone
Copy link

Spone commented Jan 6, 2022

For future reference, to make it work, add the following step to the Github Actions workflow:

  - name: Install cURL Headers
    run: sudo apt-get install libcurl4-openssl-dev

Thanks @pboling for linking your solution to this issue :)

@davelens
Copy link

davelens commented Jul 5, 2022

For future reference, to make it work, add the following step to the Github Actions workflow:

  - name: Install cURL Headers
    run: sudo apt-get install libcurl4-openssl-dev

Thanks @pboling for linking your solution to this issue :)

In addition to this, for even further future reference, the above will still fail in ubuntu-latest (20.04 at the time of writing). You'll need to run sudo apt-get update prior to installing libcurl4-openssl-dev. Occured for me in Rails 6.1 with the curb gem (0.9.10) in its Gemfile. More info here.

thatbudakguy added a commit to sul-dlss/earthworks that referenced this issue Apr 7, 2023
This removes the downstream dependency on patron, which needs
cURL headers in order to build correctly on Ubuntu machines.

The missing headers cause issues on both GitHub CI runners (actions/runner-images#37)
and our automated deploys
(https://sul-ci-prod.stanford.edu/job/SUL-DLSS/job/earthworks/job/master/56/display/redirect).
thatbudakguy added a commit to sul-dlss/earthworks that referenced this issue Apr 7, 2023
This removes the downstream dependency on patron, which needs
cURL headers in order to build correctly on Ubuntu machines.

The missing headers cause issues on both GitHub CI runners (actions/runner-images#37)
and our automated deploys
(https://sul-ci-prod.stanford.edu/job/SUL-DLSS/job/earthworks/job/master/56/display/redirect).
thatbudakguy added a commit to sul-dlss/earthworks that referenced this issue Apr 8, 2023
This removes the downstream dependency on patron, which needs
cURL headers in order to build correctly on Ubuntu machines.

The missing headers cause issues on both GitHub CI runners (actions/runner-images#37)
and our automated deploys
(https://sul-ci-prod.stanford.edu/job/SUL-DLSS/job/earthworks/job/master/56/display/redirect).
thatbudakguy added a commit to sul-dlss/earthworks that referenced this issue Apr 10, 2023
This removes the downstream dependency on patron, which needs
cURL headers in order to build correctly on Ubuntu machines.

The missing headers cause issues on both GitHub CI runners (actions/runner-images#37)
and our automated deploys
(https://sul-ci-prod.stanford.edu/job/SUL-DLSS/job/earthworks/job/master/56/display/redirect).
thatbudakguy added a commit to sul-dlss/earthworks that referenced this issue Apr 10, 2023
This removes the downstream dependency on patron, which needs
cURL headers in order to build correctly on Ubuntu machines.

The missing headers cause issues on both GitHub CI runners (actions/runner-images#37)
and our automated deploys
(https://sul-ci-prod.stanford.edu/job/SUL-DLSS/job/earthworks/job/master/56/display/redirect).
DLamdata added a commit to DLamdata/windforecast_hk that referenced this issue Sep 1, 2023
ubuntu runner can't install curl. I'm trying the solution suggested here actions/runner-images#37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants