2

After I figuerd out my ubuntu 12.10 amd64 with 3.5.X Kernel does not fill some queuing, and they've fixed that in kernel 3.8.x, I upgraded the kernel of my Ubuntu to v3.10-saucy with installing deb files from the mainline Kernel archive and things went well.

uname -r
3.10.0-031000-generic

And the

sudo apt-get install linux-image-3.10.0-031000-generic 

says me things already installed.

But after I come to compile my C code with gcc, it still claims that the piece of code that suppose to work on > 3.8.x, is undeclared!

The problem is the new installed kernel header is in

/usr/src/linux-headers-3.10.0-031000-generic/include/

but /usr/include still holds the old headers. Gcc still reads from /usr/include for header files. Then, I came with this:

gcc --verbose -I /usr/src/linux-headers-3.10.0-031000-generic/include/ -o test.out test.c

In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:14:26: error: conflicting types for ‘fd_set’
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:220:0,
                 from /usr/include/net/if.h:26,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/select.h:76:5: note: previous declaration of ‘fd_set’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:15:25: error: conflicting types for ‘dev_t’
In file included from /usr/include/net/if.h:26:0,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/types.h:61:17: note: previous declaration of ‘dev_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:19:17: error: conflicting types for ‘nlink_t’
In file included from /usr/include/net/if.h:26:0,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/types.h:76:19: note: previous declaration of ‘nlink_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:25:26: error: conflicting types for ‘timer_t’
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:133:0,
                 from /usr/include/net/if.h:26,
                 from test.c:2:
/usr/include/time.h:104:19: note: previous declaration of ‘timer_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:45:26: error: conflicting types for ‘loff_t’
In file included from /usr/include/net/if.h:26:0,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/types.h:45:18: note: previous declaration of ‘loff_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:112:17: error: conflicting types for ‘u_int64_t’
In file included from /usr/include/net/if.h:26:0,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/types.h:204:1: note: previous declaration of ‘u_int64_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:113:17: error: conflicting types for ‘int64_t’
In file included from /usr/include/net/if.h:26:0,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/types.h:198:1: note: previous declaration of ‘int64_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:134:23: error: conflicting types for ‘blkcnt_t’
In file included from /usr/include/net/if.h:26:0,
                 from test.c:2:
/usr/include/x86_64-linux-gnu/sys/types.h:236:20: note: previous declaration of ‘blkcnt_t’ was here
In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/kernel.h:6:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/skbuff.h:17,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_ether.h:23,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:20,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from test.c:3:
/usr/src/linux-headers-3.10.0-031000-generic/include/linux/linkage.h:7:25: fatal error: asm/linkage.h: No such file or directory
compilation terminated.

Then, I did:

gcc -nostdinc -I /usr/src/linux-headers-3.10.0-031000-generic/include/

to don't let gcc to access /usr/include. But it claims again some include files like <net/if.h> not found and by removing that header files, it gives some other not found crap inside the found include files either.

If <net/if.h> is related to c library, it could be right, because make the gcc not to read other include folders. But it reports some not found inside <linux/if_tun.h>

In file included from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/types.h:5:0,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/uapi/linux/if_tun.h:19,
                 from /usr/src/linux-headers-3.10.0-031000-generic/include/linux/if_tun.h:18,
                 from penvpn-multithread-udp.c:3:

So how do I suppose to get over this?

papukaija
  • 2,425
madz
  • 131
  • 5
  • Did you install the header packages for this kernel? => linux-headers-3.10.0-031000-generic_3.10.0-031000.201306301935 – Terry Wang Jul 07 '13 at 10:18
  • Sorry, but mainline Kernels are unsupported and their use is hence not recommended. You'll need to figure out the solution yourself or remove the mainline Kernels. Please see https://wiki.ubuntu.com/Kernel/MainlineBuilds#Kernel.2BAC8-FAQ.2BAC8-DebuggingMainlineBuildsSupport.Does_the_kernel_team_support_the_mainline_kernel_builds.3F and http://askubuntu.com/q/162616/8973 for more details. – papukaija Jul 07 '13 at 10:33
  • @TerryWang yes any of them are in /usr/src/ and the apt-get install linux-headers-3.10.0... says its already installed. – madz Jul 11 '13 at 13:18
  • @papukaija I'll checked out the links you mentioned and obviously not supported. but the problems they mentioned are more about lacking in drivers and so on.but in my case every things work well except maybe the headers are some sort of not completely installed in /usr/src! but the image itself works fine and its weird. and also this fact that the /usr/include has not replaced with new headers is weird too. to be continued... – madz Jul 11 '13 at 13:35
  • I already checked out the changes log in 3.10 and nothing seems to be a problem.for instance, I got one of the flags value from the /usr/src/linux-3.10 and put it in my c code and compiled it without extra codes with using of /usr/include headers(the old 3.5) and after compile the flag worked for 3.10 image! the only problem is the headers installed in /usr/src is somehow not proper for compile time.do you know a place for downloading the source of these pre compiled mainline kernel?so maybe I could extract them somewhere and using them. apt-get install linux-src says its already installed – madz Jul 11 '13 at 13:40
  • some command are shorten because of the limitations. thank you – madz Jul 11 '13 at 13:40

0 Answers0