Strip symbols setting ignored by xcode

What’s going on here? Note that we DO want symbols in our binary, but that Xcode sets them to stripped…

Ok, Projucer, juce_ProjectExport_Xcode.h:

        if (config.isDebug())
        {
            defines.set ("_DEBUG", "1");
            defines.set ("DEBUG", "1");
            s.set ("COPY_PHASE_STRIP", "NO");
            s.set ("GCC_DYNAMIC_NO_PIC", "NO");
        }
        else
        {
            defines.set ("_NDEBUG", "1");
            defines.set ("NDEBUG", "1");
            s.set ("GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
            s.set ("GCC_SYMBOLS_PRIVATE_EXTERN", "YES");
            s.set ("DEAD_CODE_STRIPPING", "YES");
        }

        if (type != Target::SharedCodeTarget && type != Target::StaticLibrary && type != Target::DynamicLibrary
              && config.isStripLocalSymbolsEnabled())
        {
            s.set ("STRIPFLAGS", "\"-x\"");
            s.set ("DEPLOYMENT_POSTPROCESSING", "YES");
            s.set ("SEPARATE_STRIP", "YES");
        }

Surely that’s not right? Otherwise without defining the DEBUG macro you can’t have symbols post copy-step? The symbol stuff seems to at least partially ignore the config.isStripLocalSymbolsEnabled() result code?

Adding the following to the “Custom Xcode Flags” field should generate full debug symbols for a release config:

GCC_GENERATE_DEBUGGING_SYMBOLS = YES, STRIP_INSTALLED_PRODUCT = NO, COPY_PHASE_STRIP = NO

You may also need: UNSTRIPPED_PRODUCT = “YES”

It might be good if Strip Local Symbols either had a comment pointing out that disabling it still results in the symbols being stripped on release builds?

As it’s taken me about 6 hours, mainly waiting for a long build script, to solve the problem myself :slight_smile:

2 Likes