runtime error ‘symbol not found in flat namespace’ on macOS 12 but not macOS 10.15, with both Xcode and CMake builds

1k Views Asked by At

I have problems building an executable file for a simple disease-transmission model implemented in C++, using cmake under macOS Monterey (v12.6.1). When I build the executable file, I obtain the following error when I try running it:

dyld[5281]: symbol not found in flat namespace (_cblas_caxpy) Abort trap: 6

The problem persists when I try to use XCode (v14.0.1) instead, resulting in the same error message.

Interestingly, my friend is able to build (& run) the executable file under macOS v10.15.7 without any problems.

Does anybody know what is going on here and how this issue can be resolved? The C++ project is publicly available on GitHub: https://github.com/AnnaMariaL/DengueSim

Any help would be very much appreciated.

Thanks!

Anna

  • tried: build an executable file with cmake, and Xcode under MacOS v12.16.1
  • expected: executable file
  • the program runs fine when launched under Xcode itself, but if I try to run the built executable from Xcode on the command line, that fails with the same error as for the CMake executable. So Xcode itself is, somehow, magically able to get this linker issue to resolve.
1

There are 1 best solutions below

3
Milan Š. On

Your title/post is very confusing, however the issue isn't with cmake. It's with your cblas library and/or your linker. Look at the bug closely:

dyld[5281]: symbol not found in flat namespace (_cblas_caxpy) Abort trap: 6

Your linker is telling you that it can't find a function (symbol) in the given namespace. This is either due to the fact that your linker doesn't know where to find the correct library or you are linking against a wrong version of the library that doesn't have the symbols. The other issues might be related to how the library was built and with what it was built (architecture, compiler, etc...). This we can't answer because we don't have enough information to know for sure.