Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22016

Why does gcc not see include path?

$
0
0

I'm using Ubuntu 18.04 and gcc 8.3 and when compiling a project which builds an out-of-tree kernel module, I get the following error.

make -C "/usr/src/linux-headers-4.15.18" modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.18'
  CC [M]  /home/dev/el/devices/82e.o
In file included from ./include/linux/compat.h:16,
             from ./include/linux/ethtool.h:17,
             from ./include/linux/netdevice.h:41,
             from /home/dev/el/devices/82e.h:14,
             from /home/dev/el/devices/82e.c:20:
./include/linux/if.h:28:10: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>   /* for struct sockaddr.  */
          ^~~~~~~~~~~~~~ compilation terminated.

Here are the search paths for includes from gcc w/ added comments showing where sys/socket.h exist.

$ gcc -xc -E -v -
...
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed
 /usr/include/x86_64-linux-gnu            # sys/socket.h is here
 /usr/include                             # symlink here to above


$ echo | gcc -Wp,-v -xc - -fsyntax-only
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed
 /usr/x86_64-linux-gnu/include            # sys/socket.h is here
 /usr/include/x86_64-linux-gnu            # sys/socket.h is also here
 /usr/include                             # symlink here points to /usr/include/x86_64-linux-gnu above
End of search list.

Here's my symlink.

$ ls -l /usr/include/sys
lrwxrwxrwx 1 root root 33 Jan 23 16:27 /usr/include/sys -> /usr/include/x86_64-linux-gnu/sys

Any thoughts as to why gcc isn't finding this file?


Viewing all articles
Browse latest Browse all 22016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>