How to interpret a crashlog with no references to a specific class - objective-c

Today my app crashed and generated this crashlog. The crashlog does not mention any classes in my project and to me it seems almost impossible to tackle this issue.
Any ideas how to approach this problem? Thanks for your help!

There's a tool included in Apple's Developer's tools called symbolicatecrash. With it you can symbolicate crash reports, but note that you'll need the associated .dsym file of your build Check this post to see a tutorial using it.

This is how I ran the symbolitecrash binary.
Find the binary symbolitecrash
locate symbolitecrash
Optional: You may add a convenience link to /usr/bin
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash /usr/bin/symbolicatecrash
Copy the crash log to the Debug-iphoneos folder and go to the project
cp ~/Desktop/TheCrash.crash ~/Myproject/build/Debug-iphoneos
cd ~/MyProject/build/Debug-iphoneos
Run the crash log symbolicater
symbolicatecrash TheCrash.crash MyProject.app.dSYM > ReportWithSymbols.crash
The result
crashlog http://k.minus.com/jk4X2obwZMI7j.png

Related

Notarize process for macos application not working

I have developed an application for MacOS. I am including notarization process as part of its distribution. I have followed all the steps and I have run:
xcrun altool --notarize-app --primary-bundle-id "${APP_BUNDLE_ID}" --username "${APPLE_DEV_ID}" --password "${DEV_APP_SPECIFIC_PASSWORD}" --file "${DMG_PATH}"
Then I check notarization progress using:
xcrun altool --notarization-info "${notarize_uuid}" -u "${APPLE_DEV_ID}" -p "${DEV_APP_SPECIFIC_PASSWORD}
Output of it is:
RequestUUID: =<Request>
Date: 2019-05-26 09:40:34 +0000
Status: success
LogFileURL: <Log file>
Status Code: 0
Status Message: Package Approved =~ success ]]
Then I launch staple command:
xcrun stapler staple -v <dmg file>
It also ends with success:
The staple and validate action worked!
However when I extract the .app file and run:
spctl --assess --verbose ./macos/MyApp.app
./macos/MyApp.app/: accepted
According to the docs I have read it should say something like: “source=Notarized Developer ID”, right?
I am running this on MacOS Mojave 10.14.5
What am I missing??
Could someone help me?
Thanks in advance
In case someone faces the same problem I will post the solution to this:
First of all you must staple .app file not the dmg. This means you must extract the binary and staple it
Also in order to check if application has been notarized, in
`System Preferences - Security and Privacy`
Option Allow apps downloaded from: must have Apple Store and identifier developers option checked
Hope this helps
Both the app and the dmg may be notarized and stapled, seperately, one after the other. Try doing that and the error should go away.
Short answer
It could be due to an RPATH referencing a path outside the App bundle. Removing this RPATH would resolve the issue.
Inspecting log files
You can find extra information about the rejection (after trying to launch the blocked app) in the Console.app. Note that you should open the Console.app, before trying to open your blocked app, otherwise not all messages may be logged. You should look for process XprotectService in the logs of your device (i.e. choose your device in the left side bar of the Console.app). If the RPATH is indeed the problem, you should find a record like this:
XprotectService: [com.apple.xprotect:xprotect] File /path/to/your/executable/or/library failed on rPathCmd /rpath/causing/the/problem (rpath resolved to: (path not found), bundleURL: /path/to/your/bundle.app)
Inspecting these log files may give you a key to solve other issues too.
Note that I received the following information from an Apple engineer:
Gatekeeper does not inform users via UI about the specifics of the
error, though it is in the logs for developers to look at. The
notarization process is purely about a detecting malicious software
and does not replicate Gatekeeper enforcement. You still need to get
software notarized and test with Gatekeeper.
We are looking to provide better tooling for developers in the future
to pre-flight some of these common errors.
Contact Apple
If you are not able to solve your issue with the above information, you may want to contact Apple itself using the Feedback Assistant. They do not respond very quickly (~1-2 weeks), but the answers are rather to the point.

tar: Error opening archive: Can't initialize filter; unable to run program "bzip2 -d"

I'm trying to run this code from : https://github.com/pnnl/safekit ,using cmd on windows 10, I already installed python.
when I type the command:
tar -xjvf data_examples.tar.bz2
I keep getting the error:
tar: Error opening archive: Can't initialize filter; unable to run
program "bzip2 -d"
I have tried to download bzip2 through easy-7 zip and GnuWin32 , but it didn't work.
Can any one help me?
P.S.: I did search for the same problem before posting mine.
If you run the command in git bash instead of cmd it should work.
I've run into the same problem! My non-elegant solution so far has been to force Windows's tar.exe to use the bzip2.exe provided with my Windows Git installation. The trick is to add to your user PATH the directory where bzip2.exe is located, in my case:
C:\Program Files\Git\mingw64\bin
So, right now my PATH looks like:
Path=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Git\mingw64\bin
Notice that I've only touched the user environment PATH, not the system PATH, and I've appended the new directory. As always, touching your PATH can be a little bit dangerous, proceed with care. If someone has a better solution, I'd be glad to hear it.
Note: I tried copying the bzip2.exe to a separate directory, but this didn't work (I presume because bzip2.exe couldn't find some dependencies).

ObjC ARC contraction (clang crash)

I always hesitate to add a brand new question to the killer forums here, but I haven't seen anything close to this bug.
Seems clang has crashed on my while compiling one of my .m files. If anyone has seen or knows of any solution for the below I'd be immensely obliged.
This error occurs when I build for armv6 in a release configuration using XCode 4.4.1
But does not occur when I build for armv6 in a debug configuration, or release for armv7, armv7s or i386.
The specific error is "ObjC ARC contraction":
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/Users/Me/Documents/ThisProject/iOS/..../ClassFoo.m'.
4. Running pass 'ObjC ARC contraction' on function '#"\01-[ClassFoo evalJS:]"'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
In the ../Intermediaries/Project.build/armv6/ folder I see:
ClassFoo.dia
and I should see (like all of its surrounding files)
ClassFoo.d
ClassFoo.dia
ClassFoo.o
Here are the top 4 of the clang stack, in case someone recognizes something in it:
0 clang 0x00000001010536f2 main + 17107682
1 clang 0x0000000101053b79 main + 17108841
2 libsystem_c.dylib 0x00007fff93c428ea _sigtramp + 26
3 libsystem_c.dylib 0x00007fff93c7a54e tiny_malloc_from_free_list + 1078
edit: I also noticed when trying again recently that I'm getting complaints about the -fno-objc-arc flag -- perhaps the compiler sym-links are pointing at the wrong binaries?
Thanks in advance,
Miles
Thanks for all your interest, and I'm sorry to have to answer this question myself but no other solution I've tried has resulted in anything successful. I've done my best to document my adventure here as a how-to-guide to hopefully help a few others.
The short version:
Xcode 4.5+ does not support building to armv6 (iphone 3g).
With fresh installs of 4.5 & 4.4.1 I experienced various versions
of the original error.
The reason is two-fold:
xcspec files Xcode uses do not include entries for this architecture.
4 needed libclang_rt*.a files have had their armv6 slices stripped.
There is a solution! (see long version below)
The long version:
Amongst the many many frustrating attempts I made to sort this issue out, such as searching SO forums, searching apple dev forums, googling, endlessly fiddling with project settings, copying earlier SDKs into the Xcode.app packages, posting this question, filing a bug report with Apple, etc. ad infinitum <-- means, "and so in into infinity" each seemed to have either nothing pertinent to reveal or only a tiny tidbit of information.
The recipe for this solution finally took one frustrated and determined developer and the culmination of everything in one very long night.
So where's the how-to?
( Right here, bro )
There are about 12 steps, so don't forget the final ones below the images!
Disclaimer: This is my own solution and it works great for me, but if you're not sure about what's going on or what you're doing please be very careful and realize that I will assume no responsibility for any damages you may incurr by trying to follow these steps. That said, here you go!
If you don't already have a copy, download Xcode 4.4.1 from http://connect.apple.com
Extract /PATH_TO_YOUR_Xcode_4.4.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
Copy it to /PATH_TO_YOUR_Xcode_4.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
Now you'll edit 4 Xcode .xcspec files in your Xcode 4.5:
Navigate here: /PATH_TO_YOUR_Xcode_4.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Specifications
Select these files:
iPhoneXcode4Options.xcspec
iPhoneOSArchitectures.xcspec
iPhoneCompilerOptions.xcspec
iPhoneClangOptions.xcspec
Right-click and select "Open with Xcode"
Repeat for Xcode 4.4.1, and stick the two windows side-by-side (just makes this easier).
You're going to add armv6 to several entries as below:
Here again:
And here:
Here you cut & paste an entry from Xcode 4.4.1 to Xcode 4.5:
Alright you completed that tediousness, yay! Save the edited files and close them all. Next you have to create new libclang_rt*.a files to handle compiling these arches. This step is more easily done in Terminal. Enter these commands:
Make sure the backups copy and there isn't some error in paths or typing!
cd /PATH_TO_YOUR_Xcode_4.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/4.2/lib/darwin
sudo mkdir armv6_extractions
lipo -extract armv6 -output armv6_extractions/libclang_rt.ios.armv6.a libclang_rt.ios.a
lipo -extract armv6 -output armv6_extractions/libclang_rt.profile_ios.armv6.a libclang_rt.profile_ios.a
lipo -extract armv6 -output armv6_extractions/libclang_rt.cc_kext.armv6.a libclang_rt.cc_kext.a
sudo cp -R armv6_extractions /PATH_TO_YOUR_Xcode_4.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/4.2/lib/darwin
cd /PATH_TO_YOUR_Xcode_4.5.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/4.2/lib/darwin
sudo mkdir originals
sudo cp libclang_rt.ios.a originals/
sudo cp libclang_rt.cc_kext_ios5.a originals/
sudo cp libclang_rt.profile_ios.a originals/
lipo -create -output libclang_rt.ios.a armv6_extractions/libclang_rt.ios.armv6.a originals/libclang_rt.ios.a
lipo -create -output libclang_rt.cc_kext_ios5.a armv6_extractions/libclang_rt.cc_kext.armv6.a originals/libclang_rt.cc_kext_ios5.a
lipo -create -output libclang_rt.profile_ios.a armv6_extractions/libclang_rt.cc_kext.armv6.a originals/libclang_rt.profile_ios.a
Restart Xcode 4.5
^...I wrote "11" here...why's it showing as "1"?
Open your project and edit your settings accordingly. I recommend that you create a separate configuration just for building to armv6, and lipo everything together when you're done.
Add armv6 to Valid Architectures
Add armv6 to Architectures
For your specific armv6 configuration, set Base SDK to iOS 5.x (whatever is now listed in the drop-down menu)
Set your deployment target as needed ( I have built as low as iOS4.1 so far, and I believe the iOS5.x sdk you installed in the beginning can deploy as low as 4.x )
Okay, I think that's all.
If anyone sees any edits that need to be made PLEASE do so, and I welcome any feedback that anyone has to give here.
If something goes wrong, fingers crossed you can always reinstall your Xcode and try again (or not).
Best of luck.
I have had this problem before.... did you initialize your .m more than once? or import it? the only time this issue has occurred for me is when I tried to initialize or import a .m file somewhere other than where its native environment was.
A compiler should not crash. If it does then the vendor needs to fix it. Unfortunately I don't think you will be able to get any useful response via a Radar from Apple because they have moved on: there is a newer version of Clang in Xcode 4.5 and they don't support armv6 any more.
Having said that you should open a Technical Support Incident, because likely they can provide you with a workaround.
The error message indicates an internal error in the compiler while processing the function #"\01-[ClassFoo evalJS:]". You might be able to get around the error by rearranging the code in that function and/or adding volatile to local variables in that function.

