Skip to content

build.rs conflicts with downstream projects on Windows (CVT1100: duplicate resource) #373

@lingyaochu

Description

@lingyaochu

The recent change #274 that added winresource to build.rs causes linking failures when pet is used as a library dependency on Windows.

When pet is compiled as a library for another binary crate (e.g. Zed), the build.rs unconditionally executes and embeds a VERSIONINFO resource. If the parent crate also defines its own Windows resources (which is standard for Windows applications), the linker receives two sets of version resources with the same ID (Type: 16, Name: 1), leading to a fatal error.

Below is the error message when I'm trying to build Zed after updating the pet dependency:

CVTRES : fatal error CVT1100: duplicate resource. type: VERSION, name: 1, language: 0x0409
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

The linker is receiving two VERSIONINFO resources: one from zed itself and one from pet's build.rs output. This happens because pet's build.rs does not check if it's being built as a library or a binary.

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