从存储库下载库或从 *.tar.gz 安装哪个更好
gcc 4.4.4 c89 Fedora 13
我想知道哪个更好。为您提供示例的编译:apache 运行时可移植 和 log4c。
我的 Fedora 存储库中的 apr 版本是 1.3.9。 apr网站上最新的稳定版本是1.4.2。
问题
- 是从网站下载安装好,还是使用yum安装好?
- 当您从 yum 安装时,有时它会将内容放入许多目录中。从 tarball 安装时,您可以将包含文件和库放在您想要的位置。
- log4c 的版本是相同的,因为这是一个旧项目。
- 我使用 yum 下载了 log4c。我将所有包含文件和库复制到我的开发项目目录中。
但是
project_name/tools/log4c/inc
project_name/tools/log4c/libs
,我注意到我必须在 /usr/include
目录中查找一些标头。
非常感谢您的任何建议,
gcc 4.4.4 c89 Fedora 13
I am wondering what is better. To give you a compile of examples: apache runtime portable and log4c.
The apr version in my fedora repository is 1.3.9. The latest stable version on the apr website is 1.4.2.
Questions
- Would it be better to download from the website and install, or install using yum?
- When you install from yum sometimes it can put things in many directories. When installing from the tarball you can put the includes and libraries where you want.
- The log4c the versions are the same, as this is an old project.
- I downloaded log4c using yum. I copied all the includes and libraries to my development project directory.
i.e.
project_name/tools/log4c/inc
project_name/tools/log4c/libs
However, I noticed that I had to look for some headers in the /usr/include
directory.
Many thanks for any suggestions,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我通常使用我的发行版提供的软件包,如果它们的版本足够新的话。这样做有两个原因:
1)如果旧软件包中的安全漏洞被发现,有人会确保我获得新软件包。
2)它节省了我的时间。
当我建立一个开发项目时,我从不创建自己的 include/lib 目录,除非该项目本身是我放在那里的相关文件的权威来源。
我使用 pkg-config 向我的编译器提供必要的库和包含文件的位置。 pkg-config 使用一些 .pc 文件作为有关事物应该在哪里的信息源,并且这些文件由为您的发行版创建包的同一个人维护。有些库不提供此文件,而是提供替代的“-config”脚本。我将提供两个示例:
我没有运行 Fedora 13,但 Ubuntu 10.04 上的示例是;
*) 安装 liblog4c-dev
*) 命令“log4c-config --libs”返回“-L/usr/lib -llog4c”...
*) 命令“log4c-config --cflags”返回“-I/usr /include"
并以使用 pkg-config 为例(我将使用 SDL 作为示例):
*) 安装 libsdl1.2-dev
*) 命令“pkg-config sdl --libs”返回“-lSDL”
*)命令“pkg-config sdl --cflags”返回“-D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL”
...因此,即使另一个发行版决定将内容放在不同的路径中,也有一些脚本应该为您提供有关事物所在位置的可靠答案 - 因此事物可以在大多数发行版上构建。自动工具(automake、autoconf 等)amd cmake 对于确保您不必处理这些问题非常有帮助。
I usually use the packages provided by my distribution, if they are of a new enough version. There is two reasons for that:
1) Someone will make sure that I get new packages if security vulnerabilities in the old ones are uncovered.
2) It saves me time.
When I set up a development project, I never create my own include/lib directories unless the project itself is the authorative source for the relevant files I put there.
I use pkg-config to provide the location of necessary libraries and include files to my compiler. pkg-config use some .pc-files as a source of information about where things are supposed to be, and these are maintained by the same people who create the packages for your distribution. Some libraries does not provide this file, but an alternative '-config'-script. I'll provide two examples:
I'm not running Fedora 13, but an example on Ubuntu 10.04 would be;
*) Install liblog4c-dev
*) The command "log4c-config --libs" returns "-L/usr/lib -llog4c" ...
*) The command "log4c-config --cflags" returns "-I/usr/include"
And for an example using pkg-config (I'll use SDL for the example):
*) Install libsdl1.2-dev
*) The command "pkg-config sdl --libs" returns "-lSDL"
*) The command "pkg-config sdl --cflags" returns "-D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL"
... So even if another distribution decides to put things in different paths, there are scripts that are supposed to give you a reliable answer to where things is - so things can be built on most distributions. Autotools (automake, autoconf, and the likes) amd cmake are quite helpful to make sure that you don't have to deal with these problems.
如果您想要构建必须与 Fedora 附带的 Apache 配合使用的东西,那么最好在 Fedora 中使用
apr
版本。这样您就可以获得自动安全更新等。如果您想自己开发新的东西,那么跟踪上游可能会很有用。另外,通常您的发行版提供的标头应该由 gcc & 找到。公司无需复制它们,因此 yum/rpm 将它们存储在何处并不重要。
If you want to build something that has to work with the Apache that's included with Fedora, then it's probably best to use the
apr
version in Fedora. That way you get automatic security updates etc. If you want to develop something new yourself, it might be useful to track upstream instead.Also, normally the headers that your distro provides should be found by gcc & co. without you needing to copy them, so it doesn't matter where they are stored by yum/rpm.
如果您的发行版软件包存储库中的版本足够新,则只需使用它。
优点是通过您的发行版自动更新、轻松快速安装(包括自动获取和安装依赖项!)以及轻松删除软件包。
如果您自己从 .tar.gz 安装内容,则必须使用自己的发行版 - 跟踪安全问题和错误。
使用分发包,您也可以关注安全问题,但是分发器会为您做很多工作(例如开发补丁、重新打包、测试和捕获严重的东西)。当然,每个发行商都有一个如何处理不同软件包存储库的不同类别问题的策略。但使用您自己的 .tar.gz 安装时,您什么也没有。
If the version in your distribution's package repository is recent enough, just use that.
Advantages are automatic updates via your distribution, easy and fast installs (including the automatic fetching and installing of dependencies!) and easy removals of packages.
If you install stuff from .tar.gz by yourself, you have to play your own distribution - keep track of security issues and bugs.
Using distribution packages, you have an eye on security problems as well, but a lot work does the distributor for you (like developing patches, repackaging, testing and catching serious stuff). Of course each distributor has a policy how to deal with different classes of issues for different package repositories. But with your own .tar.gz installs you have nothing of this.
我认为这是一个古老的问题。所有 Linux 发行版上都是一样的。
该包是由某人创建的 - 该人对于东西应该放在哪里有自己的意见。您可能不同意 - 但通过使用软件包,您可以不必追寻编译和安装软件所需的所有依赖项。
因此,为了完全控制:自己动手 - 但为可能的工作做好准备
否则使用该包。
我的看法:
使用包,直到不可能为止(冲突、需要编译参数,..)。我宁愿花时间让软件为我工作,也不愿花时间编译。
It's an age-old question I think. And it's the same on all Linux distributions.
The package is created by someone - that person has an opinion as to where stuff should go. You may not agree - but by using a package you are spared chasing down all the dependencies needed to compile and install the software.
So for full control: roll your own - but be prepared for the possible work
otherwise use the package.
My view:
Use packages until it's impossible to do so (conflicts, compile parameters needed, ..) . I'd much rather spend time getting the software to work for me, than spend time compiling.