fix(docker): build libcimpp from source on ARM64/macOS - #610
Conversation
Signed-off-by: Anas Bahr <anas.bahr@rwth-aachen.de>
There was a problem hiding this comment.
DPsim LLM review
Claim vs. code: matches the description.
TL;DR: One medium documentation-only concern was raised about the new ARM64/macOS libcimpp source-build path not being reflected in Docker docs; no code correctness, scheduling, or stamping issues were reported in this pass.
Found 1 medium (0 anchored to lines below).
🔵 Optional / low-confidence (1)
- Add documentation for libcimpp build behavior change in Dockerfile
[medium · 30% confidence · unconfirmed]inpackaging/Docker/Dockerfile.dev:75
Claim vs. implementation
- Claimed: Build libcimpp from source on ARM64/macOS while keeping prebuilt RPM installation for x86_64 Docker builds.
- Done: Dockerfile.dev now installs the prebuilt libcimpp RPM only on x86_64 and otherwise clones libcimpp v${LIBCIMPP_VERSION} from source, builds it with cmake/make, and installs it.
- Difference: none
How this review was produced
13 specialized finder passes raised 16 findings over the diff and the full changed sources. After de-duplication, 16 were re-checked against the current file and the base-class / interface headers it inherits (code as truth), escalating survivors to a stronger model: 15 refuted as unsupported, 1 kept (1 tentative).
Refuted by verification:
- Use robust curl options for package download (packaging/Docker/Dockerfile.dev): The curl already uses --max-time 300, --retry 3, and --retry-delay 5 on line 86.
- Pin git clone depth for libcimpp source build (packaging/Docker/Dockerfile.dev): The source path already pins libcimpp to the exact tag v${LIBCIMPP_VERSION} and uses --depth 1 on line 92.
- Add retry and timeout to RPM download to avoid indefinite blocking (packaging/Docker/Dockerfile.dev): The RPM download curl includes a 300-second timeout and retry policy on line 86.
- Remove redundant comment line (packaging/Docker/Dockerfile.dev): The comment on line 75 is the updated single-line description of both prebuilt and source-build behavior.
- Inconsistent quoting style in URL construction (packaging/Docker/Dockerfile.dev): The URL-encoded release path and the RPM filename serve different purposes and are both used as written on line 80.
- update comment to reflect new conditional logic (packaging/Docker/Dockerfile.dev): The comment explicitly mentions the new conditional source-build path for non-x86_64 platforms.
- correct misleading error message wording (packaging/Docker/Dockerfile.dev): The error is for unsupported CIM_VERSION values in the case statement, not for host architecture.
- Use SPDLOG_LOGGER_DEBUG for non-critical download progress (packaging/Docker/Dockerfile.dev): This is a Dockerfile RUN command, not a logging path; the curl progress/error handling is already implemented inline.
- Avoid stderr echo for unsupported CIM_VERSION (packaging/Docker/Dockerfile.dev): Printing the unsupported-version error to stderr with echo is standard Dockerfile shell error handling.
- Add retry and timeout to source build download of libcimpp RPM (packaging/Docker/Dockerfile.dev): The source-build branch is a git clone plus cmake/make path, and the finding’s claim about missing robustness is not a concrete defect in the file.
- Missing cleanup on source-build git clone failure (packaging/Docker/Dockerfile.dev): The source-build branch already removes /tmp/libcimpp after install on line 96.
- Add retry and timeout to prebuilt libcimpp download to avoid hanging CI builds (packaging/Docker/Dockerfile.dev): The prebuilt libcimpp download already has timeout and retry safeguards on line 86.
- Add SPDX license header to Dockerfile.dev (packaging/Docker/Dockerfile.dev): the file lacks an SPDX header, but Dockerfile.dev is an existing modified file and the missing header is outside the changed lines
- Hard‑coded lib64 library directory is non‑portable (packaging/Docker/Dockerfile.dev): the changed install path at line 94 matches the existing LD_LIBRARY_PATH entry /usr/local/lib64 at line 63, so the claimed runtime path mismatch is contradicted
- CMake install libdir hard‑coded to lib64 breaks ARM64 builds (packaging/Docker/Dockerfile.dev): line 94 installs libcimpp to /usr/local/lib64, and this Dockerfile explicitly adds /usr/local/lib64 to LD_LIBRARY_PATH before the build
Automated, non-blocking review. May be wrong. Models: find mistral-small-4-119b-2603, gpt-oss-120b → verify gpt-5.4-mini → final gpt-5.5.
|
| dnf -y install /tmp/libcimpp.rpm; \ | ||
| rm -f /tmp/libcimpp.rpm; \ | ||
| if [ "$(uname -m)" = "x86_64" ]; then \ | ||
| curl -sSL -L --max-time 300 --retry 3 --retry-delay 5 "${libcimpp_url}" -o /tmp/libcimpp.rpm || (echo "Failed to download ${libcimpp_url}" >&2; exit 1); \ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #610 +/- ##
==========================================
- Coverage 72.87% 72.82% -0.05%
==========================================
Files 497 497
Lines 32305 32305
Branches 17470 17470
==========================================
- Hits 23542 23527 -15
- Misses 8762 8777 +15
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
leonardocarreras
left a comment
There was a problem hiding this comment.
Hi @AnasBahr, i think this does not solve all what you mention in #609 as cases (it solves only for one container), as for many of the containers is done this way (ubuntu, rocky, etc). However, that can be a follow up.
Some comments:
- tag for
v2.2.0seems to berelease/v2.2.0, maybe that is why it does not work, that might be pre-existing (does it work on the branch)
- when compiling, is important to keep
CIM_VERSIONto select the CGMES
| else \ | ||
| echo "Building libcimpp from source for $(uname -m)"; \ | ||
| dnf -y install graphviz-devel libxml2-devel; \ | ||
| cd /tmp && git clone --branch "v${LIBCIMPP_VERSION}" --recurse-submodules --depth 1 https://github.com/sogno-platform/libcimpp.git && \ | ||
| mkdir -p libcimpp/build && cd libcimpp/build && \ | ||
| cmake ${CMAKE_OPTS} .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 && \ | ||
| make ${MAKE_OPTS} install && \ | ||
| rm -rf /tmp/libcimpp; \ | ||
| fi; \ |
There was a problem hiding this comment.
| else \ | |
| echo "Building libcimpp from source for $(uname -m)"; \ | |
| dnf -y install graphviz-devel libxml2-devel; \ | |
| cd /tmp && git clone --branch "v${LIBCIMPP_VERSION}" --recurse-submodules --depth 1 https://github.com/sogno-platform/libcimpp.git && \ | |
| mkdir -p libcimpp/build && cd libcimpp/build && \ | |
| cmake ${CMAKE_OPTS} .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 && \ | |
| make ${MAKE_OPTS} install && \ | |
| rm -rf /tmp/libcimpp; \ | |
| fi; \ | |
| else \ | |
| cd /tmp && git clone --branch "release/v${LIBCIMPP_VERSION}" --recurse-submodules --depth 1 https://github.com/sogno-platform/libcimpp.git && \ | |
| mkdir -p libcimpp/build && cd libcimpp/build && \ | |
| cmake ${CMAKE_OPTS} .. \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 \ | |
| -DUSE_CIM_VERSION=${CIM_VERSION} \ | |
| -DBUILD_SHARED_LIBS=ON \ | |
| -DBUILD_ARABICA_EXAMPLES=OFF \ | |
| -DCIMPP_BUILD_DOC=OFF && \ | |
| make ${MAKE_OPTS} install && \ | |
| cd / && rm -rf /tmp/libcimpp; \ | |
| fi; \ |
There was a problem hiding this comment.
no need for the dnf line, this is part of the base image already as i understand
dpsim/packaging/Docker/Dockerfile.dev
Lines 36 to 37 in 9e864da
| dnf -y install /tmp/libcimpp.rpm; \ | ||
| rm -f /tmp/libcimpp.rpm; \ | ||
| if [ "$(uname -m)" = "x86_64" ]; then \ | ||
| curl -sSL -L --max-time 300 --retry 3 --retry-delay 5 "${libcimpp_url}" -o /tmp/libcimpp.rpm || (echo "Failed to download ${libcimpp_url}" >&2; exit 1); \ |
There was a problem hiding this comment.
sSL never fails
| curl -sSL -L --max-time 300 --retry 3 --retry-delay 5 "${libcimpp_url}" -o /tmp/libcimpp.rpm || (echo "Failed to download ${libcimpp_url}" >&2; exit 1); \ | |
| curl -fsSL --max-time 300 --retry 3 --retry-delay 5 "${libcimpp_url}" -o /tmp/libcimpp.rpm || (echo "Failed to download ${libcimpp_url}" >&2; exit 1); \ |
| # Install libcimpp from prebuilt RPMs (x86_64 only) or build from source | ||
| RUN set -eux; \ | ||
| case "${CIM_VERSION}" in \ | ||
| CGMES_2.4.15_16FEB2016|CGMES_2.4.15_27JAN2020|CGMES_2.4.13_18DEC2013) \ |
There was a problem hiding this comment.
libcimpp_CGMES_3.0.0-2.2.0-Linux.rpm exists, but we have not tested in DPsim



Description
Resolves issue regarding Docker build failures on macOS/ARM64 architectures.
The current build process installs a precompiled
libcimppRPM package target built forx86_64Linux systems. On ARM64 macOS hosts, this binary is architecture-incompatible and breaks the image build.This PR adds architecture detection inside the
Dockerfileto dynamically buildlibcimppfrom source when running on ARM64 / macOS hosts, while preserving the precompiled package installation for standardx86_64targets.Changes Made
Dockerfileto detect host platform/architecture (x86_64vs.ARM64).libcimppfrom source onARM64environments.Related Issue'
Closes #609