Skip to content

Wrong libcurl version on arch-linux #1225

Open

Description

@Hufschmidt

Installing nodegit on archlinux failes while building with:

Error: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by node_modules/nodegit/build/Release/nodegit.node)

I think this was introduced by PR #1195

The issue is, that nodegit wants libcurl abi-3, while archlinux default libcurl is abi-4.

How to fix

At least on arch-linux nodegit should link against libcurl-compat (which is abi-3 and provides libcurl.so.3 as well as libcurl-compat.so), not libcurl (which is abi-4 and is incompatible with CURL_OPENSSL_3).

How to reproduce

  • Grab and boot a manjaro live-cd (https://manjaro.github.io/), which should be easier/faster then bootstrapping arch
  • Install nodejs with pacman/yaourt
  • Try to install nodegit with npm

Sidenote

Effected third-party tools are for example GitKraken on arch (see comments) which comes with prebuild nodegit binaries but fails to load because of missing/wrong symbols in libcurl.so.4. This can be fixed by loading libcurl-compat before libcurl using the LD_PRELOAD trick.

Activity

  1. saper commented on Feb 26, 2017

    @saper
    Collaborator

    Is there any way to detect this situation for example using curl-config ? Is there something like curl-compat-config available?

  2. Hufschmidt commented on Feb 27, 2017

    @Hufschmidt
    Author

    I don't think there is an easy solution for this, here is the package content for libcurl-compat while default libcurl comes from this package.

    Side note

    I actually think there might be something entirely different wrong here.
    When running npm install nodegit in a fresh directory it terminates rather quickly with:

    [<build>]$ npm install nodegit
    
    > nodegit@0.17.0 install <build>/node_modules/nodegit
    > node lifecycleScripts/preinstall && node lifecycleScripts/install
    
    [nodegit] Running pre-install script
    [nodegit] Configuring libssh2.
    [nodegit] Running install script
    [nodegit] Success: "<build>/node_modules/nodegit/build/Release/nodegit.node" is installed via remote
    [nodegit] Completed installation successfully.
    
    > nodegit@0.17.0 postinstall <build>/node_modules/nodegit
    > node lifecycleScripts/postinstall
    
    [nodegit] WARN - Could not finish postinstall
    { Error: Command failed: node "<build>/node_modules/nodegit/dist/nodegit.js"
    <build>/node_modules/nodegit/dist/nodegit.js:15
        throw ex;
        ^
    
    Error: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by <build>/node_modules/nodegit/build/Release/nodegit.node)
        at Object.Module._extensions..node (module.js:598:18)
        at Module.load (module.js:488:32)
        at tryModuleLoad (module.js:447:12)
        at Function.Module._load (module.js:439:3)
        at Module.require (module.js:498:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (<build>/node_modules/nodegit/dist/nodegit.js:11:12)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32)
    
        at ChildProcess.exithandler (child_process.js:211:12)
        at emitTwo (events.js:106:13)
        at ChildProcess.emit (events.js:192:7)
        at maybeClose (internal/child_process.js:890:16)
        at Socket.<anonymous> (internal/child_process.js:334:11)
        at emitOne (events.js:96:13)
        at Socket.emit (events.js:189:7)
        at Pipe._handle.close [as _onclose] (net.js:501:12)
      killed: false,
      code: 1,
      signal: null,
      cmd: 'node "<build>/node_modules/nodegit/dist/nodegit.js"' }
    

    When I fetch nodegit manually from git, add the libgit2 repository to the vendor directory and run npm run rebuild from within, building succeeds, but interestingly it does take quiet a bit longer which I think has to be due to building libgit2.

    Could it be that nodegit comes with a prebuild version of libgit2, which for some reason is build against libcurl ABI 3; aka is linked against libcurl.so which is symlink for libcurl.so.3 and not libcurl.so.4 on that particiular system libcurl.so.4 which contains backwards compatiblity code for ABI 3.

    Another clues that the issue might be with a prebuild library can be seen when running ldd nodegit.node against the version that was ...

    • [A] ...build via npm install nodegit, which may have been linked against a pre-build libgit2:
    [<build>/node_modules/nodegit/build/Release]$ ldd nodegit.node 
    ./nodegit.node: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by ./nodegit.node)
            linux-vdso.so.1 (0x00007ffdfd1a2000)
            libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fd2449d8000)
            libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fd244650000)
            libm.so.6 => /usr/lib/libm.so.6 (0x00007fd24434c000)
            libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fd244135000)
            libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd243f18000)
            libc.so.6 => /usr/lib/libc.so.6 (0x00007fd243b7a000)
            libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007fd24394b000)
            libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007fd24373d000)
            libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007fd2434cb000)
            libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007fd243053000)                                                       
            libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007fd242e05000)                                                     
            libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007fd242b20000)                                                                   
            libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007fd2428ed000)                                                           
            libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007fd2426e9000)                                                             
            libz.so.1 => /usr/lib/libz.so.1 (0x00007fd2424d2000)                                                                         
            /usr/lib64/ld-linux-x86-64.so.2 (0x000055b1948b8000)                                                                         
            libicuuc.so.58 => /usr/lib/libicuuc.so.58 (0x00007fd242126000)                                                               
            libicudata.so.58 => /usr/lib/libicudata.so.58 (0x00007fd240626000)                                                           
            libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd240422000)                                                                       
            libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007fd240213000)                                                     
            libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007fd24000f000)                                                           
            libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fd23fdf8000) 
    
    • [B] ...downloaded and manually build via npm run rebuild:
    [<build>/build/Release]$ ldd nodegit.node                                                                                                                                                                                                                                   
            linux-vdso.so.1 (0x00007ffc7f0c9000)                                                                                                                                                                                                                                   
            libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007f80afd83000)                                                                                                                                                                                                             
            libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f80af9fb000)                                                                                                                                                                                                         
            libm.so.6 => /usr/lib/libm.so.6 (0x00007f80af6f7000)                                                                                                                                                                                                                   
            libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f80af4e0000)                                                                                                                                                                                                           
            libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f80af2c3000)                                                                                                                                                                                                       
            libc.so.6 => /usr/lib/libc.so.6 (0x00007f80aef25000)                                                                                                                                                                                                                   
            libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007f80aecf6000)                                                                                                                                                                                                             
            libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007f80aeae8000)                                                                                                                                                                                                               
            libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f80ae876000)                                                                                                                                                                                                       
            libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f80ae3fe000)                                                                                                                                                                                                 
            libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f80ae1b0000)                                                                                                                                                                                               
            libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f80adecb000)                                                                                                                                                                                                             
            libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f80adc98000)                                                                                                                                                                                                     
            libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f80ada94000)                                                                                                                                                                                                       
            libz.so.1 => /usr/lib/libz.so.1 (0x00007f80ad87d000)                                                                                                                                                                                                                   
            /usr/lib64/ld-linux-x86-64.so.2 (0x0000561bd56a9000)                                                                                                                                                                                                                   
            libicuuc.so.58 => /usr/lib/libicuuc.so.58 (0x00007f80ad4d1000)                                                                                                                                                                                                         
            libicudata.so.58 => /usr/lib/libicudata.so.58 (0x00007f80ab9d1000)                                                                                                                                                                                                     
            libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f80ab7cd000)                                                                                                                                                                                                                 
            libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f80ab5be000)                                                                                                                                                                                               
            libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f80ab3ba000)                                                                                                                                                                                                     
            libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f80ab1a3000) 
    

    Both want to load libcurl.so.4 on my system, both were build by linking with -lcurl, but Exhibit A for some reason still has an undefined symbol.
    There is also a difference in size, Exhibit A is rougly 6.3mb, while Exhibit B is rougly 7mb.

    Conclusion

    The issue seems to be with a prebuild library (probably libgit2) which was linked against libcurl -> libcurl.so.4 which also contained backwards compatible libcurl.so.3 code, while arch-linux libcurl.so.4 does not.

    Proposed solution

    Don't use prebuild libraries (on arch) IFF that is an option?

  3. maxkorp commented on Mar 1, 2017

    @maxkorp
    Collaborator

    Yeah it's not that it's a prebuilt libgit2, its a prebuilt nodegit binary, which then fails to load. I think tin the case of arch, you'll need to run BUILD_ONLY=1 npm install nodegit, until we can figure out away around that.

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