Command /usr/bin/lipo failed with exit code 1 error

I have finally finished my app and I was getting ready to upload when this sudden error hit me and I have no idea what to do. I have checked other posts saying to change the code signing identity and I have done this but no luck. I tried every single option in the identity and no change. If anyone knows what is going on I would really appreciate it since I would simply just like to submit my app.
Here is what else it says in the erorr log:
/usr/bin/lipo: /Users/teddy/Library/Developer/Xcode/DerivedData/grocery_stores-dcyubhefhrcjhtcxbhldfpukdgdz/Build/Intermediates/grocery stores.build/Release-iphoneos/grocerystores.build/Objects-normal/armv7/grocery stores and /Users/teddy/Library/Developer/Xcode/DerivedData/grocery_stores-dcyubhefhrcjhtcxbhldfpukdgdz/Build/Intermediates/grocery stores.build/Release-iphoneos/grocery stores.build/Objects-normal/armv7/grocery stores have the same architectures (armv7) and can't be in the same fat output file
Command /usr/bin/lipo failed with exit code 1
I solved this issue by changing the value of the Valid Architecture found in Project > Build Settings > Architectures from the default "armv6 armv7" to "armv7". Hope this helps.
It's hard to see what exactly is happening without the command you are running. It looks to me like you are specifying the same input file twice, namely the arm7 version and lipo is telling you you can't add 2 arm7 versions of grocery stores to the universal file. Can you please enter the entire lipo command you are running? From the lipo man page:
-create
Take the input files (or file) and create one universal output file from them.
Do you possibly have the same file listed twice here?
Try changing your build target to a simulator build, clean and re-run.
In my case I used pods and oped projectFile instead of project workspace
In my case it was building a project on simulator in a release scheme, changed it to debug and it worked.

