frameworks • Carthage/Cocoapods errors • Get out of problems when things go south 03.6.19 Tommaso Piazza - @tmpz https://github.com/blender 2 Undefined symbols for architecture x86_64: "_thisWillTotallyBeThere", referenced from: _main in trust-me-c9e7ba.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /private/var/mobile/Containers/Bundle/Application/... Reason: image not found
https://github.com /blender 03.6.19 8 • The compiler checks your code against .h files • Name, arguments, return type • References to external symbols (functions, variables, constant from libraries) left undefined • Mismatch?
https://github.com /blender 10 man ld • The binary fromthe linked library is copied into the final product • No binary share • Relatively simple process You may knowld for messages like... Undefined symbols for architecture x86_64: "_thisWillTotallyBeThere", referenced from: _main in trust-me-c9e7ba.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 03.6.19
https://github.com /blender 11 man dyld • The binary from the linked library is not copied into the final product • Binary share • Address of symbols resolved at load time • Runtime penalty, DYLD_PRINT_STATISTICS_DETAILS=1 You may know dyld for messages like... dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /private/var/mobile/Containers/Bundle/Application/... Reason: image not found 03.6.19
https://github.com /blender 03.6.19 Contains • Information about the Data part of the file • Segments LC_SEGMENT_64 • Sections in each segment • Read with • otool -l Answers • Where is the symbol table? LC_SYMTAB, • What is the minimum version of the OS? LC_VERSION_MIN_IPHONEOS • Where is main? LC_MAIN • What libraries should be loaded? LC_LOAD_DYLIB • Where is the code signature? LC_CODE_SIGNATURE 18
Read with: dsymutil –symtab <file> if you have dsymor nm –Am <file> if not stripped • LC_DYSYMTAB (dynamic symbol table, AKA symbols from other files) • Can include debug symbol • strip –SxXNT <file> Tom m aso Piazza - @ tm pz https://github.com /blender 03.6.19 19