Skip to content

Commit 5f712d5

Browse files
committed
Fix broken RPath when installing and dynamic linking gtk4-layer-shell
When compiling the dynamic lib and linking, the rpath resolves to the compile cache location instead of the install location for the lib. This resulted in loading the dylib failing when the compile cache was removed or the install location is changed.
1 parent 95daca6 commit 5f712d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/build/SharedDeps.zig

+6-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,12 @@ pub fn add(
510510
} else {
511511
// gtk4-layer-shell *must* be dynamically linked,
512512
// so we don't add it as a static library
513-
step.linkLibrary(gtk4_layer_shell.artifact("gtk4-layer-shell"));
513+
const sharedLib = gtk4_layer_shell.artifact("gtk4-layer-shell");
514+
const artifact: *std.Build.Step.InstallArtifact = b.addInstallArtifact(sharedLib, .{});
515+
b.getInstallStep().dependOn(&artifact.step);
516+
// Lookup dynamic libs from installed location
517+
step.root_module.addRPathSpecial("$ORIGIN/../lib/");
518+
step.linkLibrary(sharedLib);
514519
}
515520

516521
step.linkSystemLibrary2("wayland-client", dynamic_link_opts);

0 commit comments

Comments
 (0)