c-for-go icon indicating copy to clipboard operation
c-for-go copied to clipboard

Does not search compiler-specific header directories (Linux)

Open jclc opened this issue 5 years ago • 7 comments

Certain header files, such as stddef.h are compiler and/or version dependent and do not reside in /usr/include for compatibility reasons. c-for-go however does not look for these directories.

Running <gcc/clang> --print-file-name=include will print this compiler-specific include folder. On my system these are /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include and /usr/lib/clang/8.0.0/include for gcc and clang respectively (/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include for mingw32).

This issue prevents github.com/vulkan-go/vulkan from being generated on Linux.

jclc avatar May 14 '19 20:05 jclc

I believe this is what's happening on OSX as well in #49

Noofbiz avatar May 15 '19 01:05 Noofbiz

Have you tried to use -ccincl option? Use built-in sys include paths from a hosted C-compiler. - it will parse output of cpp -v:

E.g. clang under macOS

#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks (framework directory)
End of search list.

Running cpp --print-file-name=include reports only this:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/include

xlab avatar May 16 '19 13:05 xlab

This does fix the issue, but now all uint64s and longs have been changed to uints and ints in Go and C source files respectively (I'm using amd64). Is there a way to change the compiler? cpp points to GCC, while these bindings have presumably been generated using Clang

jclc avatar May 18 '19 21:05 jclc

Bindings are always generated by c-for-go, however it could load some extra includes.

all uint64s and longs have been changed to uints and ints in Go and C source files respectively

C sources are never altered by c-for-go. Anyway, can you just paste some examples?

xlab avatar May 19 '19 17:05 xlab

Kuvakaappaus_2019-05-19_20-47-51 Kuvakaappaus_2019-05-19_20-48-09 Kuvakaappaus_2019-05-19_20-48-27

jclc avatar May 19 '19 17:05 jclc

Also, this file has the same definitions but claims a different path. Don't know if it's related. Kuvakaappaus_2019-05-19_20-51-04

jclc avatar May 19 '19 17:05 jclc

C sources are never altered by c-for-go. Anyway, can you just paste some examples?

Sorry, I meant generated source files (destination files? 🤔).

jclc avatar May 20 '19 02:05 jclc