Skip to content

Find GeoModelXml in Ubuntu24 and include tomlplusplus as a prerequisite#40

Open
antonioiuliano2 wants to merge 2 commits into
mainfrom
ubuntu24
Open

Find GeoModelXml in Ubuntu24 and include tomlplusplus as a prerequisite#40
antonioiuliano2 wants to merge 2 commits into
mainfrom
ubuntu24

Conversation

@antonioiuliano2

@antonioiuliano2 antonioiuliano2 commented Jun 19, 2026

Copy link
Copy Markdown

Dear all,

This pull request follows a build test of this repository in my Ubuntu24.
All prerequisites, CMake, C++ and GeoModel are installed system-wide via standard apt-get install commands.

I have encountered two errors:

  • Could not find a package configuration file provided by "tomlplusplus" -> solved with sudo apt-get install libtomlplusplus-dev. Added as a prerequisite in the README.

  • geomodel.dtd not found at /usr/lib/share/GeoModelXml/geomodel.dtd; The file is actually in /usr/share/GeoModelXml/geomodel.dtd. There is no /usr/lib/share in my Ubuntu24 laptop. Solved by adding an if condition in the TimingDetector CMakeFile

All the best,
Antonio

Summary by CodeRabbit

  • Bug Fixes

    • Resolved GeoModelXml folder location detection issue for Ubuntu 24 environments.
  • Documentation

    • Added tomlplusplus library to the list of required dependencies in prerequisites, with project URL reference.
  • Chores

    • Enhanced build system configuration to improve geomodel file detection and conditional warning handling during the build process.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The TimingDetector CMake is updated to compute _gt_prefix from a deeper relative path of GeoModelTools_DIR and expands the DTD lookup into an explicit conditional block with a WARNING on failure. README.md adds tomlplusplus as a prerequisite, and CHANGELOG.md records the ubuntu24 build fix.

Changes

Ubuntu24 GeoModelXml Build Fix

Layer / File(s) Summary
GeoModelTools prefix path and DTD warning
subsystems/TimingDetector/CMakeLists.txt
_gt_prefix is now derived from a deeper relative path off GeoModelTools_DIR; the DTD lookup is rewritten as an explicit if(EXISTS)/configure_file/else()/message(WARNING) block replacing the previous compact form.
CHANGELOG and README updates
CHANGELOG.md, README.md
CHANGELOG 0.2.1 "Bug fixes" gains a bullet for locating the GeoModelXml folder on ubuntu24; README "Prerequisites" adds tomlplusplus with its project URL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ShipSoft/Geometry#35: Modifies the same geomodel.dtd path resolution logic in subsystems/TimingDetector/CMakeLists.txt, directly overlapping with the DTD lookup refactor in this PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding Ubuntu24 support for GeoModelXml path discovery and including tomlplusplus as a documented prerequisite, both of which are central to resolving the build compatibility issues addressed in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ubuntu24

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
README.md (1)

40-40: ⚡ Quick win

Add distro package hints for tomlplusplus in prerequisites.

