Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chrisirhc opened this issue Mar 18, 2025 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working.
Milestone

Comments

@chrisirhc
Copy link

chrisirhc commented Mar 18, 2025

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

@chrisirhc chrisirhc added the bug Observed behavior contradicts documented or intended behavior label Mar 18, 2025
@chrisirhc chrisirhc changed the title linking using filename results in file not found from zig 0.14 linking using filename results in "unable to find library" from zig 0.14 Mar 18, 2025
@chrisirhc chrisirhc changed the title linking using filename results in "unable to find library" from zig 0.14 regression: linking using filename results in "unable to find library" from zig 0.14 Mar 18, 2025
@chrisirhc chrisirhc changed the title regression: linking using filename results in "unable to find library" from zig 0.14 regression: linking using filename of .so library results in "unable to find library" from zig 0.14 Mar 19, 2025
@alexrp alexrp added the regression It worked in a previous version of Zig, but stopped working. label Mar 19, 2025
@alexrp alexrp added this to the 0.14.1 milestone Mar 19, 2025
@andrewrk andrewrk modified the milestones: 0.14.1, 0.15.0 Apr 15, 2025
@chrisirhc
Copy link
Author

Might be fixed via #19818 as it sounds related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working.
Projects
None yet
Development

No branches or pull requests

3 participants