Quick fix for curl: symbol lookup error: /usr/lib/x86_64-linux-gnu/libcurl.so.4: undefined symbol

So you’re trying to install something or compile something or you have curl installed, but it won’t work, because….

# curl -V
curl: symbol lookup error: /usr/lib/x86_64-linux-gnu/libcurl.so.4: undefined symbol: nghttp2_http2_strerror

Or it may be some other package doing this. If you land up on this obscure blog searching, chances are you already have been pulling your hair out wondering what to do.

Here is what I finally did in order to be able to get on with life. Please note, I am not a programmer or any kind of expert and do this at your own risk. I have no idea what you may break. In my case, it was a package I was fairly certain doesn’t belong on my system and isn’t installed.milfster.org comic xxx

Anyway, without further ado, here’s the magic pill.

# ldd /usr/bin/curl|grep /usr/local
	libnghttp2.so.14 => /usr/local/lib/libnghttp2.so.14 (0x00007f8a763ca000)
# mv /usr/local/lib/libnghttp2.so.14 /usr/local/lib/libnghttp2.so.14.bak
# curl -V
curl 7.52.1 (x86_64-pc-linux-gnu) 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
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 

aaaand… we’re in business. As you clearly see, it is going to be suicidal if you rename something important. So like I said, no guarantees here. It is probably not the correct way of dealing with this, but I am beyond the point of correct now, and this works.

What I have basically done is checked the file referring to the non-existing package causing the problem and renamed it. I imagine you could move or delete it, but if you delete, and this doesn’t work, you can’t bring it back.

Final tip: If you’re using php-curl (or php7.0-curl) with Nginx, you’re still going to be haunted by the problem you have fixed unless… you restart php-fpm 🙂

#service php7.0-fpm restart

Now really done.







2 responses to “Quick fix for curl: symbol lookup error: /usr/lib/x86_64-linux-gnu/libcurl.so.4: undefined symbol”

  1. PK Avatar

    THX I had same problem.
    My fix was >
    rm -rf /usr/lib/x86_64-linux-gnu/libcurl.so.4
    ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0.orig /usr/lib/x86_64-linux-gnu/libcurl.so.4

    where libcurl.so.4.4.0.orig is compiled from source

  2. tuliomir Avatar

    Amazing how long those bugs survive. Thanks a million for this obscure blog post!!

Leave a Reply

Your email address will not be published. Required fields are marked *