-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around relative symlinks that break when replicated inside runfi…
…les (#247) There is an edge case where rules_appimage creates a relative symlink that points to a file or dir which will not exist in the AppDir. This can happen in situations where `.../foo.runfiles/_main/_solib_k8/_U_A_A_Umain~_Urepo_Urules~foo_S_S_Clibfoo.so___Ulib/libfoo.so` is a symlink pointing to "libfoo.so.12" but which will not exist in the same dir but instead lives in `.../foo.runfiles/_main/_solib_k8/_U_A_A_Umain~_Urepo_Urules~foo_S_S_Clibfoo.so.12___Ulib/libfoo.so.12` (note the difference in directory names) For now we just don't create a relative symlink from libfoo.so to libfoo.so.12 but instead copy the resolved libfoo.so twice. mksquashfs will deduplicate it so no additional storage is needed regardless of file size (unless extracted). The downside is that the symlink structure will not look the same as in the source.
- Loading branch information
Showing
6 changed files
with
108 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_import", "cc_library") | ||
|
||
package(default_visibility = ["//tests:__subpackages__"]) | ||
|
||
genrule( | ||
name = "make_libfoo", | ||
srcs = ["foo.S"], | ||
outs = [ | ||
"libfoo.so.1", | ||
"libfoo.so", | ||
], | ||
cmd = "\n".join([ | ||
"$(CC) -nostdlib -fPIC -shared -o $(RULEDIR)/libfoo.so.1 $<", | ||
"$(STRIP) --strip-unneeded $(RULEDIR)/libfoo.so.1", | ||
"ln -s libfoo.so.1 $(RULEDIR)/libfoo.so", | ||
]), | ||
target_compatible_with = ["@platforms//os:linux"], | ||
toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"], | ||
) | ||
|
||
cc_import( | ||
name = "libfoo_so", | ||
shared_library = ":libfoo.so", | ||
) | ||
|
||
cc_import( | ||
name = "libfoo_so_1", | ||
shared_library = ":libfoo.so.1", | ||
) | ||
|
||
cc_library( | ||
name = "libfoo", | ||
deps = [ | ||
":libfoo_so", | ||
":libfoo_so_1", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.section .text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters