Xcode Archive debug strip errors

17.4k views Asked by At

I am trying to integrate a large legacy C++ library with an iOS app. We are able to build and run on device but we are not able to archive the app. Archiving fails with the following error.

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip failed with exit code 1

I did a -v on the strip and get a series of warnings similar to

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: symbols referenced by relocation entries that can't be stripped in: /MyApp/DerivedData/SmartMusic_iPad/Build/Intermediates/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/UninstalledProducts/libMyLib-iOS.a(MyWhatever.o)

It is not clear if this message is a warning or the reason for the failure. There are no other indications of problems in the strip output. Any clues?

9

There are 9 answers

1
trojanfoe On

There are different options to strip (see manpage) and I think you'll want to use the -r option. You can set the type of stripping to perform from within the Xcode project settings. See if you can relate the options in Xcode with the options in the manpage.

0
Said Çankıran On

In our project we have used InjectHotReload library to enable hot reload mechanism. This library caused for strip error. We removed from pod and also removed other linker flags which needed when setup InjectHotReload.

May someone see this and fix problem.

Good luck.

0
Olli On

What worked for me was when I decided to fix another issue in Xcode 10.1, my simulator hadn't been booting up and I ignored until I really needed it, running the command below helped fix this issue

sudo chmod 1777 /private/tmp
0
Gbaba On

I fixed this error by freeing up more space

0
Roberto Ferraz On

In my case I added the following to my library Target build settings and started working fine:

  • Dead Code Stripping: NO

  • Strip Debug Symbols During Copy: NO for all configurations

  • Strip Style: Non-Global Symbols

7
Mecki On

The default Strip Style in Xcode is All Symbols, which is okay for an executable but for a library you need to set this to Non-Global Symbols as global symbols must be be preserved.

Since stripping is only done as part of the deployment post processing, debug builds are usually not affected by this option as for them the setting DEPLOYMENT_POSTPROCESSING is usually set to NO. But when archiving, you create a release build and here DEPLOYMENT_POSTPROCESSING is set to YES by default and thus you need to have the correct strip style set.

0
donnadupuis On

Under build settings for the static library target, select NO for 'deployment postprocessing' and 'strip debug symbols during copy'. It is compiled code so it doesn't need symbols stripped. I was experiencing the same error ('usr/bin/strip failed with exit code 1') and this fixed it for me.

0
Tai Le On

I have same your problem, but I edit DEPLOYMENT POSTPROCESSING to NO but it doesn't work.

I just went to Build Phases tab in my target, and in Copy Bundle Resources I removed Foundation.framework, and then I add Foundation.framework into Link Binary With Libraries, it works for me!

Hope that will be solve your problem!

0
Emre Eran On

On Xcode 11.5, I solved this by setting Strip Linked Product to No in Build Settings of the Framework target.