vulkan-guide icon indicating copy to clipboard operation
vulkan-guide copied to clipboard

Trying to compile Engine branch but get errors

Open Gunnl opened this issue 2 years ago • 12 comments

third-party/imgui/imgui_impl_sdl.cpp:50:10: fatal error: SDL.h: No such file or directory
   50 | #include <SDL.h>
      |          ^~~~~~~
compilation terminated.
make[2]: *** [third-party/CMakeFiles/imgui.dir/build.make:160: third-party/CMakeFiles/imgui.dir/imgui/imgui_impl_sdl.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:392: third-party/CMakeFiles/imgui.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Gunnl avatar Nov 29 '21 13:11 Gunnl

not sure if this it the most elegant solution however, to circumvent this I have added

find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})

to the CMakeLists.txt root file.

Gunnl avatar Nov 29 '21 13:11 Gunnl

This however results in another error:

make[2]: *** No rule to make target '../libs/Release/nvtt.lib', needed by 'baker'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:446: asset-baker/CMakeFiles/baker.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

my limited knowledge of CMake isn't helping me ... from what I can read the target_link_libraries from nvtt should automatically include the paths for the library and headers .... I have tried to force it by including them in the asset-baker CMakeLists.txt file ... it works for the library path but not for the headers... which is resulting in:

asset-baker/asset_main.cpp:22:10: fatal error: nvtt.h: No such file or directory
   22 | #include <nvtt.h>

... ran out of ideas for now...

Gunnl avatar Nov 29 '21 13:11 Gunnl

Also, .. forgot to mention .. there is a compile error:

ssetlib/asset_loader.cpp:70:13: error: ‘strcmp’ was not declared in this scope
   70 |         if (strcmp(f, "LZ4") == 0)

that you can easily fix by including the required header

and I also had some issue with the itoa function calls on asset-baker/asset_main.cpp ... those require replacing as well.

Gunnl avatar Nov 29 '21 16:11 Gunnl

+1 i'm hitting the same issue

tysonmalchow avatar Dec 06 '21 01:12 tysonmalchow

@Gunnl , @tysonmalchow what platform are you using it from? The code was checked for compile in visual studio, but maybe the problem is in clang or gcc.

vblanco20-1 avatar Dec 06 '21 18:12 vblanco20-1

Yeah... i found it that later... I am running linux (arch linux) ... I decided to drop the comment anyway, perhaps will help someone in future...

Gunnl avatar Dec 06 '21 19:12 Gunnl

if you do not wish to use include_directories, you can also simply do SDL2/sdl.h instead

Piras314 avatar Jul 25 '22 14:07 Piras314

ninja: error: '../libs/Debug/nvtt.lib', needed by '../bin/baker.exe', missing and no known rule to make it I got the same error ,can't run the engine branch,how did you solve it ?

I got the error whe I try to run exra exe on windows : [00:00]?[38;2;255;255;255m[INFO] ?[0mEngine Init [00:00.002]?[38;2;144;238;144m[SUCCESS] ?[0mSDL inited [00:01.361]?[38;2;144;238;144m[SUCCESS] ?[0mVulkan Instance initialized [00:01.362]?[38;2;144;238;144m[SUCCESS] ?[0mSDL Surface initialized [00:01.371]?[38;2;144;238;144m[SUCCESS] ?[0mGPU found [00:01.459]?[38;2;255;255;255m[INFO] ?[0mThe gpu has a minimum buffer alignement of 64 [00:01.531]?[38;2;255;255;255m[INFO] ?[0mEngine Initialized, starting Load Error when loading texture ../../assets_export/Sponza/white.tx [00:01.532]?[38;2;220;020;060m[ERROR] ?[0mError When texture white at path ../../assets_export/Sponza/white.tx [00:01.533]?[38;2;255;255;255m[INFO] ?[0mBuilt New Material textured [00:01.533]?[1m?[38;2;220;020;060m[FATAL] ?[0mError When loading prefab file at path ../../assets_export/FlightHelmet/ FlightHelmet.pfb

So I supposed I should use the baker to exe to export asset ? but the baker won't run

Ribosome2 avatar Aug 05 '22 00:08 Ribosome2

Unfortunately, I have same error as OP and I am trying to use VSCode on Widows 11. I did not install SDL separately, but I see it is installed with Vulkan. Do I need to do anything extra to install SDL?

dsvua avatar Mar 21 '24 01:03 dsvua

For anyone having similar issue with VSCode and SDL, those are steps to make it working:

  1. Download SDL-devel-x.xx.x-VC file and extract it.
  2. Copy ..cmake\sdl2-config.cmake to root.
  3. Update line set(sdl2_DIR "SDL_PATH" CACHE FILEPATH "Path to SDL2") in third_party\CMakeLists.txt in vulkan-guide. Now you should be able to compile.

For example:

  1. I downloaded SDL2-devel-2.30.1-VC version
  2. Copied sdl2-config.cmake from C:\Users\some_user\Downloads\SDL2-devel-2.30.1-VC\SDL2-2.30.1\cmake to C:\Users\some_user\Downloads\SDL2-devel-2.30.1-VC\SDL2-2.30.1
  3. Update line set(sdl2_DIR "SDL_PATH" CACHE FILEPATH "Path to SDL2") in third_party\CMakeLists.txt in vulkan-guide to look like set(sdl2_DIR "C:/Users/some_user/Downloads/SDL2-devel-2.30.1-VC/SDL2-2.30.1" CACHE PATH "Path to SDL2")

dsvua avatar Mar 21 '24 02:03 dsvua

@dsvua the engine branch is heavily outdated, i dont recomend trying to make it run, and its missing the assets. I havent removed it only because it contains the shaders for the gpu-driven chapter

vblanco20-1 avatar Mar 21 '24 09:03 vblanco20-1

Thank you. I switched to all-chapters-1.3-wip and so far so good. No need for manual changes as it already have SDL in third-party folder.

dsvua avatar Mar 22 '24 01:03 dsvua