Xcode Archive debug strip errors - ios

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?

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.

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

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.

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.

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!

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

I fixed this error by freeing up more space

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

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.

Try setting
STRIP_INSTALLED_PRODUCT to No for your target(one for which you are getting error) build setting.
if this does not work then try below along with above option
Dead Code Stripping: NO
Strip Debug Symbols During Copy: NO for all configurations
Strip Style: Non-Global Symbols
Hope this will solved your problem.

Related

Swift: conditional compilation flags must be valid Swift identifiers

Today i downloaded the XCode 9.0 Beta 4 and after building my project i get the next warning messages
<unknown>:0: error: conditional compilation flags must be valid Swift identifiers (rather than '-Xfrontend')
<unknown>:0: error: conditional compilation flags must be valid Swift identifiers (rather than '-debug-time-function-bodies')
Command /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
I have tried several options like i have searched it here but cannot find any solution to this.
Cleaned the project
Cleaned the build folder
Restarted XCode
Restarted laptop
Anyone on this?
This issue appeared for me, while I started the app for the first time in Xcode 9.
I had duplicated values in Build Settings -> Other Swift Flags. After removal of duplications the app started to work as expected.
Locate in your project settings and individual target settings the following:
Other Swift Flags
Delete it.
Compile.
Other Swift Flags cannot have a value that contains a dash "-", but in Swift 3.2 the values do need a "-D" prefix
At some point, you or a coworker included those flags to see how long Xcode takes Swift files to compile. You can remove them as they don't affect compilation. Not sure if they are still supported but if they are, Active Compilation Conditions don't take the format of starting with a dash anymore it seems.
This worked for me, hopefully this may help other people:
Steps:
Click on your project name in the upper left corner.
Make sure you select your project, not targets
Check if the Debug/Release fields in the "Active Compilation Conditions" contain '-Xfrontend' and/or '-debug-time-function-bodies', if so, try removing them (maybe write them down in case it doesn't work so you don't fuck things up even more lol)
Clean Project, Restart Xcode, and if you're using CocoaPods, run a pod update
This is how I fixed my issue, which was almost exactly the same as yours, hope this helps. Good luck.

Restkit/Restkit.h file not found Xcode 6.1

I was working on Project in Xcode 6.1. It was working fine and all of sudden it prompted an error 'Restkit/Restkit.h file not found'. I'm getting error after changing Architectures from $(ARCHS_STANDARD_32_BIT) to Standard architectures (armv7,arm64) - $(ARCHS_STANDARD) which is recommended by Apple Check Link
I have tried following approaches :
1.'Cleaning' project and rebuilding
2. Checked for missing framework in Target -> Build Phases
3. Fixed 'Framework Search Path' of Target
4. I have build Restkit XcodeProject and Targets separately. It builds without error.
I was getting below error while submitting to App Store and hence changed architecture to 'Standard architecture'
Why did this occur all of sudden? How to fix it?
Just to be here. There is similar issue in newest Xcode 7+. You can observe "RestKit/RestKit.h file not found" failure on archive build. You could compile and run apps on emulator but archive would fail.
To fix this you need to add one line to "Header Search Paths" in Build Settings:
"$(BUILD_DIR)/../IntermediateBuildFilesPath/Headers"
Be sure to include the surrounding quotes.
You have not properly changed Architecture , if you have done properly than it will show you like this,
Proper Architecture setting:
So again properly change Architecture and try again.
This is your Architecture Setting
I had used third-party static library in project named libNuance.a. It seems that this static library works fine for 32-bit architecture but failed for 64-bit architecture.
I downloaded updated version of libNuance.a library from their official site and changed architecture to Standard architectures (armv7,arm64) - $(ARCHS_STANDARD).
Vola! build succeeded without any error.
First you can try, look for it in project navigator(left side) and delete if it is red.After that add the RestKit again.Be sure when adding check the copy if needed box and packages contains headers.
Also you may try just #import "RestKit.h"
I had solved this in many cases by deleting the contents of DerivedData folder. See the following questions on how to do this:
Can I safely delete contents of Xcode Derived data folder?
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?
If you have Pods configured then and if you have upgraded recently your Xcode, try reinstalling cocoapod and all the reinstall all required pods.
I fixed this issue, to change the Header Search Path
"$(SOURCE_ROOT)/RestKit-RestKit-c19a500/Build"
Note : "RestKit-RestKit-c19a500" this is my RestKit folder name.

Apple LLVM 6.0 Error: clang failed with exit code -1

