卷曲后的路径问题 [英] path issue after compiling curl

查看:52
本文介绍了卷曲后的路径问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令在克隆存储库后编译了curl:

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

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

但是,在sudo make install之后,如果

However, after sudo make install, if

  • 我运行 curl -V ,我得到:bash:/usr/bin/curl:没有这样的文件或目录.
  • 我运行/usr/local/bin/curl -V ,我得到:/usr/local/bin/curl:符号查找错误:/usr/local/bin/curl:未定义符号:curl_mime_type .
  • 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.

我尝试通过将curl/src的路径添加到我的PATH变量中来解决此问题,这使curl命令在终端上可以为我的用户使用.但是,如果我尝试安装 php-curl ,则可以理解,apache不会看到curl并安装了另一个.

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?

评论中提到的另一篇文章是询问编译后在哪里可以找到可执行文件.那部分被回答了.但是,如果不将条目添加到PATH变量中,这似乎是不正确的,但是我仍然无法使curl正常工作.这就是我现在要弄清楚的部分.

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.

推荐答案

安装路径

如果不使用configure的-prefix 选项,则默认安装将在/usr/local 中进行,因此curl最终位于/usr/local/bin/curl .

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.

它报告丢失的符号是libcurl的最新添加,它表示您正在调用一个新的curl工具,该工具加载并使用了较旧的libcurl-即不是刚刚安装的libcurl,而是先前版本的(系统?)安装.

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.

您可以通过调用来验证卷毛加载的libcurl

You can verify which libcurl your curl loads by invoking

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

您可以通过以下几种方式之一来更改curl加载的libcurl,这两种方式都不是curl特有的,因此我将在此简单介绍一下要在其他地方进一步说明的方法:

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. 在调用curl之前,只需在外壳程序中设置 LD_LIBRARY_PATH 即可
  2. 编辑/etc/ld.so.conf 并确保搜索路径的顺序使新的libcurl在旧的libcurl之前找到.
  3. 通过使用 LDFLAGS = -Wl,-R/usr/local/ssl/lib ./configure ... 之类的命令调用configure,将curl可执行文件与硬编码路径链接到新的libcurl.
  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 ...

要替换系统库吗?

通常建议不要 用您的自定义版本替换系统安装的libcurl.通常是因为您可能有一个或两个依赖于该构建细节的应用程序.从源代码安装自己的libcurl时,通常最好将其安装在单独的路径中,以便它可以与系统中已安装的libcurl共存.

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,.

这篇关于卷曲后的路径问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