4

I compiled curl after cloning the repo using the following commands:

./buildconf
./configure --with-libssh2
make
sudo make install

However, after sudo make install, if

  • I run curl -V, I get: bash: /usr/bin/curl: No such file or directory.
  • I run /usr/local/bin/curl -V, I get: /usr/local/bin/curl: symbol lookup error: /usr/local/bin/curl: undefined symbol: curl_mime_type.

I tried getting around this by adding the path to curl/src to my PATH variable, and that made the curl command work from the terminal for my user. But if I try installing php-curl, apache understandably doesn't see curl and installs a different one.

Any ideas on how I can fix this?

Edit: The other post referred to in the comments was asking where to find the executable after compiling. That part was answered. But I still can't get curl to work without adding an entry to my PATH variable, which doesn't seem right. That's the part I'm trying to figure out now.

9
  • Possible duplicate of where is executable after compiling curl? Commented Jun 18, 2018 at 0:22
  • Since the post you're referring to is about where to find the curl executable, I thought that this warranted a separate post. This one is about the error I get after installing. Commented Jun 18, 2018 at 13:28
  • In my bounty post, I should have said the configure command I did: ./configure --with-libssh2. I should also mention that the way I installed libssh2 was with sudo apt-get install libssh2-1-dev. Commented Jun 18, 2018 at 20:51
  • 1
    run ldd $(which curl) , what do you get? Commented Jun 19, 2018 at 0:13
  • When I run that command, I get: not a dynamic executable Commented Jun 20, 2018 at 13:21

1 Answer 1

12
+50

install path

If you don't use configure's --prefix option, the default installation will happen in /usr/local so curl ends up at /usr/local/bin/curl.

symbol lookup error

The symbol it reports to be missing is a recent addition to libcurl, which indicates that you're invoking a new curl tool that loads and uses an older libcurl - ie not the one you just installed but one from a previous (system?) install.

You can verify which libcurl your curl loads by invoking

$ ldd /usr/local/bin/curl | grep libcurl

You can change which libcurl your curl loads in one of several way, neither of which is curl specific so I'll just briefly mention the methods here to be further explained elsewhere:

  1. Just set LD_LIBRARY_PATH in the shell before you invoke curl
  2. Edit /etc/ld.so.conf and make sure the order of the search path makes the new libcurl gets found before the old one.
  3. Link your curl executable with a hard coded path to the new libcurl by invoking configure with something like LDFLAGS=-Wl,-R/usr/local/ssl/lib ./configure ...

replacing the system library?

It is generally not advised to replace the system installed libcurl with your custom build. Mostly because you might have an application or two that depend on specifics of that build. When you install your own libcurl from source, it is generally better to keep it installed in a separate path so that it can co-exist with the one already installed in your syste,.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you so much Daniel for the detailed answer. When I run the command you mentioned (ldd /usr/local/bin/curl | grep libcurl), I get: libcurl.so.4 => /usr/lib/x86_64-linux-gnu/libcurl.so.4. So if I go with option 2, I'm guessing I'd add "/usr/lib/x86_64-linux-gnu" to /etc/ld.so.conf. With that, should I be able to install php-curl as I normally would using apt-get install php-curl and apache will be able to work with it? Also, is there something I did wrong with the install that caused this behavior? Should I have uninstalled libcurl first perhaps?
It is sad Linux still has not fixed the broken path problem after 25 years or so.
It's not a bug, it's a feature. This is not really a "path problem" to fix for "Linux".
Thanks for the info, Daniel. This worked! Enjoy a piece of my fragile reputation!
Why can't I download with curl? [@localhost]$ curl github.com/tensorflow/tensorflow/archive/v2.3.0.tar.gz <html><body>You are being <a href="codeload.github.com/tensorflow/tensorflow/tar.gz/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.