I created my app on my MacBook Air and kept working with it there which was fine. Then I started working with a colleague who used another Mac (of course). Anyway, we share our Xcode project via Dropbox (we are just switching to BitBucket, don't worry ;) ), when he tried to open the project on his Mac there was a Apple LLVM 6.0 Error with the following error while on my computer the same project runs perfectly:
clang: error: no such file or directory: '/Users/linus/Dropbox/Apps/My App/Projekt/My App/SlideMenu/SlideMenu-Prefix.pch'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
The last lines of the error seem most important to me which is why I listed them here.
I do know this question was asked several times now but there was never a useful answer which worked for me. I tried to disable the Foundation Assertions as it said in another answer on this topic but that did not work. Also I restarted & even reinstalled Xcode and all files are existing, none should be missing.
I am running Xcode 6.0.1 and Mac OS X 10.10. I hope someone can answer this, I'm kind of desperate now...
Hey I just ran into the same problem. Basically I deleted my tests target. I found this:
Errors When Compiling iOS 8, Xcode 6.0.1
Which basically says that:
Click on the name of your project on the list of files/folders on the
left in Xcode (at the very top of the list). Look at the "Targets"
section on the left-hand side of the window to the right. Likely,
there's two listed with the second being a "test" item. Right-click on
that item and select "delete". Then try to run the project again. See
screenshot below for a visual cue.
And a picture to help you out:
Hope this helps!
EDIT: Also in the tests target, I actually found that I didn't necessarily need to delete it, there was a broken path, just fixing it makes it all work again.
Make new file: ⌘cmd+N
iOS/Mac > Other > PCH File > YourProject-Prefix.pch.
Project > Build Settings > Search: "Prefix Header".
Under "Apple LLVM 6.0" you will get the Prefix Header key
Type in: "YourProjectName/YourProject-Prefix.pch"
Clean project: ⌘cmd+⇧shift+K
Build project: ⌘cmd+B
Solved this by going to my project settings and changing the deployment target. The deployment target was originally at 7.0. When i changed it from iOS 8.0 -> 9.1 it works fine and there is no error.
Hope that helps :)
You do not need to delete the overall build settings. Just change the Library Search Paths, here are the steps:
Click on your project name (very top of the navigator)
Click on your project target
Click the tab Build Settings
Search for LIBRARY_SEARCH_PATHS
Change its value to $(inherited) flag.
Here you go!
Or else you can always remove the build setting at all! Cheers!
One of the simple things I did I went into "Build Options" and changed the property for Enable Bitcode from yes to no
This fixed my issue.
Screenshot of Settings
clang can't locate your precompiled header file. Have you checked whether there is a file named SlideMenu-Prefix.pch in /Users/linus/Dropbox/Apps/My App/Projekt/My App/ ? The path to the precompiled header file is specified by the "Prefix Header" build setting for your target.
Try,
In Xcode project settings,
Targets-> Tests section-> Build Settings->Linking remove all linkig
OR Remove Tests Section as a whole.
Build again and Its done!!

Error during archive: symbols referenced by indirect symbol table entries that can't be stripped

I have a project which compile and run fine (even when built using "build for archive" command).
However, when I want to Archive it (for MAS publishing), I get the following error:
Command /Developer/usr/bin/strip failed with exit code 1
/Developer/usr/bin/strip: symbols referenced by indirect symbol table entries that can't be stripped in xxx
where xxx is a subproject of my project (framework).
What can be the issue? (I checked, everything is properly signed)
In my case, changing Strip Style build setting from All Symbols to Debugging Symbols fixed the problem.
strip has to do with the symbol stripping during archiving/building. We will need slightly more error information to give you better help.
It sounds like the subproject may be having it's symbols stripped and shouldn't be. Try opening the build settings for the sub-project and turn "Strip Debug Symbols During Copy" off and see if that fixes it.
Please Check your subProject's Target Membership in your project. Before building for Archive, Please build for normal mode. This is an easy way to check any linking errors.

Xcode 4.1 fatal error: stdlib modified since the precompiled header was built

Building an iPhone app, using:
Xcode 4.1
Base SDK iOS 4.3
Apple LLVM Compiler 2.1
I have started getting the following error:
fatal error: file
'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'
has been modified since the precompiled header was built
I have tried reinstalling Xcode and OS X - no luck. What's causing this?
First try a clean build via the Product -> Clean menu (as of XCode 4.6.2).
If that still doesn't work then open the Organizer (from the menu select Window->Organizer). Once the Organizer is open, select Projects from the toolbar at the top of the window. On the left is a list of projects, select the one you are having a problem with.
The details panel (to the right of the list) will display the project name, location, status. The row beneath that shows where the Derived Data is located. Click the Delete... button the far right. A dialog will appear, click Delete.
You can also manually delete the Derived Data:
~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}
This directory contains built products and indexes for the project. It is OK to delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.
I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.
Deleting the DerivedData folder did not work for me when Archiving.
I had to look at Build Settings - Build Locations - Precompiled Header Cache Path and delete that folder.
For me that was:
/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders
I thought I would add a separate answer rather than a comment to Cryptognome's answer, because it is in fact a different solution when the issue comes from running xcodebuild. Like Cryptognome, I had the error come up with the command-line tool xcodebuild. As an alternative to manually going into the /var subfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variable SHARED_PRECOMPS_DIR, e.g as follows
xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH
This way, I never get the error in automatic builds.
Note in the above command, I would also typically set the OBJROOT and SYMROOT env var to build also in /tmp. At the end, I clean things up.
The xcodebuild command line tool sometimes fails with this error. This happened to me when I synched an svn workspace to an earlier build. The xcodebuild tool keeps its precompiled headers in the folder Ants mentioned:
/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/
You have to look in the build command itself to see the actual folder name (-include /var/...), but it may be using several if you're building for different architectures (arm6, arm7, simulator, e.g.) So if you're having this problem with a command line build, just delete everything in /var/.../SharedPrecompiledHeaders.
Remove the contents for the Simulator by iOS Simulator > Reset Content and Settings... and hit Rest. This will remove any existing pre-compiled instances of the headers and resources. This worked for me
Solution:
1)Product->Clean
2)Product->Build
Error Type:
a kind of Build error
One of the causes:
one might have changed the framework file.
This sometimes happens when a change is made to a framework that another framework depends upon. The precompiled header cache gets out of sync, and Xcode is unable to compile the given project.
One of the Scenarios:
one might have chosen Jump To Definition and did some change after selecting a framework control.
I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.
I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..
Xcode->delete->install again
It might help some one...
I had this error on cordova when I ran : cordova run ios
fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
'/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
I tried with clean and build but doesn't work, finaly I removed the folder '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode' and works!
This tip, may be help others
Clean ways are not working for me, eventually I solved this issue by reinstall XCode.

Resources