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

Having trouble linking the MoltenVK framework on macOS #51

Open
alansikora opened this issue Mar 25, 2021 · 5 comments
Open

Having trouble linking the MoltenVK framework on macOS #51

alansikora opened this issue Mar 25, 2021 · 5 comments

Comments

@alansikora
Copy link

alansikora commented Mar 25, 2021

When I run go get "github.com/vulkan-go/vulkan", the framework cannot be found:

~/W/A/go-vulkan-engine ❯❯❯ go get "github.com/vulkan-go/vulkan"                                        ✘ 2
# github.com/vulkan-go/vulkan
ld: framework not found MoltenVK
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried copying MoltenVK.xcframework to the /Library/Frameworks folder, symlinking, also with vulkan.framework and I can't make it work.

I also tried to run it with sudo, no luck.

Has anyone run into the same problem?

@ptxmac
Copy link
Contributor

ptxmac commented Apr 1, 2021

It seems MoltenVK switched to use the new xcframework which is great for packaging multiple static libraries for different platforms - unfortunately, it doesn't play nice with clang.

I was able to work around the problem by using the dylib version of MoltenVK, unfortunately that required me to fork vulkan-go/vulkan and vulkan-go/glfw since there's no way to replace the linking flags.

I've created an issue on the MoltenVK project: KhronosGroup/MoltenVK#1328

But perhaps it would make sense to add a way to select framework or dylib in vulkan_darwin.go. E.g. with a build tag

@xlab
Copy link
Member

xlab commented Apr 2, 2021

@ptxmac I'm okay to always follow the bleeding edge. If that's a simple change (and doesn't require full re-gen), then PR is very welcome :)

I don't see the point to use framework version at all..

@ptxmac
Copy link
Contributor

ptxmac commented Apr 2, 2021

The framework version might be useful for creating iOS / tvOS / etc apps - but it shouldn't be a blocker.

Unfortunately, the MoltenVK project only provides make targets for installing the xcframework. So the installation becomes a bit more manual.

I'll put up some PRs with the changes

@ptxmac
Copy link
Contributor

ptxmac commented Apr 2, 2021

For vulkan: #52

And the same change for glfw: vulkan-go/glfw#6

@Nv7-GitHub
Copy link

The Makefile didn't work, however using CGO_CFLAGS="$(pkg-config --cflags glfw3)" CGO_LDFLAGS="-L/usr/local/lib $(pkg-config --libs glfw3)" go build works. (Note the -L/usr/local/lib part)

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

No branches or pull requests

4 participants