Skip to content

The linker path search behavior has changed since 0.11.0 for x86_64-windows-gnu #16811

@haohaolee

Description

@haohaolee

Zig Version

0.11.0

Steps to Reproduce and Observed Behavior

  1. cat libtest.c
int test_add(int a, int b) {
    return a + b;
}
  1. cat test.c
int test_add(int, int);
int main() {
    return test_add(1, 2);
}
  1. zig cc -target x86_64-windows-gnu -c -o libtest.o -fPIC libtest.c
  2. zig ar cr libtest.a libtest.o
zig cc -target x86_64-windows-gnu -L. -Wl,-Bdynamic -ltest test.c
error: unable to find Dynamic system library 'test' using strategy 'no_fallback'. searched paths:
  ./test.dll

Expected Behavior

Build successful. Actually it worked on 0.10.1.

If I change -Wl,-Bdynamic to -Wl,-Bstatic, the build starts working, It seems since 0.11.0, zig cc stops searching '*.a' for -Bdynamic.

But there are so many build systems that generate -Wl,-Bdynamic for "*.a" for at least mingw build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorlinkingos-windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions