Application Loader error, binary is invalid - ios

When i try to send my app to App Store, i'm getting this error:
The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seems to have been built whit Apple's linker.
i don't know where is the error in my app

I had the same problem.
My solution :
Remove arm64 from Valid Architectures, the last IPA that I uploaded didn't have arm64 so I compared the LC_ENCRYPTION_INFO
I used this command to get LC_ENCRYPTION_INFO
otool -arch all -Vl YOURAPP.app/YOURAPP | grep -A5 LC_ENCRYP
Result with ARM64:
    
      cmd LC_ENCRYPTION_INFO
      cmdsize 20
    cryptoff  16384
    cryptsize 2375680
    cryptid   0
Load command 13
--
          cmd LC_ENCRYPTION_INFO
      cmdsize 20
    cryptoff  16384
    cryptsize 2375680
    cryptid   0
Load command 13
--
          cmd LC_ENCRYPTION_INFO_64
      cmdsize 24
    cryptoff  16384
    cryptsize 2801664
    cryptid   0
        pad   0
Result without ARM64
cmd LC_ENCRYPTION_INFO
cmdsize 20
cryptoff 16384
cryptsize 2375680
cryptid 0
Load command 13
--
cmd LC_ENCRYPTION_INFO
cmdsize 20
cryptoff 16384
cryptsize 2375680
cryptid 0
Load command 13
I hope this will help you, if someone know why remove ARM64 help to resolve this, the response interest me too.

Related

Failed to archive iOS app with Xcode because of WireGuard Apple External Build System target

