Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No symbols/source for external library in Xcode 4

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 counterpart
  • When debugging, I see no source code and most of the call-stack is missing for the library: enter image description here
  • I have made sure "Show disassembly when debugging" is UNchecked

I built the library as DEBUG and then packaged up the headers+.a file into a SDK dir. So I guess I need to either copy the debug files into that SDK dir as well, or tell my application where to look. I'm not sure how to do either.

To clarify, my application project doesn't maintain a reference to the library project, only to the .a files and the header dirs. This is because the library project is created by CMake and I don't want to modify it.

like image 568
Mr. Boy Avatar asked Oct 15 '12 12:10

Mr. Boy


1 Answers

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.

like image 66
Mike Weller Avatar answered Nov 13 '22 23:11

Mike Weller