Skip to content

static libraries can be picked up instead of system libraries when -l is used #14963

Description

@andrewrk

Extracted from #14647.

Zig Version

0.11.0-dev.2148+b3af5d076

Steps to Reproduce and Observed Behavior

The test case from 4efeeaa passes.

In particular, test_exe.linkSystemLibrary("a"); // force linking liba.a as -la.

Expected Behavior

I expect -l to link dynamic libraries, and static libraries to be put on the command line as positional arguments. I don't want the linker to decide whether to link statically or dynamically. It's too late at that point. I want the frontend to decide whether a library is linked statically or dynamically.

There should never be any ambiguity. -l should always dynamically link, and positional arguments are already unambiguous.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions