vulkan-go / vulkan

Vulkan API bindings for Go programming language
MIT License
744 stars 56 forks source link

fails to build on Ubuntu 16.10 #2

Closed nergdron closed 7 years ago

nergdron commented 7 years ago

Just trying to install this library with "go get", and it's having problems finding all the function definitions for the C Vulkan library:

$ go get -v github.com/vulkan-go/vulkan
github.com/vulkan-go/vulkan
# github.com/vulkan-go/vulkan
/tmp/go-build113185610/github.com/vulkan-go/vulkan/_obj/init.cgo2.o: In function `_cgo_2f542f46001b_Cfunc_vkInit':
../../../go/src/github.com/vulkan-go/vulkan/init.go:50: undefined reference to `vkInit'
/tmp/go-build113185610/github.com/vulkan-go/vulkan/_obj/init.cgo2.o: In function `_cgo_2f542f46001b_Cfunc_vkInitInstance':
../../../go/src/github.com/vulkan-go/vulkan/init.go:68: undefined reference to `vkInitInstance'
/tmp/go-build113185610/github.com/vulkan-go/vulkan/_obj/vk_bridge.o: In function `callVkCreateInstance':
../../../go/src/github.com/vulkan-go/vulkan/vk_bridge.c:8: undefined reference to `vgo_vkCreateInstance'
/tmp/go-build113185610/github.com/vulkan-go/vulkan/_obj/vk_bridge.o: In function `callVkDestroyInstance':
../../../go/src/github.com/vulkan-go/vulkan/vk_bridge.c:14: undefined reference to `vgo_vkDestroyInstance'
/tmp/go-build113185610/github.com/vulkan-go/vulkan/_obj/vk_bridge.o: In function `callVkEnumeratePhysicalDevices':
../../../go/src/github.com/vulkan-go/vulkan/vk_bridge.c:21: undefined reference to `vgo_vkEnumeratePhysicalDevices'
[...]

It doesn't seem to be resolving the headers properly, either the system ones (via libvulkan-dev package) or via the header files you've included in the repo under /vulkan. Any ideas?

xlab commented 7 years ago

Hi!

Sorry, the desktop linux is the last platform I hadn't added yet.

The only linux target available for now is the compute one, where surface isn't created. For proper desktop linux support I'll add GLFW as well to create the surface, probably will go back to that in a few weeks.

You can add this by yourself, see Darwin / Windows examples, they are simple.

xlab commented 7 years ago

P. S. the problem is that it doesn't link to the bridge code, because bridges have build constraints.

xlab commented 7 years ago

Nevermind, adding support is not so simple on a second thought, I guess you'll need to wait a bit :P

You can run it on your iOS/ Android smartphone meanwhile :3

jfreymuth commented 7 years ago

Actually it is quite simple: add a linux build constraint to vk_wrapper_desktop.c add https://gist.github.com/jfreymuth/da6eb6516a9d01df123e7afb74138aff

xlab commented 7 years ago

@jfreymuth Thanks, this is good for initial support!

The full cover though includes some code generation for XCB/Wayland/Mir headers (all that extra code in wrappers, as in windows for example) and testing. I'll do that later.

@nergdron Can you check if it works for you? GLFW needs to be installed, at least 3.2.

nergdron commented 7 years ago

Yeah, this solves my build problems anyway. Looks good to start with, thanks!