Line 40 confirms the dependency, but adding package names (e.g., Ubuntu: libtomlplusplus-dev) would make setup faster and aligns with this PR’s Ubuntu 24 fix context.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 40, The tomlplusplus dependency listed at line 40 in the
prerequisites section lacks distro-specific package installation hints. Add
package name references for popular Linux distributions (such as Ubuntu with
libtomlplusplus-dev) to help users quickly install the required package without
having to search for the correct package name for their system. This should be
added inline or as a parenthetical note next to the tomlplusplus link to
maintain consistency with the PR's goal of improving setup documentation for
Ubuntu 24.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@subsystems/TimingDetector/CMakeLists.txt`:
- Around line 37-43: The DTD lookup using fixed-level path traversals in the
get_filename_component call with _gt_prefix is layout-sensitive and fails for
standard installs. Replace the hardcoded 4-level and 3-level relative path
traversals (using "../../../..") with a more robust approach that uses
GeoModelTools-provided CMake variables or package hints to determine the correct
prefix path, or use a layout-agnostic discovery mechanism that works across
different install directory structures. Ensure the resulting _geomodel_dtd path
is correctly resolved and properly copied to ${GMX_OUT_DIR}/geomodel.dtd for
downstream GMX parsing.

---

Nitpick comments:
In `@README.md`:
- Line 40: The tomlplusplus dependency listed at line 40 in the prerequisites
section lacks distro-specific package installation hints. Add package name
references for popular Linux distributions (such as Ubuntu with
libtomlplusplus-dev) to help users quickly install the required package without
having to search for the correct package name for their system. This should be
added inline or as a parenthetical note next to the tomlplusplus link to
maintain consistency with the PR's goal of improving setup documentation for
Ubuntu 24.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 34cb64d8-6b50-402d-a568-320274177f7d

📥 Commits

Reviewing files that changed from the base of the PR and between 59f92e7 and c1f3179.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • README.md
  • subsystems/TimingDetector/CMakeLists.txt

Comment on lines +37 to +43
get_filename_component(
_gt_prefix
"${GeoModelTools_DIR}/../../../.."
ABSOLUTE
)
set(_geomodel_dtd "${_gt_prefix}/share/GeoModelXml/geomodel.dtd")
if(EXISTS "${_geomodel_dtd}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Demonstrate path resolution sensitivity for common GeoModelTools_DIR layouts.
python - <<'PY'
from pathlib import Path
examples = [
    "/usr/lib/cmake/GeoModelTools",
    "/usr/lib/x86_64-linux-gnu/cmake/GeoModelTools",
]
for p in examples:
    up4 = str((Path(p) / "../../../..").resolve())
    up3 = str((Path(p) / "../../..").resolve())
    print(f"{p}\n  up4={up4}\n  up3={up3}\n")
PY

Repository: ShipSoft/Geometry

Length of output: 183


🏁 Script executed:

# Verify the actual code at lines 37-43 in subsystems/TimingDetector/CMakeLists.txt
cat -n subsystems/TimingDetector/CMakeLists.txt | sed -n '35,50p'

Repository: ShipSoft/Geometry

Length of output: 631


🏁 Script executed:

# Search for other GeoModelXml references in the codebase
rg "GeoModelXml|geomodel\.dtd" --type cmake

Repository: ShipSoft/Geometry

Length of output: 912


🏁 Script executed:

# Check for other DTD lookup logic related to GeoModelTools
rg "GeoModelTools_DIR" --type cmake -A 5

Repository: ShipSoft/Geometry

Length of output: 1035


🏁 Script executed:

# Verify timing_detector.gmx exists and inspect how it uses the DTD
find . -name "timing_detector.gmx" -o -name "*.gmx" | head -5

Repository: ShipSoft/Geometry

Length of output: 114


🏁 Script executed:

head -20 subsystems/TimingDetector/data/timing_detector.gmx

Repository: ShipSoft/Geometry

Length of output: 1959


Make DTD lookup robust across GeoModelTools install layouts.

Lines 32 and 39 attempt fallback lookups using 3-level and 4-level path traversals from GeoModelTools_DIR. Both approaches are layout-sensitive: for standard installs like /usr/lib/cmake/GeoModelTools or /usr/lib/x86_64-linux-gnu/cmake/GeoModelTools, both traversals overshoot and resolve to incorrect prefixes (/usr or /), causing the DTD lookup to fail. When the DTD is not found, it is not copied to ${GMX_OUT_DIR}/geomodel.dtd, and downstream GMX parsing (which expects geomodel.dtd by filename) fails at runtime.

Suggested fix
-    get_filename_component(
-        _gt_prefix
-        "${GeoModelTools_DIR}/../../../.."
-        ABSOLUTE
-    )
-    set(_geomodel_dtd "${_gt_prefix}/share/GeoModelXml/geomodel.dtd")
-    if(EXISTS "${_geomodel_dtd}")
+    set(_geomodel_dtd "")
+    foreach(_cand
+        "${GeoModelTools_DIR}/../../../../share/GeoModelXml/geomodel.dtd"
+        "${GeoModelTools_DIR}/../../../share/GeoModelXml/geomodel.dtd"
+    )
+        if(EXISTS "${_cand}")
+            set(_geomodel_dtd "${_cand}")
+            break()
+        endif()
+    endforeach()
+    if(_geomodel_dtd)
         configure_file(
             "${_geomodel_dtd}"
             "${GMX_OUT_DIR}/geomodel.dtd"
             COPYONLY
         )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
get_filename_component(
_gt_prefix
"${GeoModelTools_DIR}/../../../.."
ABSOLUTE
)
set(_geomodel_dtd "${_gt_prefix}/share/GeoModelXml/geomodel.dtd")
if(EXISTS "${_geomodel_dtd}")
set(_geomodel_dtd "")
foreach(_cand
"${GeoModelTools_DIR}/../../../../share/GeoModelXml/geomodel.dtd"
"${GeoModelTools_DIR}/../../../share/GeoModelXml/geomodel.dtd"
)
if(EXISTS "${_cand}")
set(_geomodel_dtd "${_cand}")
break()
endif()
endforeach()
if(_geomodel_dtd)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@subsystems/TimingDetector/CMakeLists.txt` around lines 37 - 43, The DTD
lookup using fixed-level path traversals in the get_filename_component call with
_gt_prefix is layout-sensitive and fails for standard installs. Replace the
hardcoded 4-level and 3-level relative path traversals (using "../../../..")
with a more robust approach that uses GeoModelTools-provided CMake variables or
package hints to determine the correct prefix path, or use a layout-agnostic
discovery mechanism that works across different install directory structures.
Ensure the resulting _geomodel_dtd path is correctly resolved and properly
copied to ${GMX_OUT_DIR}/geomodel.dtd for downstream GMX parsing.

@olantwin olantwin self-assigned this Jun 19, 2026
@olantwin

Copy link
Copy Markdown
Contributor

Thanks @antonioiuliano2, I'll have a look.

If this doesn't interfere with the pixi/conda build, fine. But conda is the recommended way of defining the environment, and other packaging systems (e.g. apt) can not be supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants