Compiling and Running - PIONEER-Experiment/zmq_publisher GitHub Wiki
The publisher application is a top-level executable built on the analysis_pipeline framework. It publishes MIDAS events over ZeroMQ for downstream consumers.
You must have the following installed on your system:
-
C++17 toolchain (GCC ≥ 9, Clang ≥ 10, or MSVC ≥ 2019)
-
CMake ≥ 3.18
-
Git
-
ROOT (with
Core,RIO,Tree,Hist,TreePlayercomponents discoverable byfind_package(ROOT)). -
ZLIB
-
Threads (system default)
-
ZeroMQ library (
libzmq)-
Debian/Ubuntu:
sudo apt update sudo apt install libzmq3-dev
-
Fedora/RHEL:
sudo dnf install zeromq-devel
-
Clone the official repository from GitHub:
git clone https://github.com/PIONEER-Experiment/zmq_publisher.git
cd zmq_publisherThis will give you the full source tree, including scripts for building and running.
Before building, ensure MIDASSYS is set. In principle, this is the only environment variable you need set. You can either export it manually:
export MIDASSYS=/path/to/midas/installor let the detection script try to configure it (this doesn't always work well):
cd scripts/environment
./detect_environment.sh
source .env
cd ../..The script will:
-
Search for a MIDAS installation and set
MIDASSYS. -
Search for an
exptabfile and setMIDAS_EXPTABandMIDAS_EXPT_NAME. -
List candidate install paths for ZeroMQ and cppzmq, but will not set them automatically. If needed, add to
.envmanually. This should only be needed for local installs of ZeroMQ.export ZEROMQ_ROOT=/path/to/zeromq export CPPZMQ_ROOT=/path/to/cppzmq
Then source the .env file before running ./scripts/build.sh:
source scripts/environment/.envAll project dependencies are managed automatically via CPM.cmake. This includes:
- cppzmq (header-only)
- oneTBB
- analysis_pipeline_core
- analysis_pipeline
- midas_receiver
- unpacker_data_products_core
- midas_event_unpacker_plugin
You do not need to install these manually — CPM fetches and builds them during configuration.
From the repository root:
./scripts/build.sh --overwrite./scripts/build.shThe script handles:
- Creating
build/ - Running CMake
- Running
make -jN(with-jdefaulting to all processors)
Output:
- Executables:
build/bin/ - Libraries:
build/lib/
Use the provided run.sh wrapper:
./scripts/run.sh [OPTIONS] [-- <args>]-
-h, --help– Show help -
-d, --debug– Run under gdb -
-v, --valgrind– Run under valgrind -
--preload <libs>– Comma-separated list of libraries toLD_PRELOAD
Run normally:
./scripts/run.sh -- -c config.jsonRun with gdb:
./scripts/run.sh --debug -- -c config.jsonRun with valgrind:
./scripts/run.sh --valgrind -- -c config.jsonFor long-running sessions, you can run publisher inside a detached screen:
./screen_publisher [--no-log]Stop it with:
./stop_publisher_screen.sh-
MIDASSYS not setEnsure you have installed MIDAS and exported the path.export MIDASSYS=/path/to/midas -
ZeroMQ not found Install
libzmqfrom your system package manager. If installed to a custom location, set:export ZEROMQ_ROOT=/path/to/zeromq -
cppzmq not found Normally fetched automatically by CPM. If you want to use a system-installed version:
export CPPZMQ_ROOT=/path/to/cppzmq
- This project is an application, not a library — there is no
install()step. - Dependencies are pinned via
cmake/CPMConfig.cmake. - No manual cloning of submodules is required.