No symbols/source for external library in Xcode 4

前端 未结 1 1343
梦如初夏
梦如初夏 2021-02-03 12:20

My application is not seeing source code for a library:

  • If I \"Jump to definition\" on a library method, XCode takes me to the .h file but says there is no .cpp co
相关标签:
1条回答
  • 2021-02-03 12:42

    First of all, you should check the .debug_str section of your static library to verify it contains the appropriate debug information.

    Try running this command on the terminal:

    xcrun dwarfdump /path/to/library.a | grep "\.m"
    

    You should see a bunch of your source (.m) file paths printed out. Theoretically, this is where Xcode is going to look when you stop in the debugger, so make sure the paths here are correct. If you don't see any paths, you will need to pass an appropriate debug flag (e.g. -g to the compiler when building your library.

    If the paths are somehow incorrect, or you want to point them to some other location, you may be able to modify them as part of the build process in CMake, for example to make them relative to your project directory. Try looking at "Make gcc put relative filenames in debug information", which uses CMake to adjust these debug paths.

    0 讨论(0)
提交回复
热议问题