Closed postspectacular closed 6 years ago
Have you tried following the instructions at https://github.com/vulkan-go/demos#how-to-run-on-desktops? It has some special instructions for building on macOS.
@shurcooL thanks, I didn't see those, doh! But even so and also after putting in the correct GLFW paths, there are other issues with a first build and just documenting here for the record:
glfw
only (not glfw3
)Paths for homebrew based installs:
GLFW_INCLUDE_DIR = "/usr/local/Cellar/glfw/3.2.1/include/GLFW"
GLFW_LIB_DIR = "/usr/local/lib"
MoltenVK.framework
seemingly must be copied to /Library/Frameworks
. I did try setting similar vars as for GLFW, but to no avail. always got linker errors...Now the only errors left are the following "missing symbols" issues (the same ld errors are repeated for the vulkan-go/glfw/v3.3/glfw
build step):
make build
CGO_CFLAGS="-I"/usr/local/Cellar/glfw/3.2.1/include/GLFW" -g -O2" CGO_LDFLAGS="-L"/usr/local/lib" -g -O2 -v" go build
# github.com/vulkan-go/vulkan
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o $WORK/b025/_cgo_.o -L/usr/local/lib -L/usr/local/Cellar/glfw/3.2.1/lib $WORK/b025/_cgo_main.o $WORK/b025/_x001.o $WORK/b025/_x002.o $WORK/b025/_x003.o $WORK/b025/_x004.o $WORK/b025/_x005.o $WORK/b025/_x006.o $WORK/b025/_x007.o $WORK/b025/_x008.o $WORK/b025/_x009.o $WORK/b025/_x010.o $WORK/b025/_x011.o -framework Cocoa -framework IOKit -framework QuartzCore -framework Metal -framework MoltenVK -lc++ -lglfw -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.osx.a
ld: warning: text-based stub file /System/Library/Frameworks//QuartzCore.framework/QuartzCore.tbd and library file /System/Library/Frameworks//QuartzCore.framework/QuartzCore are out of sync. Falling back to library file for linking.
Undefined symbols for architecture x86_64:
"_IOSurfaceCreate", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_IOSurfaceGetBytesPerElement", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_IOSurfaceGetElementHeight", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_IOSurfaceGetElementWidth", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_IOSurfaceGetHeight", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_IOSurfaceGetWidth", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_kIOSurfaceBytesPerElement", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_kIOSurfaceElementHeight", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_kIOSurfaceElementWidth", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_kIOSurfaceHeight", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_kIOSurfaceIsGlobal", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
"_kIOSurfaceWidth", referenced from:
MVKImage::useIOSurface(__IOSurface*) in MoltenVK(MoltenVK-x86_64-master.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@postspectacular https://developer.apple.com/documentation/iosurface/kiosurfacewidth
Seems that MoltenVK now uses the new framework IOSurface
, should be added here I think:
https://github.com/vulkan-go/vulkan/blob/master/vulkan_darwin.go#L8
I'm not sure how to be compatible with older OS X versions though...
Thanks @xlab! That means I will have to wait with getting into this until I'm allowed to update my OSX due to company policies :( (not your problem!)
@postspectacular or just try to download previous version of MoltenVK, I used 0.16 as far as I can remember.. that one didn't rely on IOSurface.
@xlab adding -framework IOSurface
in both vulkan & glfw repos worked a treat! PRs incoming in a few minutes. thanks so much!
@xlab - thanks for accepting the PRs. I did try obtaining an older version of MVK as you recommended, but even the very first version of MVKImage checked in to GH relies on IOSurface
... the version 0.16 you mentioned must have been from before they made MoltenVK open source
You're right, I've been using the proprietary version of MoltenVK.
Hi, with the official deprecation announcement of OpenGL for OSX, I started looking into this exiciting project, but am getting struck down cold by the very first initial step:
I just have built MoltenVK and verified it works by running some demos, but it doesn't seem their build process installs the framework globally. Do you have any docs or config options for a) installing that framework for vulkan-go to find and/or b) specify library/include paths for vulkan-go to search in? Thanks!