teknotus / depthview

intel RealSense 3D camera viewer for Linux
GNU Lesser General Public License v2.1
98 stars 38 forks source link

Error compiling udev branch #8

Closed Rennschnitzl closed 9 years ago

Rennschnitzl commented 9 years ago

Hi,

when compiling the udev branch i get the following: fatal error: linux/compiler.h: No such file or directory

so i added " -I ~/linux-3.13.0/include/ " in the makefile. (this is the kernel source i needed for the kernel patch) which got me this:

fatal error: asm/linkage.h: No such file or directory when i add " -I ~/linux-3.13.0/arch/x86/include/ " which is where the file in the sources or " -I /usr/src/linux-headers-3.13.0-57/arch/x86/include/ " i get tons of errors.

i had the same problem a few weeks ago but i cant remember how i did it.

any suggestions?

teknotus commented 9 years ago

Hmm. I didn't think it required any headers from the kernel patch at all. I've used it with a 3.13 kernel as well. Could you paste the actual errors. Maybe that would give me some clues.

Rennschnitzl commented 9 years ago

edit: ubuntu 14.04 lts, btw

uname -r 3.13.0-57-generic

okay, long post incoming: (playground is the folder in which the linux src is - in case it tries to pollute my homefolder. so: ~ <=> /home/rennschnitzl/playground/

without any includes:

make
gcc -Wall  -c realsense_map_controls.c -o realsense_map_controls.o
In file included from realsense_map_controls.c:1:0:
/usr/include/linux/videodev2.h:62:28: fatal error: linux/compiler.h: No such file or directory
 #include <linux/compiler.h>
                            ^
compilation terminated.
make: *** [realsense_map_controls.o] Error 1

with -I ~/linux-3.13.0/include/

make
gcc -Wall -I /home/rennschnitzl/playground/linux-3.13.0/include/  -c realsense_map_controls.c -o realsense_map_controls.o
In file included from /home/rennschnitzl/playground/linux-3.13.0/include/linux/kernel.h:6:0,
                 from /home/rennschnitzl/playground/linux-3.13.0/include/linux/cache.h:4,
                 from /home/rennschnitzl/playground/linux-3.13.0/include/linux/time.h:4,
                 from /home/rennschnitzl/playground/linux-3.13.0/include/linux/videodev2.h:59,
                 from realsense_map_controls.c:1:
/home/rennschnitzl/playground/linux-3.13.0/include/linux/linkage.h:7:25: fatal error: asm/linkage.h: No such file or directory
 #include <asm/linkage.h>
                         ^
compilation terminated.
make: *** [realsense_map_controls.o] Error 1

here it gets tricky... best match i could find is ~/linux-3.13.0/arch/x86/include/asm/linkage.h

[more errors than my shell history]
/usr/include/stdio.h:846:13: error: storage class specified for parameter ‘perror’
 extern void perror (const char *__s);
             ^
In file included from /usr/include/stdio.h:853:0,
                 from realsense_map_controls.c:5:
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:26:12: error: storage class specified for parameter ‘sys_nerr’
 extern int sys_nerr;
            ^
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h:27:26: error: storage class specified for parameter ‘sys_errlist’
 extern const char *const sys_errlist[];
                          ^
In file included from realsense_map_controls.c:5:0:
/usr/include/stdio.h:858:20: error: expected declaration specifiers or ‘...’ before ‘FILE’
 extern int fileno (FILE *__stream) __THROW __wur;
                    ^
/usr/include/stdio.h:863:29: error: expected declaration specifiers or ‘...’ before ‘FILE’
 extern int fileno_unlocked (FILE *__stream) __THROW __wur;
                             ^
/usr/include/stdio.h:873:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
 extern FILE *popen (const char *__command, const char *__modes) __wur;
             ^
/usr/include/stdio.h:879:20: error: expected declaration specifiers or ‘...’ before ‘FILE’
 extern int pclose (FILE *__stream);
                    ^
/usr/include/stdio.h:885:14: error: storage class specified for parameter ‘ctermid’
 extern char *ctermid (char *__s) __THROW;
              ^
/usr/include/stdio.h:913:24: error: expected declaration specifiers or ‘...’ before ‘FILE’
 extern void flockfile (FILE *__stream) __THROW;
                        ^
/usr/include/stdio.h:917:26: error: expected declaration specifiers or ‘...’ before ‘FILE’
 extern int ftrylockfile (FILE *__stream) __THROW __wur;
                          ^
/usr/include/stdio.h:920:26: error: expected declaration specifiers or ‘...’ before ‘FILE’
 extern void funlockfile (FILE *__stream) __THROW;
                          ^
In file included from realsense_map_controls.c:6:0:
/usr/include/x86_64-linux-gnu/sys/ioctl.h:41:12: error: storage class specified for parameter ‘ioctl’
 extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
            ^
realsense_map_controls.c:20:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 int main(int argc, char *argv[]){
                                 ^
In file included from /home/rennschnitzl/playground/linux-3.13.0/include/linux/cache.h:4:0,
                 from /home/rennschnitzl/playground/linux-3.13.0/include/linux/time.h:4,
                 from /home/rennschnitzl/playground/linux-3.13.0/include/linux/videodev2.h:59,
                 from realsense_map_controls.c:1:
/home/rennschnitzl/playground/linux-3.13.0/include/linux/kernel.h:212:6: error: old-style parameter declarations in prototyped function definition
 void do_exit(long error_code)
      ^
realsense_map_controls.c:139:1: error: expected ‘{’ at end of input
 }
 ^
make: *** [realsense_map_controls.o] Error 1

same for this one: /usr/src/linux-headers-3.13.0-57/arch/x86/include/asm/linkage.h

now this: -I /usr/src/linux-headers-3.13.0-57-generic/include/ -I /usr/src/linux-headers-3.13.0-32/arch/x86/include/

make
gcc -Wall -I /usr/src/linux-headers-3.13.0-57-generic/include/ -I /usr/src/linux-headers-3.13.0-32/arch/x86/include/ -c realsense_map_controls.c -o realsense_map_controls.o
In file included from /usr/src/linux-headers-3.13.0-57-generic/include/linux/videodev2.h:64:0,
                 from realsense_map_controls.c:1:
/usr/src/linux-headers-3.13.0-57-generic/include/linux/types.h:14:26: error: conflicting types for ‘fd_set’
 typedef __kernel_fd_set  fd_set;
                          ^
In file included from /usr/include/x86_64-linux-gnu/sys/time.h:29:0,
                 from /usr/src/linux-headers-3.13.0-57-generic/include/linux/videodev2.h:60,
                 from realsense_map_controls.c:1:
/usr/include/x86_64-linux-gnu/sys/select.h:75:5: note: previous declaration of ‘fd_set’ was here
   } fd_set;
     ^
make: *** [realsense_map_controls.o] Error 1
Rennschnitzl commented 9 years ago

Okay, there seems to be a bugged symbolic link, described here. This is why asm/linkage.h cannot be found.

the patched videodev2.h is in /usr/include/linux/videodev2.h but it wants

<linux/compiler.h> 
<asm/linkage.h>

fixing the symbolic link i'm at the point where i can decide which includepath i use for the compiler.h problem

the sources in the homefolder folder and -32 give the following pastebin because of size 57 and 57-generic give the error already mentioned above:

make
gcc -Wall -I /usr/src/linux-headers-3.13.0-57-generic/include/ -c realsense_map_controls.c -o realsense_map_controls.o
In file included from /usr/src/linux-headers-3.13.0-57-generic/include/linux/videodev2.h:64:0,
                 from realsense_map_controls.c:1:
/usr/src/linux-headers-3.13.0-57-generic/include/linux/types.h:14:26: error: conflicting types for ‘fd_set’
 typedef __kernel_fd_set  fd_set;
                          ^
In file included from /usr/include/x86_64-linux-gnu/sys/time.h:29:0,
                 from /usr/src/linux-headers-3.13.0-57-generic/include/linux/videodev2.h:60,
                 from realsense_map_controls.c:1:
/usr/include/x86_64-linux-gnu/sys/select.h:75:5: note: previous declaration of ‘fd_set’ was here
   } fd_set;
     ^
make: *** [realsense_map_controls.o] Error 1
Rennschnitzl commented 9 years ago

Got it.

Problem was: videodev2.h in the sources i got with "apt-get source linux-image-$(uname -r)" had compiler.h included. i used my backup videodev2.h i made from my system before applying the kernel patch and applied the patch on this file. now it works.

way to waste a bunch of hours...