在Linux中如何安装标准库的头文件?

时间:2022-08-08 15:30:59

I have an annoying problem with a library siginfo.h. I need a version of this library that contains the structure of siginfo_t with a field for handling SIGSYS signals.

我有一个很烦人的问题关于图书馆的签章。我需要这个库的一个版本,其中包含siginfo_t的结构,其中包含一个用于处理SIGSYS信号的字段。

For isntance, the version of structure as I need can be found here : http://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/x86/bits/siginfo.h.html

对于isnof,可以在这里找到我需要的结构版本:http://code.woboq.org/userspace/glibc/sysdeps/unix/linux/x86/bits/siginfo.h html。

The version that is automatically included using the #include is the version in /usr/include/bits/siginfo.h that misses this field. However, there is another version of the same library in asm-generic that provides the fields I need. The kernel contains two files called siginfo.h but they don not contain the structure siginfo_t. I thought that this problem could be solved by updating glibc but in the latest version of glibc (2.17) there is a completely different version again, and not what I need.

使用#include自动包含的版本是/usr/ include/bits/siginfo。h漏了这个场。然而,在asm-generic中有另一个版本的库,它提供了我需要的字段。内核包含两个名为siginfo的文件。但是它们不包含结构siginfo_t。我认为这个问题可以通过更新glibc来解决,但是在最新版本的glibc(2.17)中又出现了一个完全不同的版本,而不是我所需要的。

Now I am bit confused, how headers of the standard libraries are actually installed? Should I activate compiling options to have this structure?

现在我有点困惑,标准库的头是如何安装的?我是否应该激活编译选项以拥有这个结构?

2 个解决方案

#1


0  

What is available in the member union {} _sifields of the siginfo_t depends on which kernel you are using.

siginfo_t的成员联合{}_sifields中可用的内容取决于您使用的内核。

Kernel 3.6.4 definitly defines:

内核3.6.4板块定义:

 /* SIGSYS */
 struct {
   void __user *_call_addr; /* calling user insn */
   int _syscall;   /* triggering system call number */
   unsigned int _arch;     /* AUDIT_ARCH_* of syscall */
 } _sigsys;

Kernel 2.6.32 does not.

2.6.32内核没有。

I do not know when it was introduced exactly.

我不知道确切的介绍时间。

#2


-1  

The header file is searched as the following order in gcc: 1) The path identified by the -I option; 2) The path in the env vars, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH; 3) The system path, like "/usr/include", etc. So you can use the "-I" option to chang the header file searching path. And, you may need to use "-L" option to chang the library path.

在gcc中按以下顺序搜索头文件:1)i选项标识的路径;2) env vars中的路径,C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH;3)系统路径,如“/usr/include”等,可以使用“-I”选项改变头文件搜索路径。并且,您可能需要使用“-L”选项来更改库路径。

#1


0  

What is available in the member union {} _sifields of the siginfo_t depends on which kernel you are using.

siginfo_t的成员联合{}_sifields中可用的内容取决于您使用的内核。

Kernel 3.6.4 definitly defines:

内核3.6.4板块定义:

 /* SIGSYS */
 struct {
   void __user *_call_addr; /* calling user insn */
   int _syscall;   /* triggering system call number */
   unsigned int _arch;     /* AUDIT_ARCH_* of syscall */
 } _sigsys;

Kernel 2.6.32 does not.

2.6.32内核没有。

I do not know when it was introduced exactly.

我不知道确切的介绍时间。

#2


-1  

The header file is searched as the following order in gcc: 1) The path identified by the -I option; 2) The path in the env vars, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH; 3) The system path, like "/usr/include", etc. So you can use the "-I" option to chang the header file searching path. And, you may need to use "-L" option to chang the library path.

在gcc中按以下顺序搜索头文件:1)i选项标识的路径;2) env vars中的路径,C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH;3)系统路径,如“/usr/include”等,可以使用“-I”选项改变头文件搜索路径。并且,您可能需要使用“-L”选项来更改库路径。