Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate bindings on Linux #46

Open
jclc opened this issue Jul 1, 2020 · 6 comments
Open

Unable to generate bindings on Linux #46

jclc opened this issue Jul 1, 2020 · 6 comments

Comments

@jclc
Copy link
Member

jclc commented Jul 1, 2020

I would like to update the bindings to the latest version but the code generation script fails with the following error:

[jclc@nakkimuki vulkan]$ make
c-for-go -ccdefs -out .. vulkan.yml
  processing vulkan.yml ⠋[ERR] vulkan/vk_platform.h:71:10: include file not found: stddef.h. Search paths:
	/usr/include
	/home/jclc/devel/vulkan
	/usr/include
	/home/jclc/devel/vulkan (and 1 more errors)
make: *** [Makefile:2: all] Error 1

I believe this was related to a c-for-go issue where the script expects all headers to be located in /usr/include. On Linux compiler-specific headers such as this are located in subdirectories such as /lib/gcc/<target>/<version>/include for gcc and /lib/clang/<version>/include for clang to avoid conflicts.

The code generation script should query the compiler for include directories instead of assuming only one path.

@jclc
Copy link
Member Author

jclc commented Jul 11, 2020

Turns out c-for-go supported compiler-specific include dirs all along, I just had to enable the -ccincl flag! The only problem is that the resultant files now have int and uint in place of every int64 and uint64, even when the headers clearly use explicit types like https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkDeviceSize.html. Any clue what could be causing this?

@jclc
Copy link
Member Author

jclc commented Jul 11, 2020

There are also some errors related to new types/enums/functions, it is unclear to me how vulkan.yml should be edited to accomodate changes. Perhaps a short contribution guide could be added in the readme?

@nickswang
Copy link

@jclc Have you made any progress with this? The Vulkan version supported by the bindings here is officially 1.18

@jclc
Copy link
Member Author

jclc commented Sep 21, 2020

The issue here is that the bindings generator https://github.com/xlab/c-for-go isn't producing the same results on different operating systems. I haven't had the time to delve deeper into the root cause of the issue.

@xlab
Copy link
Member

xlab commented Nov 15, 2020

@jclc regarding int/uint issues, I hope this commit will help to generate more consistent code:

xlab/c-for-go@ddcfe26

@lentus
Copy link

lentus commented Jan 5, 2021

Took a shot at regenerating the bindings, it seems like some uint/uint8/uint64/long are changed to uint32. Go build runs fine though (Ubuntu 20.04, Go 1.15.1, gcc 9.3.0 in case that's relevant). You can find my fork here: lentus@fc4636f.

Also tried generating bindings for Vulkan 1.2.166, but ran into some issues when doing go build. As jclc commented it is not entirely clear to me how I should edit the vulkan.yml to get this fixed, I'll give it another try sometime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants