-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[build_symbolizer] Introduce ZLIB_SRC to specify an on-disk location for #70994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Davide Italiano (dcci) Changeszlib. Not everyone wants to checkout from Full diff: https://github.com/llvm/llvm-project/pull/70994.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
index 6eb9fa7abb7e0cc..f8df4b40b8dc29b 100755
--- a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
@@ -20,6 +20,12 @@ set -u
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
SRC_DIR=$(readlink -f $SCRIPT_DIR/..)
+
+if [[ $# -ne 1 ]]; then
+ echo "Missing output file"
+ exit 1
+fi
+
OUTPUT=$(readlink -f $1)
COMPILER_RT_SRC=$(readlink -f ${SCRIPT_DIR}/../../../..)
LLVM_SRC=${LLVM_SRC:-${COMPILER_RT_SRC}/../llvm}
@@ -52,6 +58,7 @@ LLVM_BUILD=${BUILD_DIR}/llvm
SYMBOLIZER_BUILD=${BUILD_DIR}/symbolizer
FLAGS=${FLAGS:-}
+ZLIB_SRC=${ZLIB_SRC:-}
TARGET_TRIPLE=$($CC -print-target-triple $FLAGS)
if [[ "$FLAGS" =~ "-m32" ]] ; then
# Avoid new wrappers.
@@ -63,7 +70,15 @@ FLAGS+=" -include ${SRC_DIR}/../sanitizer_redefine_builtins.h -DSANITIZER_COMMON
LINKFLAGS="-fuse-ld=lld -target $TARGET_TRIPLE"
# Build zlib.
-[[ -d ${ZLIB_BUILD} ]] || git clone https://github.com/madler/zlib ${ZLIB_BUILD}
+if [[ -d ${ZLIB_BUILD} ]]; then
+ if [[ -z "${ZLIB_SRC}" ]]; then
+ git clone https://github.com/madler/zlib ${ZLIB_BUILD}
+ else
+ ZLIB_SRC=$(readlink -f $ZLIB_SRC)
+ cp -r ${ZLIB_SRC}/* ${ZLIB_BUILD}/
+ fi
+fi
+
cd ${ZLIB_BUILD}
AR="${AR}" CC="${CC}" CFLAGS="$FLAGS -Wno-deprecated-non-prototype" RANLIB=/bin/true ./configure --static
make -j libz.a
|
LGTM, but you may wait for @htyu who reported a similar problem yesterday and may verify whether this works for their system. |
Consider linking to 64b94eb in the description. |
zlib. Not everyone wants to checkout from `git`. Tested with and without the env var. Restores the behaviour removed in 64b94eb
Better solution would be add cmake variable for that, we need to port that sh to cmake anyway |
@@ -63,7 +71,15 @@ FLAGS+=" -include ${SRC_DIR}/../sanitizer_redefine_builtins.h -DSANITIZER_COMMON | |||
LINKFLAGS="-fuse-ld=lld -target $TARGET_TRIPLE" | |||
|
|||
# Build zlib. | |||
[[ -d ${ZLIB_BUILD} ]] || git clone https://github.com/madler/zlib ${ZLIB_BUILD} | |||
if [[ -d ${ZLIB_BUILD} ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be if [[ ! -d ${ZLIB_BUILD} ]]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this, @htyu. Fixed in a follow-up.
commit d06596516fcb4d32a26eef5930a50fa56457814b (HEAD -> github/main, github/main)
Author: Davide Italiano <[email protected]>
Date: Wed Nov 1 18:38:27 2023 -0700
[build_symbolizer] Fix typo in 2c81d70747ac81b37b6c7639fe7afa328e8f5e79
diff --git a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
index 13acced825e0..520e0a631cb4 100755
--- a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
@@ -71,7 +71,7 @@ FLAGS+=" -include ${SRC_DIR}/../sanitizer_redefine_builtins.h -DSANITIZER_COMMON
LINKFLAGS="-fuse-ld=lld -target $TARGET_TRIPLE"
# Build zlib.
-if [[ -d ${ZLIB_BUILD} ]]; then
+if [[ ! -d ${ZLIB_BUILD} ]]; then
if [[ -z "${ZLIB_SRC}" ]]; then
git clone https://github.com/madler/zlib ${ZLIB_BUILD}
else
zlib.
Not everyone wants to checkout from
git
. Tested with and without the env var.