如何学习Linux中的构建工具?
自从过去几年以来,我一直在嵌入式 Linux 中编写代码,我使用 make 实用程序来构建我的代码,但我根本不是它的高级用户。但现在,有必要拥有更好的编译、交叉编译知识,以便我可以轻松地将我的代码移植到更新的处理器上。所以我想了解哪些不同的工具可用于在 Linux 中构建项目?请向我提供您认为对您的项目有帮助的外部参考(链接、书籍)。
我用 C++ 编写代码。
谢谢,阳光明媚
I am writing code in embedded linux since last couple of years, I use make utility to build my code and I am not at all an advance user of it. But now, It is necessary to have better compilation, cross-compilation knowledge, so that I can easily port my code to newer processors. So I want to learn that which different tools are available for building projects in linux? Please provide me external reference ( Links, Books ) which you found helpful in your projects.
I write code in c++.
Thanks, Sunny
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从这里开始:GNU 构建系统。
Start from this: GNU build system.
出版商 O'Reilly 为开发人员提供了很多好书(也有一些不太好的书籍)。在我的图书馆里,它们约占我所有书籍的 1/3。近年来,我购买的书籍中约有75%来自O'Reilly。
例如,这本书是关于 Make for GNU 的。或者这个。
The publisher O'Reilly has lots of good (and some not-so-good) books for developers. In my library, they make up about 1/3rd of all my books. In recent years, about 75% of books I've purchased are from O'Reilly.
This book about Make for GNU, for example. Or this one.
autoconf 是自动为类 UNIX 系统创建构建系统的事实上的标准。通过在 autoconf 下配置您的软件,理论上您应该能够在任何支持 GNU 构建环境的系统上构建它。老实说,我发现 autoconf 非常丑陋且过于复杂,并且通常不喜欢处理它。
CMake是一个较新的系统,其功能与 autoconf 大致相同。我听说它比 autoconf 简单得多,尽管我自己从未使用过它。一些备受瞩目的项目(例如 KDE)使用 CMake。
这两个系统的用户手册可能是您理想的起点。拿一个现有的程序,看看是否可以将其设置为由其中之一自动构建。您还应该尝试使用它们进行一些更复杂的构建,例如交叉编译,两者都应该支持。
然而,我对 Windows 的构建系统一无所知。对于处理 Windows 构建,CMake 可能是两者中更容易的一个。
autoconf is the defacto standard for automatically creating build systems for unix-like systems. By having your software configured under autoconf you should theoretically be able to be able to build it on any system that supports a GNU build environment. Honestly, I find autoconf to be incredibly ugly and overcomplex and generally don't like dealing with it.
CMakeis a newer system which has about the same functionality as autoconf. I hear it's quite a bit simpler than autoconf, though I've never used it myself. Several high profile projects such as KDE use CMake.
The user manual for either of these 2 systems is probably the ideal place to start for you. Take an existing program you have and see if you can set it up to have it's build automated by one of them. You should also try some more complicate builds with them, such as cross compilations, which both should support.
I know nothing of build systems for windows, however. CMake is probably the easier of the 2 for handling Windows builds also.
阅读论文递归使人认为有害,了解一些背景哲学。还有一篇好文章,GNU Make:多架构构建。另外,GNU Make 手册实际上从前到后都很容易阅读。我把整本书当做作业读完了。
Read the paper Recursive Make Considered Harmful, to get a bit of background philosophy. Then there's a good article, GNU Make: Multi-Architecture Builds. Also, the GNU Make manual is actually fairly readable from front to back. I've read the whole thing as homework.