Skip to content

Vulkan module build fails due to possible typo in vulkan_video.cppm #270

@efymenko

Description

@efymenko

I've encountered issues when trying to build Vulkan with modules. Currently, the project only compiles after modifying vulkan_video.cppm. It seems there might be a typo in the module declaration:

export module vulkan_hpp:video; // current
export module vulkan:video;     // seems correct

This discrepancy prevents the project from building cleanly with modules.

Steps to reproduce:

  1. Attempt to build Vulkan using modules as per the current repository setup;
  2. Observe the build failure;
  3. Apply the change in vulkan_video.cppm to get it to compile.

Expected behavior:

The project should build successfully without manually modifying the module declaration.

Environment:

Vulkan: 1.4.335
libc++: 21.1.6-1
cmake: 4.2.1
clang: 21.1.6
Linux 6.12.63-1-MANJARO

./cmake/VulkanCppModule.cmake

find_package(Vulkan REQUIRED)

set(NAME VulkanCppModule)

add_library(${NAME})
add_library(Vulkan::cppm ALIAS ${NAME})

target_compile_definitions(
    ${NAME}
    PUBLIC
        VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1
        VULKAN_HPP_NO_STRUCT_CONSTRUCTORS=1
        VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING
)


target_include_directories(${NAME} PRIVATE ${Vulkan_INCLUDE_DIR})

target_link_libraries(${NAME} PUBLIC Vulkan::Vulkan)

target_sources(
    ${NAME}
    PUBLIC
    FILE_SET cxx_modules TYPE CXX_MODULES
    BASE_DIRS "${Vulkan_INCLUDE_DIR}"
    FILES
        "${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm"
        "${Vulkan_INCLUDE_DIR}/vulkan/vulkan_video.cppm"
)

./CMakeLists.txt

cmake_minimum_required(VERSION 4.2.1)

set(CMAKE_CXX_COMPILER clang++)

project(SomeProject)

set(CMAKE_CXX_STANDARD 26)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_EXTENSIONS OFF)

add_compile_options(-stdlib=libc++ -fmodule-file=std=/opt/cppm/std.pcm)
add_link_options(-stdlib=libc++ -lc++abi)

include(cmake/VulkanCppModule.cmake)

add_subdirectory(libs)
add_subdirectory(apps)

Precompiled standard module for import std;

clang++ -std=c++26 -stdlib=libc++ --precompile -o /opt/cppm/std.pcm /usr/share/libc++/v1/std.cppm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions