有没有 C++某处的依赖索引?
当尝试新软件并使用经典的 ./configure
、make
、make install
过程进行编译时,我经常看到类似以下内容:
error: ____.h: No such file or directory
有时,我得到真的很幸运,apt-get install ____
安装了缺少的部分,一切都很好。然而,这种情况并不总是发生,我最终通过谷歌搜索找到了包含我需要的东西的包。有时,该软件包的版本或风格错误,并且已被我下载的另一个软件包使用。
人们如何知道哪些包包含哪些 .h 文件或编译器需要的任何资源?是否有依赖解析器网站或人们用来将失败的构建解码为丢失的包的东西?是否有更现代的方法来自动下载和安装构建的传递依赖项(有点像 Java 的 Maven)?
When trying new software and compiling with the classic ./configure
, make
, make install
process, I frequently see something like:
error: ____.h: No such file or directory
Sometimes, I get really lucky and apt-get install ____
installs the missing piece and all is well. However, that doesn't always happen and I end up googling to find the package that contains what I need. And sometimes the package is the wrong version or flavor and is already used by another package that I downloaded.
How do people know which packages contain which .h files or whatever resource the compiler needs? Is there a dependency resolver website or something that people use to decode failed builds to missing packages? Is there a more modern method of automatically downloading and installing transitive dependencies for a build (somewhat like Java's Maven)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以使用“auto-apt ./configure”(在 Ubuntu 上,也可能在 Debian 上?),它会尝试自动下载依赖项。
You can also use "auto-apt ./configure" (on Ubuntu, and probably also on Debian?) and it will attempt to download dependencies automatically.
如果是 Debian 中的软件包,您可以使用 apt-get build-dep 来获取所有 deps。
否则,请阅读该程序附带的自述文件——希望它列出了该程序的所有依赖项。
If it's a package in Debian, you can use
apt-get build-dep
to get all deps.Otherwise, read the README that comes with the program -- hopefully, it lists all the deps for that program.
所需的包有望在构建包的文档中列出。如果它说您需要
foo
,您可能需要查找foo
和foo-devel
,也许还有libfoo-devel
。如果这没有帮助,在 Fedora 中我会做类似的事情(yum 将查找包含所述文件的包)。如果以上方法都不起作用,请在 Google 中查找文件名,这应该会告诉您该包来自哪里。但接下来的事情就会变得艰难......
The required packages will hopefully be listed in the documentation for building the package. If it says you require
foo
, you'll probably want to look forfoo
andfoo-devel
, and perhapslibfoo-devel
. If that doesn't help, in Fedora I'd do something like(yum will look for the package containing said file). If none of the above works, look for the file name in Google, that should tell you the package where it comes from. But then the going will get rough...