exit 1
 fi
 
+function get_cmake_variable() {
+    local variable=$1
+    grep "$variable" CMakeCache.txt | cut -d "=" -f 2
+}
+
+function cython_module_path() {
+    local ceph_lib=$1
+    shift
+    local py_ver=$(get_cmake_variable MGR_PYTHON_VERSION | cut -d '.' -f1)
+    if [ -z "${py_ver}" ]; then
+        if [ $(get_cmake_variable WITH_PYTHON2) = ON ]; then
+            py_ver=2
+        else
+            py_ver=3
+        fi
+    fi
+    echo $ceph_lib/cython_modules/lib.$py_ver
+}
+
 if [ `uname` = FreeBSD ]; then
     # otherwise module prettytable will not be found
     export PYTHONPATH=/usr/local/lib/python2.7/site-packages
         if ! PATH=$PATH:bin \
            CEPH_ROOT=.. \
            CEPH_LIB=lib \
+           PYTHONPATH=$(realpath ../src/pybind):$(cython_module_path lib) \
            LOCALRUN=yes \
            $cmd ; then
           echo "$f .............. FAILED"