From 37a97ccddcab339224e96f171e5e8c7765f1e226 Mon Sep 17 00:00:00 2001 From: Tianze Zhu Date: Mon, 3 Mar 2025 10:16:26 +0800 Subject: [PATCH 1/2] doc(godel-script): Provide supplementary explanations regarding the compilation environment and steps in README. --- godel-script/README.md | 68 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/godel-script/README.md b/godel-script/README.md index de8344b..544b313 100644 --- a/godel-script/README.md +++ b/godel-script/README.md @@ -52,24 +52,77 @@ Structure of this project: +-- src godel-frontend source code ``` +### Environment + Need C++ standard at least `-std=c++17`. +You can refer to the following Dockerfile to prepare your development environment. + +```Dockerfile +FROM ubuntu:24.04 + +RUN echo "Types: deb\n\ +URIs: http://mirrors.cloud.tencent.com/ubuntu/\n\ +Suites: noble noble-updates noble-security\n\ +Components: main restricted universe multiverse\n\ +Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" > /etc/apt/sources.list.d/ubuntu.sources + +RUN apt update && apt upgrade -y && apt install -y git build-essential m4 cmake ninja-build clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python3-clang libsqlite3-dev sqlite3 zlib1g-dev +``` + +For convenience, we recommend directly using the [Dev Container plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) of VSCode. Here is `devcontainer.json`. + +```json +{ + "name": "godel-script", + "build": { + "context": "..", + "dockerfile": "./Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "xaver.clang-format", + "twxs.cmake", + "ms-vscode.cmake-tools", + "vadimcn.vscode-lldb", + "llvm-vs-code-extensions.vscode-clangd" + ], + "settings": { + "[cpp]": { + "editor.defaultFormatter": "xaver.clang-format" + }, + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "cmake.generator": "Ninja" + } + } + }, + "remoteUser": "root" +} +``` + + ### Apply Patch On Soufflé Submodule -GödelScript uses a self-modified soufflé from a much older branch of public soufflé, -now we use patch to make sure it could be built successfully. +GödelScript uses a self-modified soufflé from a much older branch of public soufflé. Use these commands to clone. + +```bash +git submodule init +git submodule update --recursive +``` -Use this command to apply patch: +Now we use patch to make sure it could be built successfully. Use these commands to apply patch: ```bash -cd souffle +cd godel-backend/souffle git am ../0001-init-self-used-souffle-from-public-souffle.patch ``` Use these commands to revert: ```bash -cd souffle +cd godel-backend/souffle git apply -R ../0001-init-self-used-souffle-from-public-souffle.patch git reset HEAD~ ``` @@ -79,8 +132,9 @@ git reset HEAD~ Use command below: ```bash -mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -make -j6 +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ --no-warn-unused-cli -G Ninja +cmake --build . --config Release --target all -j 8 ``` After building, you'll find `build/godel` in the `build` folder. From 7b4f5041168a72af4a25ec702acb9ceeffcda312 Mon Sep 17 00:00:00 2001 From: Tianze Zhu Date: Fri, 7 Mar 2025 14:47:41 +0800 Subject: [PATCH 2/2] doc(godel-script): Streamline the content about the compilation environment and steps in README. --- godel-script/README.md | 50 +++++------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/godel-script/README.md b/godel-script/README.md index 544b313..1dd6a0e 100644 --- a/godel-script/README.md +++ b/godel-script/README.md @@ -56,51 +56,13 @@ Structure of this project: Need C++ standard at least `-std=c++17`. -You can refer to the following Dockerfile to prepare your development environment. +On Ubuntu, you are expected to install the following packages before compiling. -```Dockerfile -FROM ubuntu:24.04 - -RUN echo "Types: deb\n\ -URIs: http://mirrors.cloud.tencent.com/ubuntu/\n\ -Suites: noble noble-updates noble-security\n\ -Components: main restricted universe multiverse\n\ -Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" > /etc/apt/sources.list.d/ubuntu.sources - -RUN apt update && apt upgrade -y && apt install -y git build-essential m4 cmake ninja-build clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python3-clang libsqlite3-dev sqlite3 zlib1g-dev +```bash +sudo apt install -y git build-essential libffi-dev m4 cmake libsqlite3-dev zlib1g-dev ``` -For convenience, we recommend directly using the [Dev Container plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) of VSCode. Here is `devcontainer.json`. - -```json -{ - "name": "godel-script", - "build": { - "context": "..", - "dockerfile": "./Dockerfile" - }, - "customizations": { - "vscode": { - "extensions": [ - "xaver.clang-format", - "twxs.cmake", - "ms-vscode.cmake-tools", - "vadimcn.vscode-lldb", - "llvm-vs-code-extensions.vscode-clangd" - ], - "settings": { - "[cpp]": { - "editor.defaultFormatter": "xaver.clang-format" - }, - "editor.formatOnSave": true, - "editor.formatOnPaste": true, - "cmake.generator": "Ninja" - } - } - }, - "remoteUser": "root" -} -``` +For convenience, we recommend directly using the [Dev Container plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) of VSCode. The configuration files are in `godel-script/.devcontainer/`. ### Apply Patch On Soufflé Submodule @@ -133,8 +95,8 @@ Use command below: ```bash mkdir build && cd build -cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ --no-warn-unused-cli -G Ninja -cmake --build . --config Release --target all -j 8 +cmake .. -DCMAKE_BUILD_TYPE:STRING=Release +cmake --build . ``` After building, you'll find `build/godel` in the `build` folder.