From c857527b6bffbdfe241d2012040330541d09a80f Mon Sep 17 00:00:00 2001 From: Spencer Johnson Date: Thu, 30 Apr 2026 09:58:50 -0700 Subject: [PATCH 01/10] Fixed file path bug in CMakeLists and added Linux install bash script --- CMakeLists.txt | 3 ++ install_nsb.sh | 128 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 install_nsb.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 61b53853..1e1bea0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,7 @@ target_link_libraries(nsb PUBLIC # Include directories. target_include_directories(nsb PUBLIC ${CPP_INCLUDE_DIR} + ${CPP_PROTO_DIR}/proto ${CPP_PROTO_DIR} ${Protobuf_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} @@ -119,6 +120,7 @@ target_link_libraries(nsb_daemon PUBLIC nsb) target_include_directories(nsb_daemon PUBLIC ${CPP_INCLUDE_DIR} ${CPP_PROTO_DIR} + ${CPP_PROTO_DIR}/proto ${Protobuf_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} ) @@ -172,6 +174,7 @@ add_executable(nsb_test ${CPP_DIR}/nsb_test.cc) target_link_libraries(nsb_test PUBLIC nsb) target_include_directories(nsb_test PUBLIC ${CPP_INCLUDE_DIR} + ${CPP_PROTO_DIR}/proto ${Protobuf_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} ) diff --git a/install_nsb.sh b/install_nsb.sh new file mode 100644 index 00000000..53bad611 --- /dev/null +++ b/install_nsb.sh @@ -0,0 +1,128 @@ +#!/bin/bash +set -e # Exit immediately on error + +# If running as root (e.g. Docker), make sudo a no-op +if [ "$(id -u)" -eq 0 ]; then + sudo() { "$@"; } + export -f sudo +fi + +echo "=== NSB Installation Script ===" + +# ── 1. System Packages ────────────────────────────────────────────────────── +echo "[1/7] Installing system packages..." +sudo apt update +sudo apt install -y \ + build-essential \ + cmake \ + pkg-config \ + libsqlite3-dev \ + libyaml-cpp-dev \ + libhiredis-dev \ + python3 \ + python3-pip \ + redis-server \ + git \ + wget + +pip install protobuf --break-system-packages + +# ── 2. Abseil ──────────────────────────────────────────────────────────────── +echo "[2/7] Building & installing Abseil..." +cd ~ +if [ ! -d "abseil-cpp" ]; then + git clone --depth 1 --branch 20240116.0 https://github.com/abseil/abseil-cpp.git +fi +cd abseil-cpp +mkdir -p build +cd build +cmake .. \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_BUILD_TYPE=Release \ + -DABSL_ENABLE_INSTALL=ON \ + -DBUILD_TESTING=OFF +cmake --build . -j2 +sudo cmake --install . +sudo ldconfig + +echo "Sanity check - Abseil:" +ls /usr/local/lib/libabsl_log* /usr/local/lib/libabsl_base* 2>/dev/null + +# ── 3. Protobuf ────────────────────────────────────────────────────────────── +echo "[3/7] Building & installing Protobuf v27.5..." +cd ~ +if [ ! -f "protobuf-27.5.tar.gz" ]; then + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.5/protobuf-27.5.tar.gz +fi +if [ ! -d "protobuf-27.5" ]; then + tar -xvf protobuf-27.5.tar.gz +fi +cd protobuf-27.5 +mkdir -p build +cd build +cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -Dprotobuf_BUILD_SHARED_LIBS=ON \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_ABSL_PROVIDER=package \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_INSTALL_PREFIX=/usr/local +cmake --build . -j2 +sudo cmake --install . +sudo ldconfig + +echo "Sanity check - Protobuf:" +which protoc +protoc --version +ls /usr/local/lib/libprotobuf.so* + +# ── 4. Clone NSB ───────────────────────────────────────────────────────────── +echo "[4/7] Cloning NSB..." +cd ~ +if [ ! -d "nsb_beta" ]; then + git clone https://github.com/nsb-ucsc/nsb.git # Update URL +fi +cd nsb_beta + +# Remove this after CMakeLists.txt is patched +# sed -i 's|${CPP_PROTO_DIR}$|${CPP_PROTO_DIR}\n ${CPP_PROTO_DIR}/proto|g' CMakeLists.txt + +# ── 5. Build NSB ───────────────────────────────────────────────────────────── +echo "[5/7] Building NSB..." +rm -rf build +mkdir build +cd build +cmake -DProtobuf_PROTOC_EXECUTABLE=/usr/local/bin/protoc .. +cmake --build . -j2 + +# ── 6. Install NSB ─────────────────────────────────────────────────────────── +echo "[6/7] Installing NSB..." +sudo cmake --install . +sudo ldconfig + +# ── 7. PYTHONPATH ──────────────────────────────────────────────────────────── +echo "[7/7] Setting PYTHONPATH..." +PROTO_PATH="$HOME/nsb_beta/python/proto" +if ! grep -q "nsb_beta/python/proto" ~/.bashrc; then + echo "export PYTHONPATH=$PROTO_PATH:\$PYTHONPATH" >> ~/.bashrc +fi +export PYTHONPATH=$PROTO_PATH:$PYTHONPATH + +# ── 8. Redis ───────────────────────────────────────────────────────────────── +echo "Starting Redis on port 5050..." +redis-server --port 5050 --daemonize yes +redis-cli -p 5050 ping + +# ── Final Test ─────────────────────────────────────────────────────────────── +echo "Testing Python proto import..." +python3 - <<'EOF' +import proto.nsb_pb2 as nsb_pb2 +print("NSB Python proto loaded from:", nsb_pb2.__file__) +EOF + +echo "" +echo "=== Installation complete! ===" +echo "To run the daemon: cd ~/nsb_beta/build && ./nsb_daemon ../config.yaml" +echo "Remember to run: source ~/.bashrc" From 90a5bb93fbd24bea4ae3f0c87d235c85418d271d Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Thu, 7 May 2026 12:30:55 -0700 Subject: [PATCH 02/10] Update Redis server command to use --port option --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 97e351c2..0c7338dc 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ your code. Once this is complete, we recommend taking these steps in order: 1. **Start the Redis server.** Specify or take note of the port number that the server is running on and make sure your configuration file points to the address and port. -```redis-server -p 5050``` +```redis-server --port 5050``` 2. **Start the NSB Daemon.** If you followed the build instructions in above, then you can start the NSB Daemon executable from either the _build_ directory From 4272217637d3573d8aa1e34d3d596191c3f52382 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Thu, 7 May 2026 12:45:53 -0700 Subject: [PATCH 03/10] Adding linux-setup-guide --- linux-setup-guide.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 linux-setup-guide.md diff --git a/linux-setup-guide.md b/linux-setup-guide.md new file mode 100644 index 00000000..d7f16629 --- /dev/null +++ b/linux-setup-guide.md @@ -0,0 +1,6 @@ +To install on Linux: +- Download the proper install script based on your distro +- Open a terminal, and go to the directory the script downloaded to (most likely cd ~/Downloads/) +- Run the command chmod +x _nsb_install.sh +- Run the command ./_nsb_install.sh +- Follow any instructions that may appear From 33e94574ab5a6d14b14fe0095783e359539068fd Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Thu, 7 May 2026 12:46:32 -0700 Subject: [PATCH 04/10] Delete install_nsb.sh --- install_nsb.sh | 128 ------------------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 install_nsb.sh diff --git a/install_nsb.sh b/install_nsb.sh deleted file mode 100644 index 53bad611..00000000 --- a/install_nsb.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash -set -e # Exit immediately on error - -# If running as root (e.g. Docker), make sudo a no-op -if [ "$(id -u)" -eq 0 ]; then - sudo() { "$@"; } - export -f sudo -fi - -echo "=== NSB Installation Script ===" - -# ── 1. System Packages ────────────────────────────────────────────────────── -echo "[1/7] Installing system packages..." -sudo apt update -sudo apt install -y \ - build-essential \ - cmake \ - pkg-config \ - libsqlite3-dev \ - libyaml-cpp-dev \ - libhiredis-dev \ - python3 \ - python3-pip \ - redis-server \ - git \ - wget - -pip install protobuf --break-system-packages - -# ── 2. Abseil ──────────────────────────────────────────────────────────────── -echo "[2/7] Building & installing Abseil..." -cd ~ -if [ ! -d "abseil-cpp" ]; then - git clone --depth 1 --branch 20240116.0 https://github.com/abseil/abseil-cpp.git -fi -cd abseil-cpp -mkdir -p build -cd build -cmake .. \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_BUILD_TYPE=Release \ - -DABSL_ENABLE_INSTALL=ON \ - -DBUILD_TESTING=OFF -cmake --build . -j2 -sudo cmake --install . -sudo ldconfig - -echo "Sanity check - Abseil:" -ls /usr/local/lib/libabsl_log* /usr/local/lib/libabsl_base* 2>/dev/null - -# ── 3. Protobuf ────────────────────────────────────────────────────────────── -echo "[3/7] Building & installing Protobuf v27.5..." -cd ~ -if [ ! -f "protobuf-27.5.tar.gz" ]; then - wget https://github.com/protocolbuffers/protobuf/releases/download/v27.5/protobuf-27.5.tar.gz -fi -if [ ! -d "protobuf-27.5" ]; then - tar -xvf protobuf-27.5.tar.gz -fi -cd protobuf-27.5 -mkdir -p build -cd build -cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ - -Dprotobuf_BUILD_SHARED_LIBS=ON \ - -Dprotobuf_BUILD_TESTS=OFF \ - -Dprotobuf_ABSL_PROVIDER=package \ - -DCMAKE_CXX_STANDARD=17 \ - -DCMAKE_INSTALL_PREFIX=/usr/local -cmake --build . -j2 -sudo cmake --install . -sudo ldconfig - -echo "Sanity check - Protobuf:" -which protoc -protoc --version -ls /usr/local/lib/libprotobuf.so* - -# ── 4. Clone NSB ───────────────────────────────────────────────────────────── -echo "[4/7] Cloning NSB..." -cd ~ -if [ ! -d "nsb_beta" ]; then - git clone https://github.com/nsb-ucsc/nsb.git # Update URL -fi -cd nsb_beta - -# Remove this after CMakeLists.txt is patched -# sed -i 's|${CPP_PROTO_DIR}$|${CPP_PROTO_DIR}\n ${CPP_PROTO_DIR}/proto|g' CMakeLists.txt - -# ── 5. Build NSB ───────────────────────────────────────────────────────────── -echo "[5/7] Building NSB..." -rm -rf build -mkdir build -cd build -cmake -DProtobuf_PROTOC_EXECUTABLE=/usr/local/bin/protoc .. -cmake --build . -j2 - -# ── 6. Install NSB ─────────────────────────────────────────────────────────── -echo "[6/7] Installing NSB..." -sudo cmake --install . -sudo ldconfig - -# ── 7. PYTHONPATH ──────────────────────────────────────────────────────────── -echo "[7/7] Setting PYTHONPATH..." -PROTO_PATH="$HOME/nsb_beta/python/proto" -if ! grep -q "nsb_beta/python/proto" ~/.bashrc; then - echo "export PYTHONPATH=$PROTO_PATH:\$PYTHONPATH" >> ~/.bashrc -fi -export PYTHONPATH=$PROTO_PATH:$PYTHONPATH - -# ── 8. Redis ───────────────────────────────────────────────────────────────── -echo "Starting Redis on port 5050..." -redis-server --port 5050 --daemonize yes -redis-cli -p 5050 ping - -# ── Final Test ─────────────────────────────────────────────────────────────── -echo "Testing Python proto import..." -python3 - <<'EOF' -import proto.nsb_pb2 as nsb_pb2 -print("NSB Python proto loaded from:", nsb_pb2.__file__) -EOF - -echo "" -echo "=== Installation complete! ===" -echo "To run the daemon: cd ~/nsb_beta/build && ./nsb_daemon ../config.yaml" -echo "Remember to run: source ~/.bashrc" From 75c7c943d3b45dfe78c8234906ea0a62bf04f757 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Thu, 7 May 2026 16:35:18 -0700 Subject: [PATCH 05/10] arch install working, ubuntu has double nesting issue w cmake --- arch_nsb_install.sh | 133 +++++++++++++++++++++++++++++++++++++++++ ubuntu_nsb_install.sh | 136 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100755 arch_nsb_install.sh create mode 100644 ubuntu_nsb_install.sh diff --git a/arch_nsb_install.sh b/arch_nsb_install.sh new file mode 100755 index 00000000..50bc8278 --- /dev/null +++ b/arch_nsb_install.sh @@ -0,0 +1,133 @@ +#!/bin/bash +set -e # Exit immediately on error + +# If running as root, make sudo a no-op (added for testing on docker) +if [ "$(id -u)" -eq 0 ]; then + sudo() { "$@"; } + export -f sudo +fi + +echo "=== NSB Installation Script (Arch Linux) ===" + +# ── 1. System Packages ────────────────────────────────────────────────────── +echo "[1/7] Installing system packages..." +sudo pacman -Sy --noconfirm \ + base-devel \ + cmake \ + pkgconf \ + sqlite \ + yaml-cpp \ + hiredis \ + python \ + python-pip \ + redis \ + git \ + wget + +pip install protobuf --break-system-packages + +# ── 2. Abseil ──────────────────────────────────────────────────────────────── +echo "[2/7] Building & installing Abseil..." +cd ~ +if [ ! -d "abseil-cpp" ]; then + git clone --depth 1 --branch 20240116.0 https://github.com/abseil/abseil-cpp.git +fi +cd abseil-cpp +mkdir -p build +cd build +cmake .. \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_BUILD_TYPE=Release \ + -DABSL_ENABLE_INSTALL=ON \ + -DBUILD_TESTING=OFF +cmake --build . -j2 +sudo cmake --install . +sudo ldconfig + +echo "Sanity check - Abseil:" +ls /usr/local/lib/libabsl_log* /usr/local/lib/libabsl_base* 2>/dev/null + +# ── 3. Protobuf ────────────────────────────────────────────────────────────── +echo "[3/7] Building & installing Protobuf v27.5..." +cd ~ +if [ ! -f "protobuf-27.5.tar.gz" ]; then + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.5/protobuf-27.5.tar.gz +fi +if [ ! -d "protobuf-27.5" ]; then + tar -xvf protobuf-27.5.tar.gz +fi +cd protobuf-27.5 +mkdir -p build +cd build +cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -Dprotobuf_BUILD_SHARED_LIBS=ON \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_ABSL_PROVIDER=package \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_INSTALL_PREFIX=/usr/local +cmake --build . -j2 +sudo cmake --install . +sudo ldconfig + +echo "Sanity check - Protobuf:" +which protoc +protoc --version +ls /usr/local/lib/libprotobuf.so* + +# ── 4. Clone NSB ───────────────────────────────────────────────────────────── +echo "[4/7] Cloning NSB..." +cd ~ +if [ ! -d "nsb" ]; then + #git clone https://github.com/nsb-ucsc/nsb_beta.git nsb # Update URL if needed + git clone https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed +fi +cd nsb + +# ── 5. Build NSB ───────────────────────────────────────────────────────────── +echo "[5/7] Building NSB..." +rm -rf build +mkdir build +cd build +cmake -DProtobuf_PROTOC_EXECUTABLE=/usr/local/bin/protoc .. +cmake --build . -j2 + +# ── 6. Install NSB ─────────────────────────────────────────────────────────── +echo "[6/7] Installing NSB..." +sudo cmake --install . +sudo ldconfig + +# ── 7. PYTHONPATH ──────────────────────────────────────────────────────────── +# Detect shell rc file +case "$SHELL" in +*/zsh) RC_FILE="$HOME/.zshrc" ;; +*/bash) RC_FILE="$HOME/.bashrc" ;; +*) RC_FILE="$HOME/.profile" ;; # universal fallback +esac + +echo "[7/7] Setting PYTHONPATH..." +touch "$RC_FILE" +PROTO_PATH="$HOME/nsb/python" +if ! grep -q "nsb/python" "$RC_FILE"; then + echo "export PYTHONPATH=$PROTO_PATH:\$PYTHONPATH" >>"$RC_FILE" +fi +export PYTHONPATH=$PROTO_PATH:$PYTHONPATH + +# ── 8. Redis ───────────────────────────────────────────────────────────────── +echo "Starting Redis on port 5050..." +redis-server --port 5050 --daemonize yes +redis-cli -p 5050 ping + +# ── Final Test ─────────────────────────────────────────────────────────────── +echo "Testing Python proto import..." +python3 - <<'EOF' +import proto.nsb_pb2 as nsb_pb2 +print("NSB Python proto loaded from:", nsb_pb2.__file__) +EOF + +echo "" +echo "=== Installation complete! ===" +echo "To run the daemon: cd ~/nsb/build && ./nsb_daemon ../config.yaml" +echo "Remember to run: source $RC_FILE" diff --git a/ubuntu_nsb_install.sh b/ubuntu_nsb_install.sh new file mode 100644 index 00000000..443b5226 --- /dev/null +++ b/ubuntu_nsb_install.sh @@ -0,0 +1,136 @@ +#!/bin/bash +set -e # Exit immediately on error + +# If running as root (e.g. Docker), make sudo a no-op +if [ "$(id -u)" -eq 0 ]; then + sudo() { "$@"; } + export -f sudo +fi + +echo "=== NSB Installation Script (Ubuntu) ===" + +# ── 1. System Packages ────────────────────────────────────────────────────── +echo "[1/7] Installing system packages..." +sudo apt update +sudo apt install -y \ + build-essential \ + cmake \ + pkg-config \ + libsqlite3-dev \ + libyaml-cpp-dev \ + libhiredis-dev \ + python3 \ + python3-pip \ + redis-server \ + git \ + wget + +pip install protobuf --break-system-packages + +# ── 2. Abseil ──────────────────────────────────────────────────────────────── +echo "[2/7] Building & installing Abseil..." +cd ~ +if [ ! -d "abseil-cpp" ]; then + git clone --depth 1 --branch 20240116.0 https://github.com/abseil/abseil-cpp.git +fi +cd abseil-cpp +mkdir -p build +cd build +cmake .. \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_BUILD_TYPE=Release \ + -DABSL_ENABLE_INSTALL=ON \ + -DBUILD_TESTING=OFF +cmake --build . -j2 +sudo cmake --install . +sudo ldconfig + +echo "Sanity check - Abseil:" +ls /usr/local/lib/libabsl_log* /usr/local/lib/libabsl_base* 2>/dev/null + +# ── 3. Protobuf ────────────────────────────────────────────────────────────── +echo "[3/7] Building & installing Protobuf v27.5..." +cd ~ +if [ ! -f "protobuf-27.5.tar.gz" ]; then + wget https://github.com/protocolbuffers/protobuf/releases/download/v27.5/protobuf-27.5.tar.gz +fi +if [ ! -d "protobuf-27.5" ]; then + tar -xvf protobuf-27.5.tar.gz +fi +cd protobuf-27.5 +mkdir -p build +cd build +cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -Dprotobuf_BUILD_SHARED_LIBS=ON \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_ABSL_PROVIDER=package \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_INSTALL_PREFIX=/usr/local +cmake --build . -j2 +sudo cmake --install . +sudo ldconfig + +echo "Sanity check - Protobuf:" +which protoc +protoc --version +ls /usr/local/lib/libprotobuf.so* + +# ── 4. Clone NSB ───────────────────────────────────────────────────────────── +echo "[4/7] Cloning NSB..." +cd ~ +if [ ! -d "nsb" ]; then + #git clone https://github.com/nsb-ucsc/nsb_beta.git nsb # Update URL if needed + git clone https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed +fi +cd nsb + +# ── 5. Build NSB ───────────────────────────────────────────────────────────── +echo "[5/7] Building NSB..." +rm -rf build +mkdir build +cd build +cmake -DProtobuf_PROTOC_EXECUTABLE=/usr/local/bin/protoc .. +cmake --build . -j2 + +# ── 6. Install NSB ─────────────────────────────────────────────────────────── +echo "[6/7] Installing NSB..." +sudo cmake --install . +sudo ldconfig + +# ── 7. PYTHONPATH ──────────────────────────────────────────────────────────── +# Detect shell rc file +case "$0" in +*/zsh) RC_FILE="$HOME/.zshrc" ;; +*/bash) RC_FILE="$HOME/.bashrc" ;; +*) RC_FILE="$HOME/.profile" ;; +esac + +echo "[7/7] Setting PYTHONPATH..." +touch "$RC_FILE" +PROTO_PATH="$HOME/nsb/python" +if ! grep -q "nsb/python" "$RC_FILE"; then + echo "export PYTHONPATH=$PROTO_PATH:\$PYTHONPATH" >>"$RC_FILE" +fi +export PYTHONPATH=$PROTO_PATH:$PYTHONPATH + +source $RC_FILE + +# ── 8. Redis ───────────────────────────────────────────────────────────────── +echo "Starting Redis on port 5050..." +redis-server --port 5050 --daemonize yes +redis-cli -p 5050 ping + +# ── Final Test ─────────────────────────────────────────────────────────────── +echo "Testing Python proto import..." +python3 - <<'EOF' +import proto.nsb_pb2 as nsb_pb2 +print("NSB Python proto loaded from:", nsb_pb2.__file__) +EOF + +echo "" +echo "=== Installation complete! ===" +echo "To run the daemon: cd ~/nsb/build && ./nsb_daemon ../config.yaml" +echo "Remember to run: source $RC_FILE" From 3dbf714694c72b47833f5f3d08fbaf6126039395 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Tue, 12 May 2026 15:33:43 -0700 Subject: [PATCH 06/10] reset to original cmake --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1bea0a..61b53853 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,6 @@ target_link_libraries(nsb PUBLIC # Include directories. target_include_directories(nsb PUBLIC ${CPP_INCLUDE_DIR} - ${CPP_PROTO_DIR}/proto ${CPP_PROTO_DIR} ${Protobuf_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} @@ -120,7 +119,6 @@ target_link_libraries(nsb_daemon PUBLIC nsb) target_include_directories(nsb_daemon PUBLIC ${CPP_INCLUDE_DIR} ${CPP_PROTO_DIR} - ${CPP_PROTO_DIR}/proto ${Protobuf_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} ) @@ -174,7 +172,6 @@ add_executable(nsb_test ${CPP_DIR}/nsb_test.cc) target_link_libraries(nsb_test PUBLIC nsb) target_include_directories(nsb_test PUBLIC ${CPP_INCLUDE_DIR} - ${CPP_PROTO_DIR}/proto ${Protobuf_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} ) From 2a88704d0a996f128124c2e545b11f35a06ac0e2 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Tue, 12 May 2026 19:35:17 -0700 Subject: [PATCH 07/10] testing custom command to fix double nesting --- CMakeLists.txt | 58 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 61b53853..1792aa58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_compile_options(-Wall -Wextra -Werror -Wpedantic -Wuninitialized) - # Project information. project(nsb VERSION 0.1.0 @@ -72,15 +71,53 @@ message(STATUS "▸ Source: ${CMAKE_SOURCE_DIR}") message(STATUS "▸ Protobuf: ${Protobuf_INCLUDE_DIRS}") message(STATUS "▸ YAML: ${YAML_CPP_INCLUDE_DIR}") -# Set up library. +message(STATUS "Protoc Executable: ${Protobuf_PROTOC_EXECUTABLE}") + +# Generate C++ protobuf files directly via protoc. +add_custom_command( + OUTPUT ${CPP_PROTO_DIR}/nsb.pb.h ${CPP_PROTO_DIR}/nsb.pb.cc + COMMAND ${Protobuf_PROTOC_EXECUTABLE} + --cpp_out=${CPP_PROTO_DIR} + --proto_path=${PROTO_DIR} + ${PROTO_DIR}/nsb.proto + DEPENDS ${PROTO_DIR}/nsb.proto + COMMENT "Running cpp protocol buffer compiler on nsb.proto" +) + +# Generate Python protobuf files directly via protoc. +add_custom_command( + OUTPUT ${PYTHON_DIR}/proto/nsb_pb2.py + COMMAND ${Protobuf_PROTOC_EXECUTABLE} + --python_out=${PYTHON_DIR}/proto + --proto_path=${PROTO_DIR} + ${PROTO_DIR}/nsb.proto + DEPENDS ${PROTO_DIR}/nsb.proto + COMMENT "Running python protocol buffer compiler on nsb.proto" +) + +# Custom target that depends on all generated proto files. +add_custom_target(nsb_proto_gen ALL + DEPENDS + ${CPP_PROTO_DIR}/nsb.pb.h + ${CPP_PROTO_DIR}/nsb.pb.cc + ${PYTHON_DIR}/proto/nsb_pb2.py +) + +# Set up library (include generated nsb.pb.cc as an explicit source). add_library(nsb SHARED ${CPP_SRC_DIR}/nsb.cc ${CPP_SRC_DIR}/nsb_client.cc + ${CPP_PROTO_DIR}/nsb.pb.cc ) + +# Ensure proto files are generated before compiling nsb. +add_dependencies(nsb nsb_proto_gen) + # Link libraries. target_link_libraries(nsb PUBLIC ${link_targets} ) + # Include directories. target_include_directories(nsb PUBLIC ${CPP_INCLUDE_DIR} @@ -89,23 +126,6 @@ target_include_directories(nsb PUBLIC ${YAML_CPP_INCLUDE_DIR} ) -message(STATUS "Protoc Executable: ${Protobuf_PROTOC_EXECUTABLE}") -# Generate C++ protobuf files. -protobuf_generate( - TARGET nsb - LANGUAGE cpp - IMPORT_DIRS ${PROTO_DIR} - PROTOC_OUT_DIR ${CPP_DIR}/proto - PROTOS ${PROTO_DIR}/nsb.proto -) -# Generate Python protobuf file. -protobuf_generate( - TARGET nsb - LANGUAGE python - IMPORT_DIRS ${PROTO_DIR} - PROTOC_OUT_DIR ${PYTHON_DIR}/proto - PROTOS ${PROTO_DIR}/nsb.proto -) # Cleaning up. set_target_properties(nsb PROPERTIES ADDITIONAL_CLEAN_FILES "${CPP_DIR}/proto/*;${PYTHON_DIR}/proto/*;${PYTHON_DIR}/__pycache__/*" From ce166c6e43710ea29a35ca16395f8d0d39849e70 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Mon, 18 May 2026 22:27:12 -0700 Subject: [PATCH 08/10] scripts with testing repo url --- arch_nsb_install.sh | 4 ++-- ubuntu_nsb_install.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch_nsb_install.sh b/arch_nsb_install.sh index 50bc8278..8d8a79a3 100755 --- a/arch_nsb_install.sh +++ b/arch_nsb_install.sh @@ -11,7 +11,7 @@ echo "=== NSB Installation Script (Arch Linux) ===" # ── 1. System Packages ────────────────────────────────────────────────────── echo "[1/7] Installing system packages..." -sudo pacman -Sy --noconfirm \ +sudo pacman -Syu --noconfirm \ base-devel \ cmake \ pkgconf \ @@ -82,7 +82,7 @@ echo "[4/7] Cloning NSB..." cd ~ if [ ! -d "nsb" ]; then #git clone https://github.com/nsb-ucsc/nsb_beta.git nsb # Update URL if needed - git clone https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed + git clone -b test https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed fi cd nsb diff --git a/ubuntu_nsb_install.sh b/ubuntu_nsb_install.sh index 443b5226..bad128c1 100644 --- a/ubuntu_nsb_install.sh +++ b/ubuntu_nsb_install.sh @@ -83,7 +83,7 @@ echo "[4/7] Cloning NSB..." cd ~ if [ ! -d "nsb" ]; then #git clone https://github.com/nsb-ucsc/nsb_beta.git nsb # Update URL if needed - git clone https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed + git clone -b test https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed fi cd nsb @@ -102,7 +102,7 @@ sudo ldconfig # ── 7. PYTHONPATH ──────────────────────────────────────────────────────────── # Detect shell rc file -case "$0" in +case "$SHELL" in */zsh) RC_FILE="$HOME/.zshrc" ;; */bash) RC_FILE="$HOME/.bashrc" ;; *) RC_FILE="$HOME/.profile" ;; From 97ba520294bd3b5bdb1d68d393acce4026cd89f4 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Mon, 18 May 2026 22:43:36 -0700 Subject: [PATCH 09/10] scripts with proper nsb repo url --- arch_nsb_install.sh | 3 +-- ubuntu_nsb_install.sh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch_nsb_install.sh b/arch_nsb_install.sh index 8d8a79a3..53f9fc13 100755 --- a/arch_nsb_install.sh +++ b/arch_nsb_install.sh @@ -81,8 +81,7 @@ ls /usr/local/lib/libprotobuf.so* echo "[4/7] Cloning NSB..." cd ~ if [ ! -d "nsb" ]; then - #git clone https://github.com/nsb-ucsc/nsb_beta.git nsb # Update URL if needed - git clone -b test https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed + git clone https://github.com/nsb-ucsc/nsb.git nsb fi cd nsb diff --git a/ubuntu_nsb_install.sh b/ubuntu_nsb_install.sh index bad128c1..ab48b5b1 100644 --- a/ubuntu_nsb_install.sh +++ b/ubuntu_nsb_install.sh @@ -82,8 +82,7 @@ ls /usr/local/lib/libprotobuf.so* echo "[4/7] Cloning NSB..." cd ~ if [ ! -d "nsb" ]; then - #git clone https://github.com/nsb-ucsc/nsb_beta.git nsb # Update URL if needed - git clone -b test https://github.com/spencertjohnson/nsb.git nsb # Update URL if needed + git clone https://github.com/nsb-ucsc/nsb.git nsb fi cd nsb From 03d8a1a495b48719b518219f0bbe0377c5aba2b1 Mon Sep 17 00:00:00 2001 From: spencertjohnson Date: Mon, 18 May 2026 23:36:29 -0700 Subject: [PATCH 10/10] fixing guide.md --- linux-setup-guide.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/linux-setup-guide.md b/linux-setup-guide.md index d7f16629..52b1b696 100644 --- a/linux-setup-guide.md +++ b/linux-setup-guide.md @@ -1,6 +1,32 @@ -To install on Linux: -- Download the proper install script based on your distro -- Open a terminal, and go to the directory the script downloaded to (most likely cd ~/Downloads/) -- Run the command chmod +x _nsb_install.sh -- Run the command ./_nsb_install.sh -- Follow any instructions that may appear +# Linux Installation + +## Prerequisites +Make sure you have a supported Linux distribution (using apt or pacman). + +## Steps + +1. **Download the install script** for your distribution: + - Arch Linux: `arch_nsb_install.sh` + - Ubuntu: `ubuntu_nsb_install.sh` + +2. **Open a terminal** and navigate to the directory the script downloaded to: + ```bash + cd ~/Downloads/ + ``` + +3. **Make the script executable:** + ```bash + chmod +x _nsb_install.sh + ``` + +4. **Run the script:** + ```bash + ./_nsb_install.sh + ``` + +5. **Follow any on-screen instructions** that appear during installation. + +6. **Reload your shell** after installation completes: + ```bash + source ~/.bashrc + ```