title: kernel module build fails: sys/types.h: No such file or directory
body: <p>I'm unable to build a kernel module due to a missing .h file. I'm building the module on Ubuntu 14.04.</p>
  
  <p>This is the make file I use:</p>
  
  <pre><code>$ cat Makefile 
  obj-m += my_module.o
  
  all:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
  
  clean:
      make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
  </code></pre>
  
  <p>And this is the output of 'make':</p>
  
  <pre><code>$ make
  make -C /lib/modules/3.13.0-34-generic/build M=/home/user/location modules
  make[1]: Entering directory `/usr/src/linux-headers-3.13.0-34-generic'
    CC [M]  /home/user/location/my_module.o
  /home/user/location/my_module.c:2:23: fatal error: sys/types.h: No such file or directory
   #include &lt;sys/types.h&gt;
                         ^
  compilation terminated.
  </code></pre>
  
  <p>The file sys/types.h exists:</p>
  
  <pre><code>/usr/include/x86_64-linux-gnu/sys/types.h
  </code></pre>
  
  <p>And a test program which includes it compiles:</p>
  
  <pre><code>$ cat test.c 
  #include &lt;sys/types.h&gt;
  #include &lt;stdio.h&gt;
  
  int main()
  {
      printf ("test\n");
      return 0;
  }
  $ gcc -o test test.c 
  $ 
  </code></pre>
  
  <p>I looked at several posts and made sure I have libc6-dev and build-essential installed.</p>
  
  <p>Any ideas?</p>