Skip to content

Conversation

@fuhlig1
Copy link
Member

@fuhlig1 fuhlig1 commented Sep 16, 2025

  • Fix the build systems of several packages to allow the usage of CMake 4.0.
  • Fix compilation issues with Apple Clang 17
  • Allow to use a non standard (older) SDK to allow compilation with Clang 17
    - Don't overwrite CMAKE_OSX_SYSROOT which is passed as CMake parameter
    - Pass CMAKE_OSX_SYSROOT to all package build systems
    - Fix ROOT build system such that rootcint takes into account the defined CMAKE_OSX_SYSROOT

Also fix an issue with the usage of the pythia6 library. The libarary
wasn't found any longer such that it is explicitly added as
dependency.
The fix prevents a crash about wrong CMake versions when compiling
geant4_vmc.
Before a SDK defined via the CMake parameter CMAKE_OSX_SYSROOT was
overwritten with the value extracted from brew.
Clang 17 remove the header fp.h which is used in ROOT's copy of libAfterimage.
Add a patch which uses math.h instead.
The included ROOT version can't be compiled any longer with the SDK 15.
Specifing the older SDK 14 when running CMake (with -DCMAKE_OSX_SYSROOT)
only works partly since rootcling still uses the latest SDK version.
Add a patch such that rootcling also uses the specified SDK.
All projects depending on ROOT need also to set CMAKE_OSX_SYSROOT to the
same value used when building ROOT. Otherwise the dictionary generation
may fail.

Fix patch for ROOT using CMAKE_OSX_SYSROOT

minimize the patch
Fix a typo in the code. This code could actually never be compiled and
it is unclear why this compilation error only popped up now with
Clang 17.
The default bash version on macosx is to old to support all features
needed in the test suite of FairRoot.
The system version of make doesn't properly support the jobserver
such that the build process ins't properly parallelized.
Describe some known problems on macosx and the corresponding
solutions.
Pass the needed information to the boost build system if a non
standard SDK is used.
Pass the needed information to the pythia8 build system if a non
standard SDK is used.
@fuhlig1
Copy link
Member Author

fuhlig1 commented Sep 24, 2025

@dennisklein,

I have added two more commits which now also build pythia8 and boost with the proper settings. I had overlokked both packages before.

If your are fine with the PR I would like to squash some of the new commits and merge the PR.

@dennisklein
Copy link
Member

If your are fine with the PR I would like to squash some of the new commits and merge the PR.

👍

Some legacy C code can't be compiled with C standard version 23 which
is the new default for gcc15 so use C standard version 11 for the
compilation.
Add some missing include statements for <stdint>. Probably due to
header cleanup in the include files of gcc 15.
The legacy C code can't be compiled with C standard version 23 which
is the new default for gcc15 so use C standard version 11 for the
compilation.
For unknown reasons the pythia library isn't found any longer which
is fixed by adding possible library names.
Use C11 as standard C version when compiling FairRoot. The C code
of the MbsApi can't be compiled with C23 which is the new default
version with gcc15.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses compilation and build system compatibility issues for CMake 4.0 and Apple Clang 17, with specific focus on macOS SDK handling. The changes enable FairSoft to work with newer toolchain versions while maintaining backward compatibility.

Key changes include:

  • Updated CMake version requirements across multiple packages to support CMake 4.0
  • Fixed compilation issues with Apple Clang 17 through patches and SDK handling
  • Enhanced macOS build system to use proper tools (bash, make, patch) and SDK configuration

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/legacy/fairroot.sh.in Added C standard specification for FairRoot build
legacy/*/fix_cmake.patch Updated cmake_minimum_required statements to support CMake 4.0.1
legacy/setup-macos.sh Added bash and make packages to macOS dependencies
legacy/root/*.patch Applied fixes for Apple Clang 17 compatibility and SDK handling
legacy/geant4/*.patch Fixed typos and CMake compatibility issues
legacy/advanced.md Updated documentation about SDK usage with newer compilers
legacy/README.md Added detailed macOS compilation instructions
cmake/legacy.cmake Enhanced macOS tool detection and SDK propagation
FairSoftConfig.cmake Modified to respect externally set CMAKE_OSX_SYSROOT

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

The downside with picking the latest SDK version is that some older ROOT
versions can't be compiled any longer after updating the compiler and the
connected SDK. As described above the problems with compilation errors due
to **wrong** SDKs are because of ROOT and there mainly becuase of rootcling.
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

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

Spelling error: 'becuase' should be 'because'.

Suggested change
to **wrong** SDKs are because of ROOT and there mainly becuase of rootcling.
to **wrong** SDKs are because of ROOT and there mainly because of rootcling.

Copilot uses AI. Check for mistakes.
commands on macosx.

The **patch** command does not support the needed parameters,
so one needs ot install a version of the **patch** command with brew.
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

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

Spelling error: 'ot' should be 'to'.

Suggested change
so one needs ot install a version of the **patch** command with brew.
so one needs to install a version of the **patch** command with brew.

Copilot uses AI. Check for mistakes.
if not existing_ldlib: existing_ldlib = ""
my_env["LD_LIBRARY_PATH"] = os.path.join(rootdir, "lib") + ":" + existing_ldlib
+ if osx_sdk:
+ my_env["SDKROOT"] = 'osx_sdk'
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

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

String literal 'osx_sdk' should be the variable osx_sdk without quotes to use the actual SDK path value.

Suggested change
+ my_env["SDKROOT"] = 'osx_sdk'
+ my_env["SDKROOT"] = osx_sdk

Copilot uses AI. Check for mistakes.
@dennisklein
Copy link
Member

dennisklein commented Oct 1, 2025

@copilot Summarize all changes by commit and check whether the commit describes the changes adequately. If needed, suggest improvements.

@dennisklein
Copy link
Member

Commit Summary for PR #575

I've analyzed all 21 commits in this PR. Here's a comprehensive summary organized by topic:

1. CMake 4.0 Compatibility Fixes (7 commits)

These commits fix build systems to support CMake 4.0.1 by updating cmake_minimum_required() declarations:

  • dbabc9e [legacy] hepmc: Fix build system for CMake 4.0.1
  • abcdaa8 [legacy] zeromq: Fix build system for CMake 4.0.1
  • 3e5a333 [legacy] vc: Fix build system for CMake 4.0.1
  • 50a2207 [legacy] pythia6: Fix build system for CMake 4.0.1
  • b3ae9d8 [legacy] vmc: Fix build system for CMake 4.0.1
  • 4abb7d2 [legacy] vgm: Fix build system for CMake 4.0.1
  • 3d87072 [legacy] geant4_vmc: Fix build system for CMake 4.0.1

Assessment: ✅ Commit messages are clear and consistent. The pattern is good.

2. Geant Fixes (2 commits)

  • 03ff645 [legacy] geant3: Fix build system for CMake 4.0.1

    • Changes: Adds CMake 4.0 support + fixes pythia6 library dependency issue
    • Suggestion: Could be split into two commits (CMake version + pythia6 fix) OR rename to "[legacy] geant3: Fix build system for CMake 4.0.1 and pythia6 dependency"
  • baea65d [legacy] geant4: Fix config file

    • Changes: Prevents CMake version crash in geant4_vmc
    • Assessment: ✅ Good. Body explains the specific issue well.

3. macOS SDK and Clang 17 Support (7 commits)

  • de22628 [legacy] build system: Allow setting the proper SDK

    • Assessment: ✅ Clear. Prevents overwriting CMAKE_OSX_SYSROOT.
  • 6ea4176 [legacy] root: Fix compilation on macosx with Clang 17 and SDK 15

    • Assessment: ✅ Excellent. Comprehensive body explains multiple issues: fp.h removal, SDK version handling, rootcling SDK fix.
  • e1ac728 [legacy] geant4: Fix compilation crash with Clang 17

    • Assessment: ✅ Good. Explains it's a typo fix.
  • 6a82620 [legacy] setup scripts: Add new packages for macosx

    • Assessment: ✅ Good. Explains bash and make issues on macOS.
  • cd3a4e0 [legacy] On macosx use Homebrews patch and make

    • Assessment: ⚠️ Missing body. Should explain why (references gpatch/gmake availability and jobserver support).
  • a212554 [legacy] documentation: Add infos macosx

    • Suggestion: Typo in title: "infos" → "info for" or "information for"
    • Assessment: ✅ Body is clear.
  • a288850 [legacy] boost: Build Boost with correct SDK

    • Assessment: ✅ Clear and concise.
  • ee8846e [legacy] pythia8: Build Pythia8 with correct SDK

    • Assessment: ✅ Clear and concise.

4. GCC 15 Compatibility (3 commits)

  • 49a454d [legacy] root: Fix build with gcc15

    • Assessment: ✅ Excellent. Explains C23 standard issue and missing headers.
  • 6678e08 [legacy] geant3: Fix compilation for gcc15

    • Assessment: ✅ Good. Explains C23 issue and pythia library finding problem.
  • 24febab [legacy] tests: Fix test for gcc15

    • Assessment: ✅ Clear. Explains MbsApi C23 incompatibility.

5. Debian 13 Compatibility (1 commit)

  • 8fac280 [legacy] root: Fix compilation for Debian13
    • Assessment: ✅ Excellent. Provides context, references upstream fix, and links to Debian bug report.

Overall Assessment

Strong Points:

  • Most commits have clear, descriptive messages
  • Complex changes (ROOT/Clang17, Debian13) have excellent explanations
  • Good use of commit bodies to provide context

Suggestions for Improvement:

  1. cd3a4e0 - Add commit body explaining the rationale for using Homebrew's patch and make
  2. a212554 - Fix typo: "Add infos macosx" → "Add info for macOS" or "Add macOS information"
  3. 03ff645 - Consider renaming or splitting since it addresses both CMake 4.0 AND pythia6 dependency

Minor Issues Found:

  • Spelling errors in documentation (already flagged by copilot bot):
    • legacy/advanced.md line 65: "becuase" → "because"
    • legacy/README.md line 62: "ot install" → "to install"
    • legacy/root/fix_macos_sdk_for_rootcling.patch: 'osx_sdk' should be osx_sdk (without quotes)

Overall, the commits are well-structured and the PR is ready for merge after addressing the minor suggestions above! 🎉

@dennisklein
Copy link
Member

@fuhlig1 copilot does not yet respond to questions posted here directly, so I installed github copilot CLI and told it to reply to it, which it did as my user.

The version of ftgl contained in the ROOT source code results in a
compilation error with the gcc14 compiler suite used in Debian 13 and
the gcc15 compiler suite in OpenSuse 16.0.
For all other tested system the code is okay.
The problem was also found by the Debian team

https://www.mail-archive.com/debian-qa-packages@lists.debian.org/msg81745.html

and a fix is available from upstream

frankheckenbach/ftgl#20

Add a cmake check for OS and apply the fix only in case a Debian 13 or
OpenSuse 16.0 is found.
Properly pass CMAKE_OSX_SYSROOT to the build and test processes.
Don't test building onnxruntime if CMake version >= 4.0.0
@rlalik
Copy link

rlalik commented Dec 8, 2025

Hi, before I discovered the patches branches I also fixed the cmake issue for myself. Perhaps the solution proposed by cmake which does not require patching cmake files but passing proper options, would be better to use here? See here: b56c23d

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants