crystal-lang / crystal_lib

Automatic binding generator for native libraries in Crystal
138 stars 30 forks source link

Include clang system include dir #7

Open ysbaddaden opened 9 years ago

ysbaddaden commented 9 years ago

I failed to convert a C header with a reference to limits.h, because it eventually #include_next the compiler's own limits.h which can't be found.

I think crystal_lib should add this folder automatically to it's search path. The default place, as per the clang tooling documentation, is $(dirname $(which clang-3.5))/../lib/clang/3.5/include but different Linux distributions are putting them in different locations. See https://github.com/Rip-Rip/clang_complete/blob/master/plugin/libclang.py#L28 for example.

luislavena commented 8 years ago

@ysbaddaden could output from clang -print-search-dirs be used?

ysbaddaden commented 7 years ago

I found a solution: calling cc -E - -v </dev/null will print some informations about local paths, most notably the system include paths to search in order (and the default library paths, too).

It works perfectly on Ubuntu Linux with either GCC or clang.