How do I symbolicate a crash report of a Mac OS X app that a user emailed to me?

I am working on an app that I have sent to a few beta testers. Within just a few minutes of launching the app a user got a crash. When the window poped up saying the app had crashed he copied all of the text in the details section and emailed it to me. I have saved the text into a plain text file and given it the .crash extension which causes it to be opened by console like a regular crash report so I think I have the extension right (but maybe not).
The version I sent out was built by Xcode with the Archive option so Xcode knows where the app and .dSYM are.
I know that with iPhone apps you can drag a crash report to the organizer and Xcode will symbolicate it for you. I can not find anywhere that will take a Mac crash report.
I have looked at atos but it talks about memory locations including the location the app was running at and I don't see that information listed in the report I have. Looking at the raw crash report it looks like a view controller was released early but I can't really tell if that was the cause or a symptom.
My real question is; is there a way to have Xcode symbolicate the report or a tool that I can just hand over the .dSYM file, app, and report and get back a symbolicated report?
I've looked all over Google but everything I find (other than the previously mentioned man pages for atos) is about symbolicating iPhone reports, not Mac OS X ones.
Or as in answer https://stackoverflow.com/a/18354072/317461
Put your release build and your .dSYM file in the same directory and open terminal
$cd directory
$lldb MyApp.app
(lldb) image lookup -v --address 0x00085f3c
We had the same problem with our app and I was symbolicating the crash reports manually line by line with atos.
I now tweaked Apple's symbolicate script such that it works with Mac apps and crash reports from PLCrashReporter.
https://github.com/lksnmnn/Symbolicate-CrashReports
How to use it:
Make sure you have all of the following files on your computer:
The crash report: report.crash
The dSYM file of your app: MyApp.dSYM
The executable / app folder of your app: MyApp.app
The improved symbolicate script: symbolicatecrash
Now go in the command line (Terminal) and do the following:
# set the developer directory
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
# Now run the script
/Path/To/symbolicatecrash /Path/To/report.crash > /Path/To/readable_report.crash
# Use -v for verbose logging.
The script will find your dSYM and your executable and symbolicates as much as it cans. You will now find your symbolicated report in the stated output file readable_report.crash
Build settings:
For proper reports and symbols, set your build settings to this:
Strip Debug Symbols During Copy: Yes
Strip Style: All Symbols
Strip Linked Product: Yes
Edit: Improved the answer such that it aligns with the Stack Overflow answer policy.
You can use GDB for Symbolication, Put your release build and your .dSYM file in the same directory
open terminal
$ cd directory
$ gdb MyApp.app
(gdb) info line *0x00085f3c