"Symbols not found for arm64" error during linking

Geant4 Version: 11.1.1
Operating System: OSX Ventura 13.4
Architecture: arm64 (M1 Macbook Air)
Compiler/Version: Cmake: 3.26.4, gcc/g++: Apple clang version 14.0.3

I am trying to install Geant4 on my system (with the abovementioned specifications). When I run the make command, I encounter the following error during the step Linking CXX shared library ../../../../BuildProducts/lib/libG4ptl.dylib :

    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reaping losing child 0x600003a4d810 PID 2219 
make[2]: *** [BuildProducts/lib/libG4ptl.2.3.3.dylib] Error 1

The full output to make verbose=1 -d is attached in the following text file, along with the output of ccmake to show the build parameters.

While building, I have turned off multithreading and am using CLHEP 2.4.6.4 installed using Homebrew, the rest are default settings.
When using the internal CLHEP, I encounter the same error but instead during the step Linking CXX shared library ../../../BuildProducts/lib/libG4clhep.dylib.
Terminal Saved Output1.txt (39.7 KB)

As far as I’m aware, everything I’m using is up to date. I have tried re-installing Geant4 version 11.0.3 instead as well since I had managed to install that successfully last year, but I encountered the same issue.

Could you post the CMakeCache.txt file please? If you’re really using GCC and not clang, that could be the cause of the problem as not having arm64 symbols for the C++ standard library is very weird.

Sure, here it is.
CMakeCache.txt (30.6 KB)

Prompted by what you said, I checked the CXX compiler listed in CMakeCache.txt:

//CXX compiler
CMAKE_CXX_COMPILER:FILEPATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++

Checking its details from the terminal:

❯ c++ --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Thanks for the post and info - these look fine from a quick glance. Can you try:

$ make clean
$ make G4ptl VERBOSE=1

and post the output here please? We need to see the exact, full compile commands used at each step.

Oddly enough, it seems to not work at all:

❯ make clean
❯ make G4ptl VERBOSE=1
make: *** No rule to make target `G4ptl'.  Stop.
❯ make g4ptl VERBOSE=1
make: *** No rule to make target `g4ptl'.  Stop.

Looking into the possible make commands in Makefile, I tried the following with the attached result:

❯ make ptl-shared verbose=1

make_ptl-shared_error.txt (8.9 KB)

Thanks, and apologies for the wrong target name, but the “verbose” needs to be in uppercase

$ make ptl-shared VERBOSE=1

That’s the only way to get make to print the exact compile commands used in the output.

Apologies, please find attached the output from the correct command.
make_ptl-shared_error.txt (20.0 KB)

@bmorgan Do you possibly have any ideas as to what I could try to further diagnose the issue?

Sorry, I’ve been busy with other things, and will try and get back to this tomorrow or Wednesday. All I can suggest in the meantime is to try compiling some simple “Hello world” type C++ codes directly and see if these work. That would at least confirm the general system setup for compilation is o.k. If you have Homebrew installed, maybe also try running “brew doctor” to see if it picks up anything.

Sure, whenever is comfortable for you.
Simple C++ codes do work, and brew doctor did not pick up much - some warnings about deprecated formulae, but nothing that seems related to the issue. It did ask me to update my command line tools to Xcode 14.3, but I already updated to 14.3 last week.

That could be a clue. Every time I’ve updated my XCode, I have to go in and manually redo the “install command line tools” action. Otherwise the stuff in /usr/bin is the older version, and things get confused.

I took your advice and ensured there were no past versions of Xcode and that the latest version was being recognised, so that brew doctor stopped giving the warning, and tried running make again. It has worked!

I searched for the offending files from the previous errors, but the only lines in the verbose output which mentioned it were:

Considering target file `source/externals/ptl/src/CMakeFiles/ptl-shared.dir/build'.
 File `source/externals/ptl/src/CMakeFiles/ptl-shared.dir/build' does not exist.
  Considering target file `BuildProducts/lib/libG4ptl.dylib'.
   File `BuildProducts/lib/libG4ptl.dylib' does not exist.
    Considering target file `BuildProducts/lib/libG4ptl.2.3.3.dylib'.
     File `BuildProducts/lib/libG4ptl.2.3.3.dylib' does not exist.

And the like.

I’d guess those messages are just related to make considering what to build/rebuild - if there’s no error messages otherwise it should all be good.

I’ve fully updated Xcode and the Command Line tools today, and am able to build from scratch without error, so I guess the original error was down to a mismatch here.

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