Skip to content

stage1: implement --omit-lib-prefix #6325

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

Closed
wants to merge 2 commits into from

Conversation

ifreund
Copy link
Member

@ifreund ifreund commented Sep 11, 2020

When building shared libraries for use as plugins, it is often necessary to follow different naming conventions. Passing the new --omit-lib-prefix flag prevents zig from prefixing the name of generated libraries with "lib" and makes following such conventions possible.

Consider this an alternative to #6317
Closes #2231

When building shared libraries for use as plugins, it is often
necessary to follow different naming conventions. Passing the new
--omit-lib-prefix flag prevents zig from prefixing the name of generated
libraries with "lib" and makes following such conventions possible.
@ifreund
Copy link
Member Author

ifreund commented Sep 11, 2020

I think that even with -femit-bin=foo which is implemented in #6250 this would be worth considering. The advantage to using --omit-lib-prefix over -femit-bin= is that zig is still responsible for determining the proper extension to use based on the target.

@daurnimator
Copy link
Contributor

I think #6317 was the better solution.

@ifreund
Copy link
Member Author

ifreund commented Sep 12, 2020

It should be noted that this isn't strictly necessary to solve #2231 as the -femit-bin=foo.so flag introduced has been introduced in #6250. That plus a way to set the flag from the zig build system would allow output to any arbitrary file name.

Still leaving this open as a proposal of sorts.

@andrewrk
Copy link
Member

There's also the "soname" to consider here. I think I want to leave this open and solve it in (or shortly after) #6250 because I am trying to merge that branch soon, and I would just have to reimplement this again anyway in the branch.

@Mouvedia
Copy link

Mouvedia commented Oct 5, 2020

Is #5861 related?

@andrewrk
Copy link
Member

Instead of this, here's how I see this use case being solved:

  • -femit-bin=filename
  • Use the utility functions of std.Target such as dynamicLibSuffix to create your own filename. Then you have full control over whether to do version numbers, and even whether to override the default and use .so instead of .dylib on macos. Or .a instead of .lib for mingw.

I'll leave #2231 open to track build.zig integration of -femit-bin=foo.

@andrewrk andrewrk closed this Oct 26, 2020
@andrewrk
Copy link
Member

Is #5861 related?

@Mouvedia looks like it, thanks for pointing it out 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Way to set shared library filename
4 participants