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

packages(vulkansdk) not found - on M2 MacOS #2846

Open
gabriellanzer opened this issue Nov 20, 2023 · 12 comments
Open

packages(vulkansdk) not found - on M2 MacOS #2846

gabriellanzer opened this issue Nov 20, 2023 · 12 comments
Labels

Comments

@gabriellanzer
Copy link

gabriellanzer commented Nov 20, 2023

Xmake Version

2.8.5

Operating System Version and Architecture

macOS Sonoma 14.0

Describe Bug

Either running xrepo install vulkansdk or using add_requires("imgui v1.89.9-docking", {configs = {glfw_vulkan = true}}) in my xmake.lua cannot find the vulkansdk package:

error: The packages(vulkansdk) not found, please run xrepo update-repo first!
error: execv(xmake require -j 10 --extra={system=false} vulkansdk) failed(255)

I tried running xrepo update-repo and updating xmake with xmake update to no avail. Is this package legacy? I can see it exists in the GitHub repo.

Expected Behavior

To be able to download and install vulkansdk package as it's in the Github repo.

Project Configuration

add_rules("plugin.vsxmake.autoupdate")
add_rules("plugin.compile_commands.autoupdate")

add_rules("mode.debug", "mode.release")

add_requires("glm 0.9.9+8", {alias = "glm"})
add_requires("glfw", "glad", "fmt", "glslang", "vulkan-headers", "volk")
add_requires("imgui v1.89.9-docking", {configs = {glfw_opengl3 = true, glfw_vulkan = true}})

target("MyProject-0.0.1")
    set_kind("binary")
    add_packages("glm", "imgui", "glfw", "glad", "fmt",
                 "glslang", "vulkan-headers", "volk")

    add_includedirs("src")

    add_headerfiles("src/**.h")

    add_files("src/**.cpp", "src/**.c*")

    set_languages("c++20")

    add_defines("USE_STL_LIB")
    -- add_defines("USE_EASTL_LIB");

    if is_mode("debug") then
	    set_targetdir("bin/Debug/")
    elseif is_mode("release") then
	    set_targetdir("bin/Release/")
    end
target_end()

Additional Information and Error Logs

No more information needed.

@gabriellanzer gabriellanzer changed the title The packages(vulkansdk) not found - on M2 MacOS packages(vulkansdk) not found - on M2 MacOS Nov 20, 2023
@Latias94
Copy link
Contributor

Have you install the vulkan sdk on your system? vulkansdk requires a manual installation with environment variable VULKAN_SDK set. check find_vulkansdk.lua

@gabriellanzer
Copy link
Author

Yes! I have it installed and tried adding the SDK to the path. It doesn't look like find_vulkansdk.lua is doing proper checks for Apple... I will study it a little more during the week and might propose some adjustments.

@gabriellanzer
Copy link
Author

gabriellanzer commented Nov 20, 2023

I built xmake from source and I am trying to add a breakpoint following the debugging instructions but emmylua_debugger package is trying to hookup the x86_64 dsym...

xrepo env -b emmylua_debugger xrepo install vulkansdk
checking for platform ... macosx
checking for architecture ... arm64
checking for Xcode directory ... /Applications/Xcode.app
checking for Codesign Identity of Xcode ... no
checking for SDK version of Xcode for macosx (arm64) ... 13.3
checking for Minimal target version of Xcode for macosx (arm64) ... 13.3
error: dlopen(/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib, 0x0006): tried: '/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib' (no such file), '/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
error: execv(xrepo install) failed(255)

