diff --git a/misc/composer/build-xhprof.sh b/misc/composer/build-xhprof.sh
index 95057dc26e48382c1dc0cfff1859898a4c31e0fc..517d228d0bc3dfa2d54e8abedd99c5b061b95d98 100755
--- a/misc/composer/build-xhprof.sh
+++ b/misc/composer/build-xhprof.sh
@@ -11,6 +11,11 @@ if ! type make &> /dev/null; then
     exit
 fi
 
+if ! [ -d "vendor/facebook/xhprof/extension" ]; then
+    echo "xhprof missing, skipping build"
+    exit
+fi
+
 mkdir -p tmp/xhprof-logs
 
 cd vendor/facebook/xhprof/extension