Skip to content

[CMake] Name conflict causes a compile error #1241

@SunBlack

Description

@SunBlack

When updating CMake 3.30.1 to 3.31.9 in the vcpkg repository (microsoft/vcpkg#48250), a compilation error occurred with this library here. The reason for the compile error is that vcpkg uses Ninja for compiling, which is highly parallelized. This can cause issues if two targets have the same name, as additional files, such as PDBs, are often created.

Here a library named qjs will be created

add_library(qjs ${qjs_sources})

And here the executable will be renamed to the same name

quickjs/CMakeLists.txt

Lines 305 to 307 in 6a9fe9a

set_target_properties(qjs_exe PROPERTIES
OUTPUT_NAME "qjs"
)

As qjs_exe doesn't link against qjs, assumes that it can be compiled in parallel - because of the same name, the compiler wants to create a PDB with the same name at the same time, which leads to the following issue:

LINK : fatal error LNK1201: error writing to program database 'D:\b\quickjs-ng\x64-windows-static-dbg\qjs.pdb'; check for insufficient disk space, invalid path, or insufficient privilege

The best solution would be to avoid renaming targets so that conflicts do not arise. In the vcpkg repository, we will rename the PDB file as a temporary patch, but this does not prevent possible issues arising from identical file names in other compilers.

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