Skip to content

Instantly share code, notes, and snippets.

@yuezhu
Last active February 6, 2021 01:17
Show Gist options
  • Save yuezhu/daa000f12c3e11fe97ced5495921d00b to your computer and use it in GitHub Desktop.
Save yuezhu/daa000f12c3e11fe97ced5495921d00b to your computer and use it in GitHub Desktop.
Generate Ceph 14.2.11 compile_commands.json on Mac Big Sur
brew install python nss leveldb oath-toolkit boost-python3
pip3 install -U cython sphinx
export PKG_CONFIG_PATH=$(brew list --verbose nss 2>&1 1>/dev/null | awk '{print $2}')/lib/pkgconfig:$(brew list --verbose openssl 2>&1 1>/dev/null | awk '{print $2}')/lib/pkgconfig
export PYTHON3_LIBRARIES=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
export PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")
export SNAPPY_ROOT_DIR=$(brew list --verbose snappy 2>&1 1>/dev/null | awk '{print $2}')
cmake -H. -BDebug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=YES \
-DCMAKE_C_COMPILER="/usr/local/opt/llvm/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/local/opt/llvm/bin/clang++" \
-DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/llvm/lib" \
-DSNAPPY_ROOT_DIR="$SNAPPY_ROOT_DIR" \
-DWITH_CCACHE=OFF \
-DWITH_RDMA=OFF \
-DWITH_XFS=OFF \
-DWITH_KRBD=OFF \
-DWITH_BLUESTORE=OFF \
-DWITH_SYSTEMD=OFF \
-DWITH_TESTS=OFF \
-DWITH_LTTNG=OFF \
-DWITH_BABELTRACE=OFF \
-DWITH_FUSE=OFF \
-DWITH_CEPHFS=OFF \
-DWITH_LIBCEPHFS=OFF \
-DWITH_RADOSGW_AMQP_ENDPOINT=OFF \
-DWITH_RADOSGW_KAFKA_ENDPOINT=OFF \
-DMGR_PYTHON_VERSION=3 \
-DPYTHON_EXECUTABLE=/usr/local/bin/python3 \
-DPYTHON_LIBRARIES="$PYTHON3_LIBRARIES" \
-DWITH_MGR_DASHBOARD_FRONTEND=OFF \
-DWITH_SYSTEM_BOOST=ON \
-DWITH_PYTHON2=OFF \
-DWITH_PYTHON3=ON \
-DPYTHON3_INCLUDE_DIR="$PYTHON3_INCLUDE_DIR" \
-DPYTHON3_LIBRARY="$PYTHON3_LIBRARIES"
mv Debug/compile_commands.json Debug/compile_commands_all.json
jq -rM '[.[] | select(.file | contains("/ceph/src/rgw/"))]' < Debug/compile_commands_all.json > Debug/compile_commands_rgw.json
ln -sf Debug/compile_commands_rgw.json compile_commands.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment