0

I got an iOS App with following nested structure:

iOS App (swift + objC) { 
 iOS Framework (objC + C++) {
    dynamic library (C++) {
      static library (C++)
    } 
  } 
}

It links and compiles successfully, but at runtime crashes with an error "dyld[58599]: missing symbol called". The crash is happening at the time when the code from the dynamic library is being called. The part of log which causes the crash:

*

Thread 3 name: Dispatch queue: sdf.export.queue Thread 3: 0 dyld
0x108049274 __terminate_with_payload + 8 1 dyld 0x10804e6ec abort_with_payload_wrapper_internal + 136 2 dyld 0x10804e700 abort_with_payload + 16 3 dyld 0x10801ea00 dyld4::halt(char const*) + 580 4 dyld 0x10802fd84 dyld4::APIs::_dyld_missing_symbol_abort() + 44

Please advise. I'm using Xcode 14.0 and iOS 15.6.1

Andrey Lyubimov
  • 663
  • 6
  • 22
  • 1
    Andrey, we cannot help with so little info. What's the missing symbol? Give you some hint: you can inpect your app in products directory. Get into the binary executable inside `Contents` -> `MacOS`, do dependency analysis with `otool -L ` to see if every dependency is within the app bundle. – kakaiikaka Sep 23 '22 at 00:17

1 Answers1

0

Apparently, it was a bad idea trying to use dynamic library on iOS – the system can't find it and you can't place it and its dependencies at the place you want. The path of LC_ID_DYLIB always reflects the path on the Mac and not on the iOS device.

So the solution is to convert the dylib into a framework and then it can be embedded successfully. I also noticed it needs to be embedded on the App level and not on the internal framework (as described in the question) level.

Andrey Lyubimov
  • 663
  • 6
  • 22