Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
Did you install the header packages for this kernel? => linux-headers-3.10.0-031000-generic_3.10.0-031000.201306301935 –  Terry Wang Jul 7 '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 wiki.ubuntu.com/Kernel/… and askubuntu.com/q/162616/8973 for more details. –  papukaija Jul 7 '13 at 10:33
    
thank you guys for replying and helping me. –  pendrive Jul 11 '13 at 13:13
    
@TerryWang yes any of them are in /usr/src/<headers name here> and the apt-get install linux-headers-3.10.0... says its already installed. –  pendrive 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... –  pendrive Jul 11 '13 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.