diff --git a/build.sh b/build.sh
index 31e228c76036c5314cca3a68009579541846276f..3e76f2cd3e14e69c1174638f3f484a0d6dfc638f 100755
--- a/build.sh
+++ b/build.sh
@@ -68,6 +68,7 @@ else
 fi
 
 rm -rf dependency_dir/ZLIB
+rm -rf dependency_dir/HDF5
 
 if [ x"$with_gpu" == x"1" ]; then
 	foward_options="$foward_options --with-cuda-on-backend=CUDA"