ChameleonRT icon indicating copy to clipboard operation
ChameleonRT copied to clipboard

Explain build process ("Could NOT find Vulkan (missing: Vulkan_LIBRARY Vulkan_INCLUDE_DIR GLSLC)")

Open Abdull opened this issue 1 year ago • 1 comments

I cannot figure out how to build ChameleonRT under Debian 12.

cd /opt/build/
git clone https://github.com/Twinklebear/ChameleonRT.git
# commit a148d2e4ee5906fb7e9b5d8023d64bba29ff3529
# Date:   Wed Mar 13 17:16:20 2024 -0700
#  fix macos brew issue for CI

cd /opt/build/ChameleonRT/

# LunarG vulkan-sdk is set up as per https://vulkan.lunarg.com/doc/sdk/1.3.283.0/linux/getting_started.html
source /opt/build/vulkansdk-linux-x86_64-1.3.283.0/setup-env.sh

echo $VULKAN_SDK
# /opt/build/vulkansdk-linux-x86_64-1.3.283.0/x86_64

echo $PATH
# /opt/build/vulkansdk-linux-x86_64-1.3.283.0/x86_64/bin:$REST_OF_MY_ORIGINAL_PATH

echo $LD_LIBRARY_PATH
# /opt/build/vulkansdk-linux-x86_64-1.3.283.0/x86_64/lib

echo $VK_ADD_LAYER_PATH
# /opt/build/vulkansdk-linux-x86_64-1.3.283.0/x86_64/share/vulkan/explicit_layer.d

cmake . -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=Release -DENABLE_VULKAN=ON --fresh
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Warning (dev) at /usr/share/cmake-3.25/Modules/ExternalProject.cmake:3075 (message):
  The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
  not set.  The policy's OLD behavior will be used.  When using a URL
  download, the timestamps of extracted files should preferably be that of
  the time of extraction, otherwise code that depends on the extracted
  contents might not be rebuilt if the URL changes.  The OLD behavior
  preserves the timestamps from the archive instead, but this is usually not
  what you want.  Update your project to the NEW behavior or specify the
  DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
  robustness issue.
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/ExternalProject.cmake:4185 (_ep_add_download_command)
  cmake/glm.cmake:3 (ExternalProject_Add)
  CMakeLists.txt:21 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Vulkan (missing: Vulkan_LIBRARY Vulkan_INCLUDE_DIR GLSLC)
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  backends/vulkan/cmake/FindVulkan.cmake:184 (find_package_handle_standard_args)
  backends/vulkan/CMakeLists.txt:10 (find_package)

Abdull avatar May 15 '24 23:05 Abdull

It looks like the CMake scripts expects the VULKAN_SDK path to not contain x86_64 (https://github.com/Twinklebear/ChameleonRT/blob/master/backends/vulkan/cmake/FindVulkan.cmake#L76), so could you try setting:

export VULKAN_SDK=/opt/build/vulkansdk-linux-x86_64-1.3.283.0/

and see if it's able to find it then?

Twinklebear avatar May 26 '24 02:05 Twinklebear

It looks like the CMake scripts expects the VULKAN_SDK path to not contain x86_64 (https://github.com/Twinklebear/ChameleonRT/blob/master/backends/vulkan/cmake/FindVulkan.cmake#L76), so could you try setting:

export VULKAN_SDK=/opt/build/vulkansdk-linux-x86_64-1.3.283.0/

and see if it's able to find it then?

Here is my protocol:

source /opt/build/vulkansdk-linux-x86_64-1.3.283.0/setup-env.sh

echo $VULKAN_SDK
# outputs "/opt/build/vulkansdk-linux-x86_64-1.3.283.0/x86_64"

# following @Twinklebear's suggestion, remove VULKAN_SDK's "x86_64" suffix:
export VULKAN_SDK=/opt/build/vulkansdk-linux-x86_64-1.3.283.0/

cd /opt/build/ChameleonRT/

# get latest ChameleonRT git version (as of this writing)
git pull
git show --summary
#   commit 595bdf429ff338acc64cc1caa63215622211b7f5 (HEAD -> master, origin/master, origin/HEAD)
#   Author: Will Usher <[email protected]>
#   Date:   Sat Jul 20 08:50:21 2024 -0700
#   
#       Fix trig identity #22

# create build files:
cmake . -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_BUILD_TYPE=Release -DENABLE_VULKAN=ON --fresh
#   ...
#   -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
#   -- Found Vulkan: /opt/build/vulkansdk-linux-x86_64-1.3.283.0/x86_64/lib/libvulkan.so
#   -- Configuring done
#   -- Generating done
#   -- Build files have been written to: /opt/build/ChameleonRT
# exit code 0, so succeeds this time

# build, leveraging previously generated build files (i.e., Makefiles):
make
#   ...
#   [100%] Linking CXX shared module ../../libcrt_vulkan.so
#   [100%] Built target crt_vulkan
# exit code 0, so succeeds this time

Download and extract models from Morgan McGuire's Computer Graphics Data Archive (as per README.md):

mkdir -p /opt/build/ChameleonRT/models
cd /opt/build/ChameleonRT/models/

wget https://casual-effects.com/g3d/data10/research/model/San_Miguel/San_Miguel.zip
atool -x San_Miguel.zip

https://casual-effects.com/g3d/data10/research/model/dabrovic_sponza/sponza.zip
atool -x sponza.zip

https://casual-effects.com/g3d/data10/research/model/rungholt/rungholt.zip
atool -x rungholt.zip

While the built ./chameleonrt executable does start up and shows the Render Info GUI widget, the actual model scene is pure black (see inlined screenshot):

cd /opt/build/ChameleonRT/
./chameleonrt vulkan models/rungholt/house.obj
#   Loading OBJ: models/rungholt/house.obj
#   Generating light for OBJ scene
#   Scene 'models/rungholt/house.obj':
#   # Unique Triangles: 126.248000 K
#   # Total Triangles: 126.248000 K
#   # Geometries: 40
#   # Meshes: 1
#   # Parameterized Meshes: 1
#   # Instances: 1
#   # Materials: 40
#   # Textures: 2
#   # Lights: 1
#   # Cameras: 0
#   # Samples per Pixel: 1

Screenshot_20240724_093503

Abdull avatar Jul 24 '24 08:07 Abdull

Have you tried other models besides this one? I wonder if it's completely black because the camera is inside the house, there's no ambient light term in the renderer so if no light can get inside the object from the "environment map", it'll be completely black.

Twinklebear avatar Jul 25 '24 02:07 Twinklebear