Fix issue where libtool_check_unique isn't found for sandbox builds
It seems that for sandbox builds, the executable isn't copied over. libtool still succeeds, but it prints out an error message about the missing executable. This change, which I just made to mimic wrapped_clang, appears to fix it. I have no idea if there are other changes that should also be made for this, e.g. in tools/osx/crosstool/cc_toolchain_config.bzl wrapped_clang is referenced a lot but libtool_check_unique is not.
Closes #12046.
PiperOrigin-RevId: 332511362
diff --git a/tools/objc/libtool.sh b/tools/objc/libtool.sh
index 5b050a1..d0a6882 100755
--- a/tools/objc/libtool.sh
+++ b/tools/objc/libtool.sh
@@ -37,7 +37,9 @@
# Ensure 0 timestamping for hermetic results.
export ZERO_AR_DATE=1
-if "${MY_LOCATION}"/libtool_check_unique "$@"; then
+if [ ! -f "${MY_LOCATION}"/libtool_check_unique ] ; then
+ echo "libtool_check_unique not found. Please file an issue at github.com/bazelbuild/bazel"
+elif "${MY_LOCATION}"/libtool_check_unique "$@"; then
# If there are no duplicate .o basenames,
# libtool can be invoked with the original arguments.
"${WRAPPER}" libtool "$@"
diff --git a/tools/osx/crosstool/BUILD.tpl b/tools/osx/crosstool/BUILD.tpl
index dcd7002..5342f4a 100644
--- a/tools/osx/crosstool/BUILD.tpl
+++ b/tools/osx/crosstool/BUILD.tpl
@@ -50,6 +50,7 @@
":builtin_include_directory_paths",
":cc_wrapper",
":libtool",
+ ":libtool_check_unique",
":make_hashed_objlist.py",
":wrapped_clang",
":wrapped_clang_pp",