moonvulkan icon indicating copy to clipboard operation
moonvulkan copied to clipboard

lua: hello.lua:3: module 'moonvulkan' not found:

Open filu34 opened this issue 3 years ago • 4 comments

$ lua hello.lua lua: hello.lua:3: module 'moonvulkan' not found: no field package.preload['moonvulkan'] no file '/usr/share/lua/5.4/moonvulkan.lua' no file '/usr/share/lua/5.4/moonvulkan/init.lua' no file '/usr/lib/lua/5.4/moonvulkan.lua' no file '/usr/lib/lua/5.4/moonvulkan/init.lua' no file './moonvulkan.lua' no file './moonvulkan/init.lua' no file '/usr/lib/lua/5.4/moonvulkan.so' no file '/usr/lib/lua/5.4/loadall.so' no file './moonvulkan.so' stack traceback: [C]: in function 'require' hello.lua:3: in main chunk [C]: in ?

Instructions from README.md aren't clear. How to bind it with Vulkan?

filu34 avatar May 20 '22 18:05 filu34

Can't say much from this error message, except that Lua did not find MoonVulkan's files where they are supposed to be installed. This may be have different causes. Either

  • you did not install MoonVulkan, or
  • you did not build MoonVulkan for the Lua version you are using (5.4), or
  • you installed MoonVulkan in a non-standard location which Lua isn't aware of.

Did the installation process go smooth, or did it give you some errors of any kind?

As for the last question, MoonVulkan loads the Vulkan loader (a shared object) at runtime using dlopen, and then retrieves the function pointers of the Vulkan API commands as explained in the Vulkan manual. The above error has nothing to do with this, though, since MoonVulkan did not start to begin with.

stetre avatar May 20 '22 20:05 stetre

$ sudo make install

make[1]: Entering directory '/home/user/moonvulkan/src' 'moonvulkan.h' -> '/usr/local/include/moonvulkan.h' '../moonvulkan/constructors.lua' -> '/usr/local/share/lua/5.4/moonvulkan/constructors.lua' 'moonvulkan.so' -> '/usr/local/lib/lua/5.4/moonvulkan.so' '/usr/local/lib/libmoonvulkan.so' -> '/usr/local/lib/lua/5.4/moonvulkan.so' make[1]: Leaving directory '/home/user/moonvulkan/src'

And make itself didn't throw any errors.

$ pacman -Q | grep "vulkan"

lib32-vulkan-icd-loader 1.3.213-1 lib32-vulkan-intel 22.0.3-1 vulkan-headers 1:1.3.213-1 vulkan-icd-loader 1.3.213-1 vulkan-intel 22.0.3-1 vulkan-tools 1.3.213-1

$ sudo pacman -S vulkan-devel

:: There are 7 members in group vulkan-devel: :: Repository extra

  1. spirv-tools 2) vulkan-extra-layers 3) vulkan-extra-tools
  2. vulkan-headers 5) vulkan-html-docs 6) vulkan-tools
  3. vulkan-validation-layers

filu34 avatar May 20 '22 22:05 filu34

Does it indicate that I need to install and configure Vulkan SDK as in https://vulkan.lunarg.com/doc/sdk/1.3.211.0/linux/getting_started.html ?

filu34 avatar May 20 '22 22:05 filu34

Does it indicate that I need to install and configure Vulkan SDK as in https://vulkan.lunarg.com/doc/sdk/1.3.211.0/linux/getting_started.html ?

Yes. And of course you need vulkan-capable driver(s) for your device(s). This is actually indicated in the readme (see the Getting and installing section).

Back to the original problem. By comparing the error message in your first post, and the output of the install command, you can see that the Lua interpreter doesn't look for the moonvulkan files in the paths where they are installed, which are subfolders of /usr/local (you can see where Lua searches for modules by printing out the package.path and package.cpath variables).

To fix this problem you can either:

  • add the /usr/local paths to the Lua search paths (see the Lua manual for details), or
  • reinstall moonvulkan with a different prefix than the default /usr/local. In your case, this should do: $ sudo make PREFIX=/usr install

stetre avatar May 21 '22 08:05 stetre