summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBhabu Bindu <bindu.bhabu@kpit.com>2025-03-04 13:46:58 +0530
committerKhem Raj <raj.khem@gmail.com>2025-03-05 06:19:04 -0800
commit0356fab9b788e6071471f82743964aec1775cd71 (patch)
tree6d437fb2f89fc9e129dcd5c4e42bb628ec64c8a1
parent9d003f71a94740ba22840c7f778aa36f8ff7a8cf (diff)
downloadmeta-clang-0356fab9b788e6071471f82743964aec1775cd71.tar.gz
android-tools: Fix library linking issue for img2simg and simg2img
Fix "libsparse.so.0:cannot open shared object file:No such file or directory" error found at runtime on usage of img2simg and simg2img. Modify patches to resolve the issue by updating LDFLAGS to use a relative rpath instead of a fixed path to ensure runtime linking works correcly. Explicitly link additional libraries to resolve dependencies. Signed-off-by: Bhabu Bindu <bindu.bhabu@kpit.com>
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch12
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch12
2 files changed, 16 insertions, 8 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
index ad9b8dd..8ecfdbc 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
@@ -16,7 +16,12 @@ are searched in the output folder.
16 16
17Modified the build rule so that it outputs the binary to the OUT_DIR 17Modified the build rule so that it outputs the binary to the OUT_DIR
18 18
19Update LDFLAGS to use a relative rpath instead of a fixed location
20to ensure libraries are found at runtime relative to binary location.
21Link additional libraries which might help with dependency resolution.
22
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 23Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
24Signed-off-by: Bindu.Bhabu <bindu.bhabu@kpit.com>
20 25
21Upstream-Status: Pending 26Upstream-Status: Pending
22--- 27---
@@ -34,11 +39,10 @@ index f1036cef..94772381 100644
34 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) 39 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source))
35 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 40 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17
36-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 41-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
37- -Wl,-rpath-link=. \ 42+LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib/android' \
43 -Wl,-rpath-link=. \
38- -L. -lsparse 44- -L. -lsparse
39+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 45+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lbase -llog -lpthread -lsparse
40+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
41+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lsparse
42 46
43 build: $(SOURCES) 47 build: $(SOURCES)
44- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS) 48- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS)
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
index b7a72b8..f2f5598 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
@@ -16,7 +16,12 @@ are searched in the output folder.
16 16
17Modified the build rule so that it outputs the binary to the OUT_DIR 17Modified the build rule so that it outputs the binary to the OUT_DIR
18 18
19Update LDFLAGS to use a relative rpath instead of a fixed location
20to ensure libraries are found at runtime relative to binary location.
21Link additional libraries which might help with dependency resolution.
22
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 23Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
24Signed-off-by: Bhabu Bindu <bindu.bhabu@kpit.com>
20 25
21Upstream-Status: Pending 26Upstream-Status: Pending
22--- 27---
@@ -34,11 +39,10 @@ index 07fb56b4..d319c87e 100644
34 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) 39 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source))
35 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 40 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17
36-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 41-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
37- -Wl,-rpath-link=. \ 42+LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib/android' \
43 -Wl,-rpath-link=. \
38- -L. -lsparse 44- -L. -lsparse
39+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 45+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lbase -llog -lpthread -lsparse
40+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
41+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lsparse
42 46
43 build: $(SOURCES) 47 build: $(SOURCES)
44- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS) 48- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS)