Search code examples
xcodeqtmacos-sierra

malformed mach-o image: symbol table underruns __LINKEDIT


Using the new Xcode 8 GM build on the GM of macOS Sierra, I've recompiled a Qt 5.7 C++ project and I'm getting the following error message when trying to launch the app:

Reason: no suitable image found. Did find:

/path/to/my/lib/libio_core.dylib: malformed mach-o image: symbol table underruns __LINKEDIT

This doesn't occur on debug builds, only release. Does anyone have an idea as to what this means and how to go about fixing it?


Update:

This actually has nothing to do with Xcode 8. Building the same code with Xcode 7.3.1 results in the same outcome. It seems some apps that ran just fine on El Capitan won't run on Sierra and fail with the above error.


Update 2: Details about the symbol table in my binary:

Load command 5
     cmd LC_SYMTAB
 cmdsize 24
  symoff 0
   nsyms 0
  stroff 12760
 strsize 8

Solution

  • Turns out this was caused by Qt. Qt 5.7.0 calls strip with no arguments when performing the install task on libs. With macOS Sierra this results in a dylib with an empty symtab.

    This bug will be fixed in Qt 5.7.1. In the meantime, just make sure you call strip with -S -x for dynamic libraries.