I’m running into an issue that seems to be caused by gcc not finding the headers that come with it. Not knowing much about C/GCC, I figured I’d check whether it’s a safe assumption that the compiler should always be able to find those headers. Perhaps setting -I arguments overrides this? Or something else funky?
Original problem is at this issue in shoes on github.
Original issue
Hi ! I’ve tried building on 10.8, with a non llvm gcc as stated in an
other issue, and by tweaking a bit the rakefile to fetch the correct
sdk in the correct place.BUT
it still won’t compile.
Here’s the beginning of the error report (it’s really long)
new-host-2:shoes benjamingattet$ rake gcc -I. -c -o shoes/app.o -Wall -I/usr/local/include -I/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.0.0 -I/usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1 -I/usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/x86_64-darwin12.0.0 -O -DRUBY_1_9 -DSHOES_QUARTZ -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -fpascal-strings -Os -w -pipe -march=core2 -msse4.1 -mmacosx-version-min=10.8 -fno-common -x objective-c -fobjc-exceptions -isysroot /Developer/SDKs/MacOSX10.8.sdk -arch x86_64 shoes/app.c shoes/app.c:5:18: error: glib.h: No such file or directory In file included from shoes/app.c:6: ./shoes/app.h:13:19: error: cairo.h: No such file or directory In file included from /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby.h:32, from ./shoes/app.h:14, from shoes/app.c:6: /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:48:21: error: string.h: No such file or directory /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:58:21: error: stdint.h: No such file or directory /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:61:23: error: inttypes.h: No such file or directory /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:64:20: error: stdarg.h: No such file or directory /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:65:19: error: stdio.h: No such file or directory In file included from /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:67, from /usr/local/Cellar/ruby/1.9.3-p194/include/ruby-1.9.1/ruby.h:32, from ./shoes/app.h:14,
gcc has a builtin list of directories it searches. And files like
stddef.hshould be in one of these directories. A way to get that list is to compile a file (even an empty one) with –verbose. For instance here that gives:The part which interests you is
where you can see that the builtin path has some non existing directories and then the list of existing directories for both kinds of include directives.
If gcc has been installed at another place than the one it was compiled for, it used to have problems. But ISTR that recent gcc are more robust in those situation and start with the executable path.
At least you know where gcc is looking for files, and you may try to understand why they aren’t there.
Note that gcc doesn’t come with a full C library, only a few headers strongly tied to the implementation like
stddef.handstdarg.hare provided.