CMake Error Upon Startup

Geant4 Version: 11.3.0
Operating System: MacOS 15.1
Compiler/Version: Apple Clang
CMake Version: 3.31.2


When I run cmake .. to run my main file, I’m recieving the following error

CMake Error in CMakeLists.txt:
  Imported target "Geant4::G4Tree" includes non-existent path

    "/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



CMake Error in CMakeLists.txt:
  Imported target "Geant4::G4Tree" includes non-existent path

    "/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

I believe the problem is because when I run ls /Library/Developer/CommandLineTools/SDKs/ , I recieve:

MacOSX.sdk      MacOSX13.sdk    MacOSX14.5.sdk  MacOSX15.1.sdk
MacOSX13.3.sdk  MacOSX14.4.sdk  MacOSX14.sdk    MacOSX15.sdk

showing that MacOSX14.2 isn’t present. How can I change it so it uses a newer version of the folder?

This is due to the system being updated and the file Geant4PackageCache.cmake being out of date (it stores locations of packages used at the time Geant4 was originally built).

Simply locate that file in your install of Geant4 and delete it. It’s not required and CMake won’t use it if it’s not present, so this operation is safe.

I’ve tried this, yet I’m still getting the same error

Upon reinstalling homebrew and cmake, the error has now changed to:

CMake Error in CMakeLists.txt:
  No known features for CXX compiler

  "AppleClang"

  version 16.0.0.16000026.


CMake Generate step failed.  Build files cannot be regenerated correctly.
make: /usr/local/Cellar/cmake/3.31.0/bin/cmake: No such file or directory
make: *** [cmake_check_build_system] Error 1
dyld[12147]: Library not loaded: @rpath/libG4Tree.dylib
  Referenced from: <80C537BE-40DB-37B8-9651-4C5FD721CC7C> /Users/adwayagupta/Documents/CernGEANT4/TestProj/build/proj
  Reason: tried: '/usr/local/lib/libG4Tree.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libG4Tree.dylib' (no such file), '/usr/local/lib/libG4Tree.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libG4Tree.dylib' (no such file)

Is this a Apple or Intel based Mac, and how did you install Geant4 initially?

You probably also need to delete the build directory for your application, as the line

make: /usr/local/Cellar/cmake/3.31.0/bin/cmake: No such file or directory

shows it’s using the cached and now no longer present version of CMake.

This is an Apple based Mac.
I installed Geant4 using ccmake and the tar file from their website (I’m not really sure what you mean by how I installed it, please feel free to clarify if this is not what you meant).

Is there a way to completely reinstall Geant4, as I thought I’d’ve achieved that by deleting the directory and completely uninstalling brew / cmake?

I’ve deleted the build directory, and now it’s back to the original error.

O.k., if you go to the Apple menu in the top left and corner of the screen, and click on “About this Mac”, what is printed on the "Chip: " and "macOS: " lines?

It sounds like you compiled Geant4 from source, which is fine. I wouldn’t recommend installing it in the same location as Homebrew as I don’t think this is something they directly support anymore, though it’s still possible as long as you put it under a suitable named/versioned directory under the Cellar.

To reinstall, follow the original procedure to build Geant4 (not your application) from scratch. As this is 11.3.0 the package cache file shouldn’t be installed by default anymore, fixing that problem.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.