简体   繁体   English

适合 Linux 用户空间程序的构建环境

[英]Proper Build Environment for Linux User-space Programs

I need to build a Linux user-space program that includes headers from the Linux Kernel.我需要构建一个包含来自 Linux 内核的头文件的 Linux 用户空间程序。 However those headers in turn seem to use other headers and so on.然而,这些标题又似乎使用其他标题等等。 So my question is, what is the proper/good way of including all off the possible directories I could require in my Makefile?所以我的问题是,在我的 Makefile 中包含所有可能的目录的正确/好的方法是什么? Thank you.谢谢你。

Most user-space programs using the Linux kernel headers don't need to do anything special.大多数使用 Linux 内核头文件的用户空间程序不需要做任何特别的事情。 linux/ is already included in the default include paths, eg #include <linux/netlink.h> . linux/已经包含在默认的包含路径中,例如#include <linux/netlink.h> Distributions will include these files as part of their stanh>dard developer package, for example build-essential on Debian.发行版将包含这些文件作为其 stanh>dard 开发包的一部分,例如 Debian 上的build-essential

You can also get headers specific for your kernel version, which is required when building a kernel module, but userspace programs will typically only interact with sockets and pipes and thus just need some structure definitions or protocol helpers for those channels (for example, Netlink).您还可以获得特定于您的内核版本的头文件,这在构建内核模块时是必需的,但用户空间程序通常只与套接字和管道交互,因此只需要这些通道的一些结构定义或协议助手(例如,Netlink) .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM