Skip to content

regression: linking using filename of .so library results in "unable to find library" from zig 0.14 #23287

@chrisirhc

Description

@chrisirhc

Zig Version

0.14.0
(This worked in 0.13.0)

Steps to Reproduce and Observed Behavior

  1. Clone https://github.com/chrisirhc/zig-cc-repro/
  2. Update CXX path in Makefile to point to zig
  3. Run make

Observed:

 % make
./zig/zig-linux-x86_64-0.14.0/zig c++ -fPIC -shared -o mylib.so mylib.cpp
./zig/zig-linux-x86_64-0.14.0/zig c++ -o main main.cpp -L. -l :mylib.so
ld.lld: error: unable to find library -l:mylib.so
make: *** [Makefile:17: main] Error 1

Expected Behavior

Compile successfully.

Description of this behavior

-l :mylib.so should work but it no longer works. The -l xyz.so (without colon :) format only works when the library is in the libxyz.so name format.

ld manual

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorregressionIt worked in a previous version of Zig, but stopped working.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions