/Usr/src/Linux/inlcude/Linux and/usr/include/Linux

Source: Internet
Author: User

1.
The number of files in/usr/include/Linux and/usr/src/Linux/include/Linux is not
The number of folders varies. For example, the/usr/include/Linux does not have the mosules folder, while the/usr/src/Linux/include/Linux
This folder is available.

/Usr/src/Linux/include/Linux is used to compile the kernel.
/Usr/include/Linux is used for compiling applications


/Usr/include/Linux should be connected to/usr/src/Linux/include/Linux

/Usr/include/ASM should be connected to/usr/src/Linux/include/ASM

/Usr/src/Linux/include/ASM connect to the asm-i386 of the current directory

This has always been the case. In earlier articles about Kernel compilation, users are often reminded to do the following:

Ln-S/usr/src/Linux/include/Linux/usr/include/Linux

Ln-S/usr/src/Linux/include/ASM/usr/include/ASM


Later releases were generally completed.
 
2. But it was changed in RH 7.1.

/Usr/src/include/Linux and/usr/src/include/ASM are both real directories.

 
In the latest release, we recommend that you separate the two.

 
The vast majority of "common" programs do not require kernel header files. In fact, errors may occur if you reference them directly. These programs should reference header files used to compile glibc, which are located in the/usr/include/Linux and/usr/include/ASM directories of the system.
The/usr/include of RedHat belongs to glibc, which is not used for the kernel. Although it also contains the ASM and Linux directories, It is simplified. It is only lucky to compile the kernel module occasionally, we recommend that you add the-nostdinc parameter when compiling the kernel to prevent incorrect directories from being used.



3. Instance

In the redhat9.0 (linux-2.4.20-8) environment compiled a netfilter-related
When I use gcc-o-c-I/usr/src/Linux/include
When examplemod. C is compiled, there is no problem, but I use gcc-o-c-I/usr/include
Examplemod. C cannot be passed during compilation. the following error occurs:

/Usr/include/Linux/netfilter_00004.h: 53: 'int _ min' undeclared here (not in a function)

/Usr/include/Linux/netfilter_00004.h: 53: enumerator value for 'nf _ ip_pri_first 'not integer constant

/Usr/include/Linux/netfilter_00004.h: 59: 'int _ max 'undeclared here (not in a function)

/Usr/include/Linux/netfilter_00004.h: 59: enumerator value for 'nf _ ip_pri_last 'not integer constant

Test1.c: 21: Warning: 'struct net_device 'declared inside parameter list

Test1.c: 21: Warning: its scope is only this definition or declaration, which is probably not what you want

Test1.c: 21: Warning: 'struct sk_buff 'declared inside parameter list

Test1.c: In function 'init _ module ':

Test1.c: 37: Invalid use of undefined type 'struct nf_hook_ops'

Test1.c: 38: Invalid use of undefined type 'struct nf_hook_ops'

Test1.c: 39: Invalid use of undefined type 'struct nf_hook_ops'

Test1.c: 40: Invalid use of undefined type 'struct nf_hook_ops'

/Usr/include/Linux/byteorder/swab. h: at top level:

Test1.c: 14: storage size of 'nfho' isn' t known

 

From: http://blog.chinaunix.net/u2/63316/showart_1961394.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.