Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 9bdfc8d

Browse files
committed
avoid calling "find" on an empty CONDA_PREFIX
In the prehistory, the CONDA_PREFIX variable was introduced in build.sh to avoid compiling and installing third-party dependences already installed as conda packages. However, the check for the libraries being present is inaccurate as it uses 'find "$CONDA_PREFIX" lib*.so' where CONDA_PREFIX may be (and in non-conda builds is) empty. In the case of empty path, "find" searches for the given files in recursively starting from the current directory. When called after a previous successful build, "find" finds the libraries in their _build_ directories and skips the following compilation passes, including checks for changes, entirely. It also does not install the libraries if they were removed. Check that CONDA_PREFIX is not empty before using find to detect pre-installed libraries.
1 parent ea03ea3 commit 9bdfc8d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ function install_halide() {
467467
}
468468

469469
if ! test -z $gflags || ! test -z $all; then
470-
if [[ $(find $CONDA_PREFIX -name libgflags.so) ]]; then
470+
if [[ ! -z "$CONDA_PREFIX" && $(find $CONDA_PREFIX -name libgflags.so) ]]; then
471471
echo "gflags found"
472472
else
473473
echo "no files found"
@@ -476,7 +476,7 @@ if ! test -z $gflags || ! test -z $all; then
476476
fi
477477

478478
if ! test -z $glog || ! test -z $all; then
479-
if [[ $(find $CONDA_PREFIX -name libglog.so) ]]; then
479+
if [[ ! -z "$CONDA_PREFIX" && $(find $CONDA_PREFIX -name libglog.so) ]]; then
480480
echo "glog found"
481481
else
482482
echo "no files found"
@@ -494,7 +494,7 @@ fi
494494

495495
if ! test -z $caffe2 || ! test -z $all ; then
496496
if [ "$WITH_CAFFE2" == "ON" ]; then
497-
if [[ $(find $CONDA_PREFIX -name libcaffe2_gpu.so) ]]; then
497+
if [[ ! -z "$CONDA_PREFIX" && $(find $CONDA_PREFIX -name libcaffe2_gpu.so) ]]; then
498498
echo "caffe2 found"
499499
else
500500
echo "no files found"
@@ -504,7 +504,7 @@ if ! test -z $caffe2 || ! test -z $all ; then
504504
fi
505505

506506
if ! test -z $isl || ! test -z $all; then
507-
if [[ $(find $CONDA_PREFIX -name libisl.so) ]]; then
507+
if [[ ! -z "$CONDA_PREFIX" && $(find $CONDA_PREFIX -name libisl.so) ]]; then
508508
echo "isl found"
509509
else
510510
echo "no files found"
@@ -517,7 +517,7 @@ if ! test -z $dlpack || ! test -z $all; then
517517
fi
518518

519519
if ! test -z $halide || ! test -z $all; then
520-
if [[ $(find $CONDA_PREFIX -name libHalide.so) ]]; then
520+
if [[ ! -z "$CONDA_PREFIX" && $(find $CONDA_PREFIX -name libHalide.so) ]]; then
521521
echo "Halide found"
522522
else
523523
echo "no files found"

0 commit comments

Comments
 (0)