Header files are not found by GCC

drvlas picture drvlas · Dec 25, 2015 · Viewed 9.8k times · Source

Working with embedded C-projects. There are libraries, include files and so on - for micro controllers. No need for me to use GCC for a host machine and OS (Linux Mint 64 bit). As a rule...

But now I'm trying to compile mspdebug project from a Github - with a GCC of course. And I get an error at the very begin of make:

mspdebug$ make
cc  -DUSE_READLINE  -O1 -Wall -Wno-char-subscripts -ggdb -I. -Isimio -Iformats -Itransport -Idrivers -Iutil -Iui -DLIB_DIR=\"/usr/local/lib/\"  -o util/btree.o -c util/btree.c
util/btree.c:19:20: fatal error: assert.h: No such file or directory
 #include <assert.h>
                    ^
compilation terminated.

I search for the includes in all possible paths (I've got the list of them via gcc -v command) - there are no assert.h file, as well, as stdio.h and so on. Except virtual box directories there is only one place (where GCC does not search includes): /usr/lib/syslinux/com32/include

AFAIK, all standard libs and includes are installed with the GCC. So I try to reinstall GCC (4.8.4) - nothing changes.

What is the normal way to give GCC all standard environment it needs?

Answer

Sam Varshavchik picture Sam Varshavchik · Dec 26, 2015

assert.h is not part of gcc, it's a part of glibc.

Most likely, your Linux distribution puts the system headers into a separate package that you need to install.

Fedora, for examples, puts the header files in the glibc-headers package. However, you can't be using Fedora, because Fedora's gcc package has a dependency on glibc-headers, to make sure that it gets pulled in.

Whatever Linux distribution you're using, you need to research which distribution package will install the system header files you need to build stuff with.