So I'm building a VPN app using this library: https://github.com/passepartoutvpn/tunnelkit
I installed Golang 1.18 on my macbook, and built app successfully from Xcode 13 to my device
But when i archive app, there is an error like this
Makefile:52: warning: overriding commands for target `/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN'
Makefile:36: warning: ignoring old commands for target `/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN'
Makefile:55: warning: overriding commands for target `/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN'
Makefile:52: warning: ignoring old commands for target `/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN'
Makefile:58: warning: overriding commands for target `/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN'
Makefile:55: warning: ignoring old commands for target `/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN'
make: Circular /Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN <- /Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN dependency dropped.
make: Circular (iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/libwg-go-arm64.a <- /Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN dependency dropped.
[ -n "/opt/homebrew/Cellar/go/1.18.3/libexec" ]
mkdir -p "/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN (iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/goroot"
rsync -a --delete --exclude=pkg/obj/go-build "/opt/homebrew/Cellar/go/1.18.3/libexec/" "/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN (iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/goroot/"
cat goruntime-*.diff | patch -p1 -f -N -r- -d "/Users/nguyendinhthach/Library/Developer/Xcode/DerivedData/SysVPN-ciypnfrkmufusggubfzgnpbgxotc/Build/Intermediates.noindex/ArchiveIntermediates/SysVPN (iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/goroot"
patching file src/runtime/sys_darwin.go
Hunk #1 succeeded at 513 (offset 73 lines).
patching file src/runtime/sys_darwin_amd64.s
Hunk #1 succeeded at 115 (offset 1 line).
patching file src/runtime/sys_darwin_arm64.s
touch "(iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/goroot/.prepared"
touch: (iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/goroot/.prepared: No such file or directory
make: *** [(iOS)/IntermediateBuildFilesPath/SysVPN.build/Release-iphoneos/wireguard-go-bridge/goroot/.prepared] Error 1
Command ExternalBuildToolExecution failed with a nonzero exit code

drake visualizer not displaying anything

OS: Ubuntu 16.04, NVIDIA Driver
I followed the drake installation procedure as described in drake website.(I have also installed nvidia driver)After installation, as per the instructions when I run:
$ xhost +local:root; nvidia-docker run -i --rm -e DISPLAY -e QT_X11_NO_MITSHM=1 -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -t drake; xhost -local:root
I am getting the following error:(simulation is not being displayed, but the build is successful)
non-network local connections being added to access control list
+ [[ 0 -eq 0 ]]
+ bazel build //tools:drake_visualizer //examples/acrobot:run_passive
Starting local Bazel server and connecting to it...
INFO: Analysed 2 targets (95 packages loaded, 18023 targets configured).
INFO: Found 2 targets...
INFO: Elapsed time: 89.206s, Critical Path: 1.58s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
+ sleep 2
+ ./bazel-bin/tools/drake_visualizer
+ bazel run //examples/acrobot:run_passive
INFO: Analysed target //examples/acrobot:run_passive (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //examples/acrobot:run_passive up-to-date:
bazel-bin/examples/acrobot/run_passive
INFO: Elapsed time: 1.031s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
process 297: D-Bus library appears to be incorrectly set up; failed to read machine uuid: UUID file '/etc/machine-id' should contain a hex string of length 32, not length 0, with no other text
See the manual page for dbus-uuidgen to correct this issue.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Could not initialize GLX
./setup/ubuntu/docker/entrypoint.sh: line 15: 297 Aborted (core dumped) ./bazel-bin/tools/drake_visualizer
non-network local connections being removed from access control list
We are in the process of updating the instructions to use nvidia-docker 2.0. Please check the drake repo again later this week for an update. In meantime, you may wish to try the open-source driver instructions on the same page.

Unable to symbolicate crash reports

I submitted a new version of my app to AppStore and it got rejected due to some crashes that I never experienced while testing the app.
Unfortunately I can't seem to be able to reproduce the issue so all I have to analyze the 2 unsymbolicated crash logs (.txt files) they sent me.
However, I am having problems symbolicating them.
Crash Log 1
Crash Log 2
I tried following the steps provided HERE and HERE, as well as other suggestions but no luck.
Here are the things I tried so far:
$ atos -arch arm64 -o Qlear.app.dSYM/Contents/Resources/DWARF/Qlear -l 0x1839fa000 0x0000000183a1c2e8
Unfortunately the command returns only 0x00000001000222e8 (in Qlear)
$ atos -arch arm64 -o 'Qlear.app'/'Qlear' 0x1839fa000
$ atos -arch arm64 -o 'Qlear.app.dSYM/Contents/Resources/DWARF/Qlear' 0x1839fa000
Both commands return 0x1839fa000
$ dwarfdump --uuid Qlear.app.dSYM
$ dwarfdump --uuid Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
Both commands return
UUID: 4FFCBD15-01BA-366A-8C28-E4E613401616 (armv7) Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
UUID: 97BD48FC-11E3-37C9-A081-700DCE0CDB23 (arm64) Qlear.app.dSYM/Contents/Resources/DWARF/Qlear
If I try $ dwarfdump --lookup 0x1839fa000 -arch arm64 Qlear.app.dSYM I get:
----------------------------------------------------------------------
File: Qlear.app.dSYM/Contents/Resources/DWARF/Qlear (arm64)
----------------------------------------------------------------------
Looking up address: 0x00000001839fa000 in .debug_info... not found.
Looking up address: 0x00000001839fa000 in .debug_frame... not found.
So in the end I thought the .dSYM files(I tried the one on my Mac as well as the one from iTunes Connect) are corrupted so I tried dwarfdump --all Qlear.app.dSYM but this seems to be working as it returns a lot of content.
Any ideas what I'm doing wrong here? Am I mixing up the commands, am I using the wrong hex?
Finally, after hours of searching I finally found a solution:
Change the crash logs extension from .txt to .crash.. This is very important since .txt files are not recognized. I was also unable to find any info on this while reading Apple documentation.
Connect an iOS device and start Xcode.
In Xcode, go to Windows > Devices and Simulators (Shift + CMD + 1)
Select the Devices tab and then View Devices Logs.
In the left pane, select This Device and then drag-n-drop the .crash files inside.
Wait for the files to load and get symbolicated. The logs can also be symbolicated manually after drag-n-drop: Right Click on the log > Re-Symbolicate Log.

How to resolve the error like ‘atos cannot load symbols for the file APP for architecture armv7’? [duplicate]

I'm looking at a crash report provided by Apple
Hardware Model: iPhone4,1
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-11-18 16:03:44.951 -0600
OS Version: iOS 6.0.1 (10A523)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x51fe5264
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x352925b0 objc_msgSend + 16
1 MYAPP 0x0006573a -[MyViewController(Images) didReceiveImage:context:etag:expires:] + 42
2 MYAPP 0x0004fb26 -[MyImageTask didReceiveImage:] + 98
3 Foundation 0x361ac8e8 __NSThreadPerformPerform
4 CoreFoundation 0x3b37d680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
5 CoreFoundation 0x3b37cee4 __CFRunLoopDoSources0
6 CoreFoundation 0x3b37bcb2 __CFRunLoopRun
7 CoreFoundation 0x3b2eeeb8 CFRunLoopRunSpecific
8 CoreFoundation 0x3b2eed44 CFRunLoopRunInMode
9 GraphicsServices 0x396bc2e6 GSEventRunModal
10 UIKit 0x3452e2f4 UIApplicationMain
11 MYAPP 0x0004934a main + 70
12 MYAPP 0x000492fc start + 36
The funny thing is when I use atos to lookup the line of code that corresponds to address locations 0x0006573a and 0x0004fb26 I get completely different match. The atos output is not even from the same class that's mentioned in the crash log (MyViewController, MyImageTask). Instead atos points me to totally benign lines of code in a completely unrelated class. I verified again that I'm working with the exact dSYM and IPA that I submitted to Apple.
My atos command
/Applications/Xcode.app/Contents/Developer/usr/bin/atos -arch armv7 -o MYAPP.app/MYAPP 0x0004fb26
Same result with /usr/bin/atos and for armv7s.
Has anyone else experienced this issue? Can you please advise? Thanks.
A simpler alternative: you can use the atos -l flag to make it do the maths for you.
Say you've got the following line in your crash log that you want to symbolicate:
5 MyApp 0x0044e89a 0x29000 + 4348058
The first hex number is the stack address, and the second hex number is the load address. You can ignore the last number. You don't need to worry about slide addresses either.
To symbolicate, do the following:
atos -o MyApp.app/MyApp -arch armv7 -l 0x29000 0x0044e89a
If you can't find your MyApp.app/MyApp file, rename your '.ipa' file to a '.zip', unzip it, and it'll be in the Payload folder.
And if you're not sure which architecture to use (for example, armv7 or armv7s), scroll to the 'Binary Images' part of the crash file and you can find it in there.
Cheers
You have to calculate the address to use with atos, you can't just use the one in the stacktrace.
symbol address = slide + stack address - load address
The slide value is the value of vmaddr in LC_SEGMENT cmd (Mostly this is 0x1000). Run the following to get it:
otool -arch ARCHITECTURE -l "APP_BUNDLE/APP_EXECUTABLE" | grep -B 3 -A 8 -m 2 "__TEXT"
Replace ARCHITECTURE with the actual architecture the crash report shows, e.g. armv7.
Replace APP_BUNDLE/APP_EXECUTABLE with the path to the actual executable.
The stack address is the hex value from the crash report.
The load address can be is the first address showing in the Binary Images section at the very front of the line which contains your executable. (Usually the first entry).
Since in the past value of the slide was equal to value of the load address this always worked. But since Apple introduced Address space layout randomization beginning with iOS 4.3 (in different variations), the apps loading address is randomized for security reasons.
Simply use dwarfdump:
dwarfdump --arch armv7 myApp.dSYM --lookup 0xaabbccdd | grep 'Line table'
No need to do any calculations at all.
(From Get symbol by address (symbolicating binary, iOS build)).
For whom that certain times doesn't have the value for Load Address like this:
Jan 14 11:02:39 Dennins-iPhone AppName[584] <Critical>: Stack Trace: (
0 CoreFoundation 0x2c3084b7 <redacted> + 150
1 libobjc.A.dylib 0x39abec8b objc_exception_throw + 38
2 CoreFoundation 0x2c21cc35 CFRunLoopRemoveTimer + 0
3 AppName 0x0005a7db AppName + 272347
I've created a simple bash to help me debug:
#! /bin/bash
read -p "[Path] [App Name] [Stack Address] [DecimalSum] " path appName stackAddress decimalSum
loadAddress=`echo "obase=16;ibase=10;$((stackAddress-decimalSum))" | bc`
atos -o $path/Payload/$appName.app/$appName -l $loadAddress $stackAddress -arch armv7
It just reads the path for the app, the app name, the stack address, and the value after "+" signal (the decimal value) and then find the value for load address to run atos command.

Xcode 7 code coverage reporting not working

I'm having problems to get code coverage reporting working in Xcode 7 for a certain iOS project.
I'm following the instructions given here:
http://mgrebenets.github.io/mobile%20ci/2015/09/21/code-coverage-for-ios-xcode-7/
Of the three projects I tried, two are working fine, but one project is giving me a headache. When using llvm-cov utility to generate a report from the gathered profile data like this:
xcrun llvm-cov report -instr-profile Coverage.profdata MyAppBinary
I receive the error message:
error: Failed to load coverage: The file was not recognized as a valid object file
I checked that the "Gather coverage data" is enabled for the Test scheme. I also checked that the -fprofile-instr-generate and -fcoverage-mapping compiler options are passed to clang.
File sizes and types also look valid to me:
ilMac:llvm-cov-test ilja$ ls -la
total 61976
drwxr-xr-x 4 ilja staff 136 14 Okt 21:53 .
drwxr-xr-x+ 75 ilja staff 2550 14 Okt 16:31 ..
-rw-r--r-- 1 ilja staff 1797416 14 Okt 21:53 Coverage.profdata
-rwxr-xr-x 1 ilja staff 29932040 14 Okt 16:32 MyAppBinary
ilMac:llvm-cov-test ilja$ file Coverage.profdata
Coverage.profdata: data
ilMac:llvm-cov-test ilja$ file MyAppBinary
MyAppBinary: Mach-O universal binary with 2 architectures
MyAppBinary (for architecture i386): Mach-O executable i386
MyAppBinary (for architecture x86_64): Mach-O 64-bit executable x86_64
I also noted that the "Coverage" tab in Xcode for the Test run is saying "No coverage data" instead of the indicator bars.
Any idea what I'm doing wrong?
Posting my solution in case someone will need it.
Following this article code coverage xcode 7
I did following steps:
Installed cobertura plugin
Installed slather plugin
Enabled code coverage for project (in schema preferences)
In jenkins added execute shell command
/usr/bin/xcodebuild test -workspace MyApp.xcworkspace -scheme MyAppTests -configuration DebugMyApp -destination "platform=iOS Simulator,OS=9.3,name=iPhone 6" -enableCodeCoverage YES
Then one more build stem for slather
slather coverage \
--input-format profdata \
--cobertura-xml \
--ignore "../**/*/Xcode*" \
--output-directory slather-report \
--scheme MyAppTests \
--workspace MyApp.xcworkspace \
MyApp.xcodeproj
And last but no least add post build step "publich cobertura report"
Cobertura xml report pattern - slather-report/cobertura.xml
Enjoy :)
The project had the "Build Active Architecture Only" setting in the Xcode build settings set to "YES". After switching it to "NO", I can now run the llvm-cov command. Numbers don't macht the numbers displayed in Xcode, though.
I was able to solve the issue by running with only x86_64 architecture.
Use ARCHS="x86_64" VALID_ARCHS="x86_64" in your xcodebuild command

Resources