Any idea on how to get it working so I can get more debug info? Or perhaps other commands? I tried copying the x86_64 symbol from the vscode extension to the package folder but the error was another one then (I can't recall which one).

I reckon that there is a specific folder inside the Vulkan SDK called macOS. In that folder I can find the folders bin, include, lib, source, etc. I tried pointing the SDK path to that folder but it still didn't work.

@gabriellanzer
Copy link
Author

To be honest, I don't see why imgui would need vulkansdk, the vulkan-headers should suffice... I will try to work around this issue by creating a local repo and overriding imgui behavior to depend on the headers instead. If this works I imagine I can open a PR to submit the changes. Regardless of that, the vulkansdk is still complicated to get working.

@waruqi
Copy link
Member

waruqi commented Nov 21, 2023

To be honest, I don't see why imgui would need vulkansdk, the vulkan-headers should suffice... I will try to work around this issue by creating a local repo and overriding imgui behavior to depend on the headers instead. If this works I imagine I can open a PR to submit the changes. Regardless of that, the vulkansdk is still complicated to get working.

you enabled vulkan config, {configs = {glfw_vulkan = true}}

Either running xrepo install vulkansdk or using add_requires("imgui v1.89.9-docking", {configs = {glfw_vulkan = true}}) in my xmake.lua cannot find the vulkansdk package:

if package:config("glfw_vulkan") then

add_requires("vulkansdk")

@waruqi
Copy link
Member

waruqi commented Nov 21, 2023

I built xmake from source and I am trying to add a breakpoint following the debugging instructions but emmylua_debugger package is trying to hookup the x86_64 dsym...

xrepo env -b emmylua_debugger xrepo install vulkansdk
checking for platform ... macosx
checking for architecture ... arm64
checking for Xcode directory ... /Applications/Xcode.app
checking for Codesign Identity of Xcode ... no
checking for SDK version of Xcode for macosx (arm64) ... 13.3
checking for Minimal target version of Xcode for macosx (arm64) ... 13.3
error: dlopen(/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib, 0x0006): tried: '/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib' (no such file), '/Users/gkann/.xmake/packages/e/emmylua_debugger/1.6.3/99ef8b20e2c04f679c155dae63e8429e/bin/emmy_core.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
error: execv(xrepo install) failed(255)

Any idea on how to get it working so I can get more debug info? Or perhaps other commands? I tried copying the x86_64 symbol from the vscode extension to the package folder but the error was another one then (I can't recall which one).

I reckon that there is a specific folder inside the Vulkan SDK called macOS. In that folder I can find the folders bin, include, lib, source, etc. I tried pointing the SDK path to that folder but it still didn't work.

you can add print logs to debug here.

local vulkansdk = find_vulkansdk()

https://github.com/xmake-io/xmake/blob/master/xmake/modules/detect/sdks/find_vulkansdk.lua

@Latias94
Copy link
Contributor

To be honest, I don't see why imgui would need vulkansdk, the vulkan-headers should suffice... I will try to work around this issue by creating a local repo and overriding imgui behavior to depend on the headers instead. If this works I imagine I can open a PR to submit the changes. Regardless of that, the vulkansdk is still complicated to get working.

you enabled vulkan config, {configs = {glfw_vulkan = true}}

Either running xrepo install vulkansdk or using add_requires("imgui v1.89.9-docking", {configs = {glfw_vulkan = true}}) in my xmake.lua cannot find the vulkansdk package:

if package:config("glfw_vulkan") then

add_requires("vulkansdk")

Should we make imgui and cimgui depend on vulkan-headers instead of vulkansdk?

@gabriellanzer
Copy link
Author

Thanks! What I mean by "I don't see why imgui would need vulkansdk" is that internally it doesn't seem to depend on anything that is not provided by vulkan-headers. So if the xmake.lua file for the imgui package would be changed to add_requires("vulkan-headers") instead of add_requires("vulkansdk") the dependencies would be less bloated.

@waruqi
Copy link
Member

waruqi commented Nov 21, 2023

Thanks! What I mean by "I don't see why imgui would need vulkansdk" is that internally it doesn't seem to depend on anything that is not provided by vulkan-headers. So if the xmake.lua file for the imgui package would be changed to add_requires("vulkan-headers") instead of add_requires("vulkansdk") the dependencies would be less bloated.

You can try.

And idea? @AidanSun05 @qudix

@AidanSun05
Copy link
Contributor

I tried installing a version of imgui that depended on vulkan-headers instead of vulkansdk. I could get it to install successfully, but when I tried to compile the example code with GLFW+Vulkan, I ran into "unresolved external symbol" linker errors because vulkan-headers only provides the Vulkan functions but not the SDK and the definitions (which vulkansdk does). While you can certainly remove the dependency on vulkansdk for imgui, you can't get rid of it completely in your project as it still provides libraries which you should link into.

@gabriellanzer
Copy link
Author

Ah yes. I guess that makes sense... If you have your existing Vulkan application and you want to integrate ImGUI you wouldn't use their implementation. But that sort of defeated the purpose of having a fully functional package. Sorry for the misleading suggestion. I didn't have the time to debug MacOS further yet... I ended up copy-pasting the ImGui files instead.

@SnowinterCat
Copy link
Contributor

SnowinterCat commented Dec 25, 2023

Maybe you can try adding this line of code before all add_requires:
add_requires("vulkansdk")
Then try recompiling it.

If that doesn't work, change the name of the current project (e.g. Project to Project1), then create a new project called Project, then copy the original code and the modified xmake.lua and recompile it.

I couldn't find vulkansdk on Windows and ubuntu 20.04 before. it's because I added this line in xmake.lua:
add_requires("vulkansdk", {configs = {shared = true}})
When I saw add_require("vulkansdk") don't take any parameter in other issues, I changed xmake.lua and still couldn't find vulkansdk.

but I created a new project and suddenly I found that the new project could find vulkansdk. That's what solved the problem.

I hope my previous manager and method can help you.

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

No branches or pull requests

5 participants