Skip to content

is it possible to statically link libcurl on linux? #42

Closed

Description

@shiftkey

xref atom/github#848

Arch Linux seems to have a more recent version of libcurl.

git-remote-https: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by git-remote-https)

Activity

  1. mhjacks commented on Aug 16, 2017

    @mhjacks

    Recent Fedora (26 in my case) fails with a very similar error - in my case, it complains of not finding libcurl-gnutls.so.4. This can worked around on Fedora by symlinking libcurl.so.4 to libcurl-gnutls.so.4 (this causes fetches etc to complete); but it seems like statically linking curl would be a more effective and permanent fix.

    The exact error on Fedora 26 is:
    ./git-remote-https ./git-remote-https: error while loading shared libraries: libcurl-gnutls.so.4: cannot open shared object file: No such file or directory

    CentOS 7 fails with precisely the same error.

    OpenSUSE 42.3 LEAP also fails with precisely the same error.

  2. mhjacks commented on Aug 18, 2017

    @mhjacks

    It looks like git itself seems to want to build dynamically, even when it gets the '-static' and '-libgcc-static' CFLAGS. curl wants to link with a lot of things, in particular. I'll keep looking at this but it doesn't look like it will be as easy as I had hoped at first.

    Would building a static libcurl and linking git-remote* to that be viable, do you think? Just thinking out loud. That may require the git build to change too, which would be potentially fragile.

  3. shiftkey commented on Aug 18, 2017

    @shiftkey
    MemberAuthor

    @mhjacks yeah, I have some notes from a chat with @dscho I had a while ago as he looked into this. I need to revisit those and add them to this issue.

  4. mhjacks commented on Aug 18, 2017

    @mhjacks

    @shiftkey Thanks, I think that would be helpful. I'm wondering what the best path for non-Ubuntu distros would be. I see:

    1. Continue trying to build git statically with libcurl
    2. Vendor libcurl and link the vendored git against that
    3. Introduce a new build platform, and offer a more "native" RPM-based build (doesn't necessarily solve the problem for Arch, though, and not guaranteed to work for e.g. el6 + el7 + fedora + opensuse)
    4. Offer options in dugite to use OS-provided binaries if they exist (I know this is risky, because git versions vary significantly, but e.g. Fedora and Arch will be pretty close to "current" upstream, and if anyone is running on el6/7 there are options to get more recent git builds. Not sure what the user percentage breakdown is, to be fair, for non-Ubuntu Linux, but where I am there are a lot of Fedora/Cent fans.)
  5. mhjacks commented on Aug 20, 2017

    @mhjacks

    I tried building atom completely from source using the instructions on the website - and there's at least circumstantial evidence it's using the ubuntu binaries (since they want to link to libcurl-gnutls.so.4 still).

  6. halfsquatch commented on Sep 6, 2017

    @halfsquatch

    Same issue here and using RHEL 7.4. I have a libcurl on the system that works perfectly. But I guess atom statically links in GIT, but this GIT is trying to access a system lib from Ubuntu.

    Without GIT working, I don't much see the point in using atom.

  7. dscho commented on Oct 29, 2017

    @dscho

    I just remembered that there is an "ELF statifier" that is supposed to help you turn your dynamically-linked executables into fat binaries.

    Maybe one of you Linux enthusiasts could give it a spin.

  8. hexa00 commented on Dec 13, 2017

    @hexa00

    Note that there's many other system libraries that git-remote-https uses like:

        libcurl-gnutls.so.4 => /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007f4fcdf22000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f4fcdd08000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4fcdaeb000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f4fcd8e3000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4fcd519000)
        libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007f4fcd2e6000)
        librtmp.so.1 => /usr/lib/x86_64-linux-gnu/librtmp.so.1 (0x00007f4fcd0ca000)
        libnettle.so.6 => /usr/lib/x86_64-linux-gnu/libnettle.so.6 (0x00007f4fcce94000)
        libgnutls.so.30 => /usr/lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f4fccb64000)
        libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f4fcc91a000)
        liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f4fcc70b000)
        libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f4fcc4ba000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4fce18f000)
        libhogweed.so.4 => /usr/lib/x86_64-linux-gnu/libhogweed.so.4 (0x00007f4fcc287000)
        libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f4fcc007000)
        libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f4fcbda3000)
        libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f4fcbb90000)
        libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f4fcb8be000)
        libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f4fcb68f000)
        libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f4fcb48b000)
        libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f4fcb280000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f4fcb065000)
        libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f4fcae4a000)
        libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f4fcac09000)
        libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f4fcaa01000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4fca7fd000)
        libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f4fca5f9000)
        libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f4fca3f0000)
        libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f4fca166000)
        libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f4fc9ec4000)
        libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f4fc9c91000)
        libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f4fc9a7b000)
        libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f4fc9852000)
        libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f4fc9643000)
        libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f4fc93f8000)
        libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f4fc9123000)
        libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f4fc8eeb000)

    Not sure why libsqlite is needed too...

  9. dscho commented on Dec 14, 2017

    @dscho

    Note that there's many other system libraries that git-remote-https uses

    Have you tried my suggestion to use the ELF statifier? It should be able to handle all of those...

    Not sure why libsqlite is needed too...

    AFAIR it is a dependency of heimdal.

  10. hexa00 commented on Dec 14, 2017

    @hexa00

    I have not tried ELF statifier, it looks interesting but It doesn't support VSDO randomization which most distros use now.

    Maybe we need to test Ermine for that too. But it's non-free and there's no list price for it... But we can test it anyway.

  11. shiftkey commented on Dec 17, 2017

    @shiftkey
    MemberAuthor

    I made a dent in this in #67 while evaluating Ermine. I've also emailed the company behind Ermine about their pricing and support for OSS projects, which is mentioned in their FAQ.

  12. probonopd commented on Dec 17, 2017

    @probonopd
  13. TheAssassin commented on Dec 17, 2017

    @TheAssassin

    @hexa00:

    Note that there's many other system libraries that git-remote-https uses like:

    Those are all hidden dependencies of your system libcurl. libcurl is awesome at first, as it can do anything, but it's also a really annoying dependency for bundling in AppImages.

    Since libcurl is built to support a variety of protocols, it can be annoying to have to bundle all those libraries as well. Also, as part of the series https://github.com/AppImage/AppImageKit/wiki/Desktop-Linux-Platform-Issues, the CA chain is located in different places on all platforms. libcurl solves the issue by having the user specify the location on configure time. To fix this issue and also reduce the amount of dependencies, I started to build my own packages on OBS, based on the Debian ones, patched to support only HTTP(S) and search for the certificate location on runtime.

    Check out https://build.opensuse.org/package/show/home:TheAssassin:AppImageLibraries/curl-httponly. Use like https://github.com/AppImage/AppImageUpdate/blob/rewrite/resources/bootstrap-container.sh#L8-L10. The packages should upgrade fine on Debian based systems. The package has been forked from the latest available unstable package.

  14. shiftkey commented on Jul 23, 2018

    @shiftkey
    MemberAuthor

    Parking this one for now in favour of #102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions