GitHub user edespino added a comment to the discussion: Introducing the [perfmon] Extension for Cloudberry Database Monitoring
## Building `perfmon` with SIGAR on Rocky Linux 9 – Dependency Discovery, Gaps, and Recommendations** While working to build the `perfmon` components (`gpsmon`, `gpmmon`) in **Apache Cloudberry (Incubating)** on **Rocky Linux 9**, I encountered a series of missing dependencies and compatibility issues. This was all triggered by running the top-level `configure` script with the `--enable-perfmon` flag: ```bash ./configure --enable-perfmon ``` At that point, everything appeared to proceed normally — but there were **no checks** in `configure` for required dependencies like **APR-util** or **SIGAR**. The failures only surfaced later during compilation. --- ### 🧰 Environment ```bash gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-5) ``` --- ### 🔍 Dependency Discovery & Remediation #### 1. **APR Header Missing in `gpmmon.c`** ```c gpmmon.c:23:10: fatal error: apr_queue.h: No such file or directory ``` **Resolution:** ```bash sudo dnf install apr-util-devel ``` --- #### 2. **SIGAR Header Missing in `gpsmon.c`** ```c gpsmon.c:20:10: fatal error: sigar.h: No such file or directory ``` **Action:** Cloned SIGAR manually: ```bash git clone https://github.com/hyperic/sigar.git cd sigar ``` --- #### 3. **SIGAR’s `autogen.sh` Fails Without `libtool`** ```bash libtoolize 1.5.x wasn't found, exiting ``` **Resolution:** ```bash sudo dnf install libtool ``` After that, `./autogen.sh`, `./configure`, and `make` ran — until deeper compilation issues arose. --- ### ❌ Compilation Errors in SIGAR #### Macro conflict: `major` / `minor` ```c error: called object ‘major’ is not a function or function pointer note: declared here: unsigned long major, minor; ``` Caused by local variables shadowing system macros from `<sys/sysmacros.h>`. #### Deprecated API warnings: ```c warning: ‘readdir_r’ is deprecated ``` Not currently fatal, but these will likely require cleanup in future glibc versions. > I did not attempt to patch SIGAR — leaving these issues for the developer to > evaluate. --- ### 🛠️ `configure` Recommendation The `configure` script should be updated to: * Check for presence of `apr-1` and `apr-util` headers/libraries * Check for SIGAR headers and `libsigar` availability * Provide helpful error messages or skip `perfmon` gracefully if missing This would improve the experience when building with `--enable-perfmon`. --- ### ⚖️ Considerations for SIGAR Moving Forward Given that **SIGAR is effectively abandoned** (last meaningful updates were \~2014), and its build system and source have not kept pace with modern Linux development, we should consider alternatives. Here are a few paths the project could take: #### ✅ Option 1: Vendor & Patch SIGAR Internally * Copy the minimal SIGAR source tree (`include/` + `src/os/linux/`) into the `perfmon/` tree. * Rename conflicting variables (`major`, `minor`), and gradually clean up deprecated code. * Maintain this minimal fork within the project under Apache 2.0 license terms. * Pros: Fastest path to stability. Controlled build. No external dependency. #### 🧹 Option 2: Replace SIGAR with `/proc`-based Native Code * Reimplement the small set of metrics used in `perfmon` using direct `/proc` parsing (as many modern tools do). * Drop SIGAR entirely. * Pros: Modern, no legacy baggage, fully under project control. * Cons: Requires modest development effort up front. #### 🧰 Option 3: Build a Thin Compatibility Shim * Abstract the limited SIGAR API used in `gpsmon/gpmmon` behind a clean wrapper. * Implement that wrapper internally, preserving the external API for now. * Could later swap in `/proc` or platform-native libraries underneath. --- ### ✅ Summary * The build experience with `--enable-perfmon` currently lacks dependency checks and leads to trial-and-error. * I resolved the issues up to SIGAR compilation, which still requires patching. * SIGAR is functional *but clearly outdated* and deserves reevaluation. * I've outlined several options to consider for modernizing or replacing SIGAR in a maintainable way. GitHub link: https://github.com/apache/cloudberry/discussions/1087#discussioncomment-13068099 ---- This is an automatically sent email for dev@cloudberry.apache.org. To unsubscribe, please send an email to: dev-unsubscr...@cloudberry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cloudberry.apache.org For additional commands, e-mail: dev-h...@cloudberry.apache.org