firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.55k stars 1.45k forks source link

[Carthage] Archive IPA processing failed #6017

Closed KC-218 closed 4 years ago

KC-218 commented 4 years ago

Step 0: Are you in the right place?

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

I got IPA processing failed when I archive the app.

And check the log like this:

Scanning IPA...
2020-07-10 03:17:26 +0000  Assertion failed: Expected 1 archs in otool output:
Archive : /var/folders/ts/r7b0ghfd3z93gnb_1rdny8f1b70xc1/T/IDEDistributionOptionThinning.~~~k4I40G/Payload/TestFirebaseCrashlytics.app/Frameworks/FirebaseCore.framework/FirebaseCore
/var/folders/ts/r7b0ghfd3z93gnb_1rdny8f1b70xc1/T/IDEDistributionOptionThinning.~~~k4I40G/Payload/TestFirebaseCrashlytics.app/Frameworks/FirebaseCore.framework/FirebaseCore(FIRAnalyticsConfiguration.o):
Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
MH_MAGIC_64   ARM64        ALL  0x00      OBJECT     5       1568 SUBSECTIONS_VIA_SYMBOLS
Load command 0
      cmd LC_SEGMENT_64
  cmdsize 1432
  segname 
   vmaddr 0x0000000000000000
   vmsize 0x00000000000047f0
  fileoff 1600
 filesize 18400
  maxprot rwx
 initprot rwx
   nsects 17
    flags (none)
Section
  sectname __text
   segname __TEXT
      addr 0x0000000000000000
      size 0x00000000000002a4
    offset 1600
     align 2^2 (4)
    reloff 20000
    nreloc 86
      type S_REGULAR
attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
 reserved1 0
 reserved2 0
Section
  sectname __cstring
   segname __TEXT
      addr 0x00000000000002a4
      size 0x0000000000000064
    offset 2276
     align 2^0 (1)
    reloff 0
    nreloc 0
      type S_CSTRING_LITERALS
attributes (none)
 reserved1 0
 reserved2 0
Section

If you have a downloadable sample project that reproduces the bug you're reporting, you will likely receive a faster response on your issue.

Here is sample proj : https://github.com/Bruce9487/TestFirebaseCrashlytics

Relevant Code:

I try to add shell script like this

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done
google-oss-bot commented 4 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

paulb777 commented 4 years ago

@Bruce9487 Thanks for the report and the sample.

However, I'm not able to reproduce. I successfully archive the project with both Xcode 12 and Xcode 11.0:

Screen Shot 2020-07-10 at 7 48 32 AM

KC-218 commented 4 years ago

@paulb777 Thanks. So, do you success to export the ipa? OMG, That's wired.
Because I click the button "Distribute App", and got this error. I put my error message pic for you.

截圖 2020-07-12 22 44 55
morganchen12 commented 4 years ago

If you click the "Show logs" button, is there a more complete error?

KC-218 commented 4 years ago

@morganchen12 I see the file IDEDistribution.standard.log

And here is the log: https://gist.github.com/Bruce9487/cf5e3804d05ca9426f203312ae602d40

morganchen12 commented 4 years ago

Looks like this is the relevant error from the log:

2020-07-14 06:34:17 +0000  Assertion failed: Expected 1 archs in otool output:
Archive : /var/folders/ts/r7b0ghfd3z93gnb_1rdny8f1b70xc1/T/IDEDistributionOptionThinning.~~~VE3DDn/Payload/TestFirebaseCrashlytics.app/Frameworks/FirebaseCore.framework/FirebaseCore
/var/folders/ts/r7b0ghfd3z93gnb_1rdny8f1b70xc1/T/IDEDistributionOptionThinning.~~~VE3DDn/Payload/TestFirebaseCrashlytics.app/Frameworks/FirebaseCore.framework/FirebaseCore(FIRAnalyticsConfiguration.o):

Are you copying the Carthage frameworks into your app bundle? If so, you should avoid copying the frameworks into your app bundle. They will be linked statically into your app binary and do not need to be present in the app bundle.

KC-218 commented 4 years ago

@morganchen12 So, do I need to change the FirebaseCore.framework "Emded & Sign" to "Do Not Embed" ?

截圖 2020-07-17 15 15 18

morganchen12 commented 4 years ago

Yes, the Firebase frameworks should all be "Do Not Embed". Sub-dependencies like nanopb and GoogleUtilities should still be "Embed & Sign".

paulb777 commented 4 years ago

Going to close now based on the answer from @morganchen12. We can reopen if there's still an issue.

KC-218 commented 4 years ago

@morganchen12 @paulb777 Thanks. It's work. I figure out my question.