Skip to content

Commit 9348e35

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 8eacde9 commit 9348e35

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
@@ -516,7 +516,12 @@ pub fn add(
516516
} else {
517517
// gtk4-layer-shell *must* be dynamically linked,
518518
// so we don't add it as a static library
519-
step.linkLibrary(gtk4_layer_shell.artifact("gtk4-layer-shell"));
519+
const sharedLib = gtk4_layer_shell.artifact("gtk4-layer-shell");
520+
const artifact: *std.Build.Step.InstallArtifact = b.addInstallArtifact(sharedLib, .{});
521+
b.getInstallStep().dependOn(&artifact.step);
522+
// Lookup dynamic libs from installed location
523+
step.root_module.addRPathSpecial("$ORIGIN/../lib/");
524+
step.linkLibrary(sharedLib);
520525
}
521526

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

0 commit comments

Comments
 (0)