Commit 22c1deb1 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Add check for missing sysroot libraries

Linking on arm64 can fail when dependent libraries are missing.
That is, when linking against liba which depends on libb, linking
will fail when only libb is missing.

This CL adds a check to prevent these types of missing libraries.

BUG=webrtc:8535
R=thestig@chromium.org

Change-Id: I14e15ce534bd8ac5602f84dedcaab2db041656fb
Reviewed-on: https://chromium-review.googlesource.com/773200Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517222}
parent 04a86be7
...@@ -420,6 +420,59 @@ CleanupJailSymlinks() { ...@@ -420,6 +420,59 @@ CleanupJailSymlinks() {
cd "$SAVEDPWD" cd "$SAVEDPWD"
} }
VerifyLibraryDepsCommon() {
local arch=$1
local os=$2
local find_dirs=(
"${INSTALL_ROOT}/lib/${arch}-${os}/"
"${INSTALL_ROOT}/usr/lib/${arch}-${os}/"
)
local needed_libs="$(
find ${find_dirs[*]} -name "*\.so*" -type f -exec file {} \; | \
grep ': ELF' | sed 's/^\(.*\): .*$/\1/' | xargs readelf -d | \
grep NEEDED | sort | uniq | sed 's/^.*Shared library: \[\(.*\)\]$/\1/g')"
local all_libs="$(find ${find_dirs[*]} -printf '%f\n')"
local missing_libs="$(grep -vFxf <(echo "${all_libs}") \
<(echo "${needed_libs}"))"
if [ ! -z "${missing_libs}" ]; then
echo "Missing libraries:"
echo "${missing_libs}"
exit 1
fi
}
VerifyLibraryDepsAmd64() {
VerifyLibraryDepsCommon x86_64 linux-gnu
}
VerifyLibraryDepsI386() {
VerifyLibraryDepsCommon i386 linux-gnu
}
VerifyLibraryDepsARM() {
VerifyLibraryDepsCommon arm linux-gnueabihf
}
VerifyLibraryDepsARM64() {
VerifyLibraryDepsCommon aarch64 linux-gnu
}
VerifyLibraryDepsMips() {
VerifyLibraryDepsCommon mipsel linux-gnu
}
VerifyLibraryDepsMips64el() {
VerifyLibraryDepsCommon mips64el linux-gnuabi64
}
#@ #@
#@ BuildSysrootAmd64 #@ BuildSysrootAmd64
#@ #@
...@@ -437,6 +490,7 @@ BuildSysrootAmd64() { ...@@ -437,6 +490,7 @@ BuildSysrootAmd64() {
InstallIntoSysroot ${files_and_sha256sums} InstallIntoSysroot ${files_and_sha256sums}
CleanupJailSymlinks CleanupJailSymlinks
HacksAndPatchesAmd64 HacksAndPatchesAmd64
VerifyLibraryDepsAmd64
CreateTarBall CreateTarBall
} }
...@@ -457,6 +511,7 @@ BuildSysrootI386() { ...@@ -457,6 +511,7 @@ BuildSysrootI386() {
InstallIntoSysroot ${files_and_sha256sums} InstallIntoSysroot ${files_and_sha256sums}
CleanupJailSymlinks CleanupJailSymlinks
HacksAndPatchesI386 HacksAndPatchesI386
VerifyLibraryDepsI386
CreateTarBall CreateTarBall
} }
...@@ -477,6 +532,7 @@ BuildSysrootARM() { ...@@ -477,6 +532,7 @@ BuildSysrootARM() {
InstallIntoSysroot ${files_and_sha256sums} InstallIntoSysroot ${files_and_sha256sums}
CleanupJailSymlinks CleanupJailSymlinks
HacksAndPatchesARM HacksAndPatchesARM
VerifyLibraryDepsARM
CreateTarBall CreateTarBall
} }
...@@ -497,6 +553,7 @@ BuildSysrootARM64() { ...@@ -497,6 +553,7 @@ BuildSysrootARM64() {
InstallIntoSysroot ${files_and_sha256sums} InstallIntoSysroot ${files_and_sha256sums}
CleanupJailSymlinks CleanupJailSymlinks
HacksAndPatchesARM64 HacksAndPatchesARM64
VerifyLibraryDepsARM64
CreateTarBall CreateTarBall
} }
...@@ -518,6 +575,7 @@ BuildSysrootMips() { ...@@ -518,6 +575,7 @@ BuildSysrootMips() {
InstallIntoSysroot ${files_and_sha256sums} InstallIntoSysroot ${files_and_sha256sums}
CleanupJailSymlinks CleanupJailSymlinks
HacksAndPatchesMips HacksAndPatchesMips
VerifyLibraryDepsMips
CreateTarBall CreateTarBall
} }
...@@ -539,6 +597,7 @@ BuildSysrootMips64el() { ...@@ -539,6 +597,7 @@ BuildSysrootMips64el() {
InstallIntoSysroot ${files_and_sha256sums} InstallIntoSysroot ${files_and_sha256sums}
CleanupJailSymlinks CleanupJailSymlinks
HacksAndPatchesMips64el HacksAndPatchesMips64el
VerifyLibraryDepsMips64el
CreateTarBall CreateTarBall
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment