Skip to content

test/cmocka: Run test_graphics_state_stacks_rust on Windows again (LNK2005 on matrix4_*) #2533

Closed

Description

@zackees

#2528 added test_graphics_state_stacks_rust, and on Windows it fails to link (Rust Tier 2 windows-2025-vs2026, run 40401995234):

libobs_rust.lib(obs_graphics-...cgu.4.rcgu.o) : error LNK2005: matrix4_mul already defined in obs.lib(obs.dll)
... matrix4_rotate_aa_i, matrix4_rotate_i, matrix4_scale_i, matrix4_translate3v_i, matrix4_transpose
fatal error LNK1169: one or more multiply defined symbols found

The test calls the matrix4_* exports of obs.dll. The staticlib codegen unit that holds the gs_*_stack_* shims also defines those symbols, so link.exe pulls both. The fix PR skips the target on MSVC to unbreak every PR's Windows lane.

Acceptance: the target builds and runs on windows-2025-vs2026 again, and the AND NOT MSVC guard is removed. Options: have the test reach matrix4 through the staticlib only (don't link the import library's matrix4 symbols); or put the shims in a separate codegen unit or crate; or /FORCE:MULTIPLE if the definitions are known identical (least preferred).

Activity

  1. added
    P2
    size:S
    on Oct 26, 2026
  2. zackees commented on Oct 26, 2026

    @zackees
    MemberAuthor

    A fourth option to try first, since it's a one-line change: put libobs_rust-static before OBS::libobs in target_link_libraries. link.exe resolves the test's references library by library in command-line order. The gs_*_stack_* shims pull in that codegen unit anyway, and it already defines matrix4_*, so with the staticlib first those symbols resolve there and the __imp_-less matrix4_* members of obs.lib are never pulled. Only the symbols libobs alone provides would come from obs.lib. The catch: if the test also needs obs.dll's own matrix4 state (it doesn't; they are pure functions), this would hide it. I can't claim it until this is /ready.

  3. zackees commented on Oct 26, 2026

    @zackees
    MemberAuthor

    /ready
    Triage: the RED is reproducible: remove the if(NOT MSVC) guard in test/cmocka/tests.d/test_graphics_state_stacks.cmake, and windows-2025-vs2026 fails with LNK2005/LNK1169. The acceptance criteria are in the body, there are no open dependencies, and the choice between the listed options is the worker's. P2, size:S.

  4. added
    ready
    on Oct 26, 2026
  5. zackees commented on Oct 26, 2026

    @zackees
    MemberAuthor

    Claiming: #2533. Plan: RED drops the MSVC guard (LNK2005 on windows-2025-vs2026); GREEN links libobs_rust-static ahead of OBS::libobs so matrix4_* resolve from the staticlib's codegen unit; falls back to a separate codegen unit if link order isn't enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2readysize:S

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions