Skip to content
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

Inconsistent output of shared libraries on different operating systems #22334

Open
KoT3isGood opened this issue Dec 27, 2024 · 1 comment
Open
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@KoT3isGood
Copy link

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

I’ve made a really small build system for the library:

const lib = b.addSharedLibrary(.{
  .name = "test",
  .target = target,
  .optimize = optimize,
});
lib.addCSourceFiles(.{
  .files = &.{
  //
  "source/main.c",
  },
});
lib.linkLibC();
const lib_artifact = b.addInstallArtifact(lib, .{});
lib_artifact.dest_dir = .{ .custom = "../lib/" };
b.getInstallStep().dependOn(&lib_artifact.step);

When it gets built on linux using zig build everything gets compiled into lib directory.
When it gets built on windows using the same zig build test.dll and test.pdb get compiled into current working directory. At the same time test.lib is inside of lib directory

Expected Behavior

test.dll and test.pdb should be in the same directory with test.lib

@KoT3isGood KoT3isGood added the bug Observed behavior contradicts documented or intended behavior label Dec 27, 2024
@castholm
Copy link
Contributor

Not a bug. Windows DLLs being installed to <prefix>/bin/ and not <prefix>/lib/ is intentional, see #19743 for details.

To override the PDB, header and DLL import library install dirs you need to set the .pdb_dir, .h_dir and .implib_dir options respectively in the options struct you pass to b.addInstsllArtifact.

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
Projects
None yet
Development

No branches or pull requests

2 participants