Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS static library compiled with Xcode remembers its source files

I compiled a static library for iOS with Xcode with symbols stripped. It's compiled in the Release configuration. When I copy the static library into another iOS project (I physically copy it into another directory), I'm still able to view the source of the static library when stepping through code. I clicked Show in finder in the source window and it pointed me to the appropriate source file on disk.

I opened the library in a hex editor, and it indeed contains paths to my source files on my machine, as well as a bunch of other text data that that shouldn't be exposed.

Have I missed something in my project settings? If this is expected behavior, how can I make sure that the customer will not see the symbols, source file names etc.?

like image 416
Phonon Avatar asked Dec 26 '22 17:12

Phonon


2 Answers

Found the compiler options required.

In LLVM code generation, set Generate debug symbols to No and Symbols hidden by default to Yes. For some reason, even if you tell it to strip symbols, it's not going to do it unless these are set.

like image 125
Phonon Avatar answered Dec 28 '22 05:12

Phonon


  1. You can check whether symbols are striped or not using

    nm filename

  2. Stripping doesn't happens automatically, you need to setup xcode to strip them and there are several flags that are in charge:

    a) DEPLOYMENT_POSTPROCESSING

    Prerequisite for: “STRIP_INSTALLED_PRODUCT (Strip Linked Product).”

    b) STRIP_INSTALLED_PRODUCT This one is going to work in non-appstore builds only if you will have set DEPLOYMENT_POSTPROCESSING to YES.

  3. There is a way to strip symbols manually, just call

    strip YOURBINARYNAME

like image 27
Andrei Shender Avatar answered Dec 28 '22 06:12

Andrei Shender