microsoft / appcenter-sdk-react-native

Development repository for the App Center SDK for React Native
Other
412 stars 135 forks source link

Archive failed with return code: 65 #837

Closed ibrahimyolbir closed 4 years ago

ibrahimyolbir commented 4 years ago

Description

ARCHIVE FAILED

The error appears in these 2 files main.jsbundle and assets. Works fine on emulator and physical device

The following build commands failed:

CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/[APPNAME].app/assets
(2 failures)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
### **Repro Steps**

When i try enable to "Legacy Build System" Please list the steps used to reproduce your issue.I no longer receive this error. But I get an error like

**ld: library not found for -lBVLinearGradient**

ld: warning: directory not found for option '-L-L/Users/runner/Library/Developer/Xcode/DerivedData/DGFonder-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/BuildProductsPath/Release-iphoneos/BVLinearGradient'

clang: error: linker command failed with exit code 1 (use -v to see invocation)`

  1. Enable Legacy build system
  2. check the xcode versiyon local and appcenter

Details

  1. Which version of the App Center SDK are you using?
    • e.g. 1.5.0
  2. Which OS version did you experience the issue on?
    • Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • e.g. Google Pixel 2 emulator, iPhone X physical device
  4. What third party libraries are you using?
    • example
  5. Run the following command and paste the output below: react-native info

System: OS: macOS 10.15.3 CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz Memory: 59.17 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.2.0 - /usr/local/bin/node Yarn: Not Found npm: 6.14.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: Not Found IDEs: Android Studio: 3.6 AI-192.7142.36.36.6241897 Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild Languages: Java: 1.8.0_242 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: ^16.13.1 => 16.13.1 react-native: ^0.62.2 => 0.62.2 npmGlobalPackages: react-native: Not Found

  1. If you're developing for React Native iOS, run the following command and paste the output below: pod --version

pod --version. 1.9.1

  1. Please enable verbose logging for your app using [MSAppCenter setLogLevel: MSLogLevelVerbose]; before your call to [AppCenterReactNative register]; (or any other SDK registration). For Android, use AppCenter.setLogLevel(android.util.Log.VERBOSE); before your SoLoader.init call (you will need to import com.microsoft.appcenter.AppCenter;). Include the logs here:
annakocheshkova commented 4 years ago

Hi there! Let me clarify a little bit. The archive issue happens if you enable Legacy System or the opposite? Is it related to App Center? Looks like the error is unrelated - is it only reproduced with App Center sdk?

If so, could you include the full build log? Thanks.

ibrahimyolbir commented 4 years ago

Hi @annakocheshkova This issue happening only on Appcenter;

The following build commands failed:

CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/[APPNAME].app/assets
(2 failures)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
### **Repro Steps**

And this one When i enable Build System to "Legacy Build System" happening both Appcenter and Physical computer(Xcode or React Native bundler)

**ld: library not found for -lBVLinearGradient**

ld: warning: directory not found for option '-L-L/Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/BuildProductsPath/Release-iphoneos/BVLinearGradient'
AnastasiaKubova commented 4 years ago

Hi, @ibrahimyolbir ! Could you please clarify some details:

ibrahimyolbir commented 4 years ago

Hi @AnastasiaKubova Thank you for helping

"appcenter": "3.0.3",
"appcenter-analytics": "3.0.3",
"appcenter-crashes": "3.0.3",

No its a real project.

Yes i can but not here. i can send it as an mail

AnastasiaKubova commented 4 years ago

Thanks @ibrahimyolbir for share the details. I spent a time for investigate your issue and tried to reproduce it, but it works for me as expected. Could you please clarify it worked in your project with the previous versions? It can be related to the cache issue. Could you please try to:

And let me know about the result?

ibrahimyolbir commented 4 years ago

@AnastasiaKubova I tried these steps


rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf /Pods && rm Podfile.lock && pod install
Build from XCode

But still same. This is my email adress: ibrahimyolbirr@gmail.com if you send a mail to me. I can send you the build logs

The following build commands failed:
    CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/DGFonder-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
    CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/DGFonder-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/DGFonder.app/assets
(2 failures)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
AnastasiaKubova commented 4 years ago

@ibrahimyolbir thanks for your reply. If you have any private data in logs you can open a ticket in Intercom and share them there (in App Center portal is message button in the right bottom corner).

AnastasiaKubova commented 4 years ago

@ibrahimyolbir, thanks for sharing logs. I take a look at it, but I don't see any issues related to App Center. I can suppose the issue is caused in the Build Phases scripts missing some settings. Could you please try to modify the Build Phases -> Bundle React Native code and images script in Xcode to point it to the correct folder?

export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh

Please let me know about the result.

ibrahimyolbir commented 4 years ago

@AnastasiaKubova Looks right.

Screenshot 2020-06-09 at 08 39 02

As I wrote above, I only encounter this error when building the app in App Center. When I builds it locally, I can build it successfully and I was using an application similar to Appcenter, I did not encounter any problems like this before.

The following build commands failed:

CpResource /Users/runner/runners/2.169.1/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/DGFonder.app/main.jsbundle
CpResource /Users/runner/runners/2.169.1/work/1/s/ios/assets /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-adrecrevrfgahhfyzlogcbrpednj/Build/Intermediates.noindex/ArchiveIntermediates/DGFonder/InstallationBuildProductsLocation/Applications/[APPNAME].app/assets
(2 failures)

##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (signed)
##[section]Starting: Xcode build (signed)
### **Repro Steps**
AnastasiaKubova commented 4 years ago

@ibrahimyolbir I try to reproduce it, but unfortunately I can't to get this error. Could you please try to reproduce this issue on an empty project?

ibrahimyolbir commented 4 years ago

@AnastasiaKubova I created an empty project and the installation was completed smoothly. All settings look the same. It will take time to find the problem. If you make a review on what might trigger this error, maybe it might help me. thank you for your help

ibrahimyolbir commented 4 years ago

@AnastasiaKubova its look like, i don t have these 2 files in the empty project (main.jsbundle and asset)

AnastasiaKubova commented 4 years ago

@ibrahimyolbir you can try to create these files via command line: react-native bundle --entry-file index.js --platform ios --bundle-output ios/main.jsbundle

Then open the Xcode > {Select Project} and add main.jsbundle to Copy Bundle Resource in Build Phases.

ibrahimyolbir commented 4 years ago

@AnastasiaKubova

Finally! I found the problem. Actually, Xcode creates these 2 files while building. I created them manually as you suggested above before, and this has not been a problem until I created the app in the Appcenter.

AnastasiaKubova commented 4 years ago

@ibrahimyolbir thank you for explaining! Can you clarify does this solve your issue?

ibrahimyolbir commented 4 years ago

Yes Thank you @AnastasiaKubova

AnastasiaKubova commented 4 years ago

I am glad that the issue is resolved. I'm closing this issue, but feel free to reopen this issue if you have additional questions.

maxckelly commented 4 years ago

Hi @AnastasiaKubova - I'm experiencing this issue at the moment. I noticed that it is due to the fact I'm passing ios/main.jsbundle in my Copy Bundle Resource similar to @ibrahimyolbir. When I remove the file from Xcode> Build Phases > Copy Bundle Resource main.jsbundle the app center builds passes with no issues.

However this then causes my Test Flight app to crash on launch. I was able to come to this solution because I ran my scheme in release on my own device and it produced an error 'No jsbundle', when the main.jsbundle file was removed from Copy Bundle Resource however when added again it worked as expected...

Would you be able to help me?

Thanks a lot!

annakocheshkova commented 4 years ago

Hi there @maxckelly! So you created and passed these files manually similar to @ibrahimyolbir before, right? What exactly is the error you are getting after? Is it "No JSBundle"?

maxckelly commented 4 years ago

Hi @annakocheshkova - Thanks for the quick response. Here is everything I've done.

React - "react-native": "0.62.2"

  1. I'm using App center to deploy my iOS app (this is where the issue lies),
  2. I have three schemes for iOS Dev, Beta, Prod (each building fine in xCode),
  3. I'm using Code push as well,
  4. App has been on Test flight working fine for a week

I encountered a build issue "no URL bundle present" when running locally both in debug and in release. However I found a solution for that here: https://www.youtube.com/watch?v=eCs2GsWNkoo which works great. I added the main.jsbundle into build phases >> Copy bundle resources as well which fixed the issue occurring during release. Archiving tests now all works.

However My issue is when I build the app on App Center with the main.jsbundle in Copy Bundle resources the build fails and I believe this is because App Center creates that file itself? The error I face is:

The following build commands failed:
    CpResource /Users/runner/work/1/s/ios/main.jsbundle /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-hjrawomvzxvvvdeuplegfjyupvhr/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/InstallationBuildProductsLocation/Applications/A\ Life\ Lived.app/main.jsbundle
(1 failure)

Knowing this I then went back into xCode and removed main.jsbundle from Copy bundle resources, re ran the build in App Center and it builds successfully...However when it appears on test flight it crashes on startup.

I believe the cause of the crash on Test Flight is due to no main.jsbundle or the one that is produced through App Center if they produce one - The reason I say this is 1. I can't run the app in release locally 2. I did a manual deploy to test flight (archived in xCode, download ipa file, uploaded to App Center, deployed).

I also attempted to build with legacy build system however this then resulted in the below error with App Center:

The following build commands failed:
    Ld /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-hjrawomvzxvvvdeuplegfjyupvhr/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/IntermediateBuildFilesPath/[APPNAME].build/Release-iphoneos/[APPNAME].build/Objects-normal/armv7/A\ Life\ Lived normal armv7
    Ld /Users/runner/Library/Developer/Xcode/DerivedData/[APPNAME]-hjrawomvzxvvvdeuplegfjyupvhr/Build/Intermediates.noindex/ArchiveIntermediates/[APPNAME]/IntermediateBuildFilesPath/[APPNAME].build/Release-iphoneos/[APPNAME].build/Objects-normal/arm64/A\ Life\ Lived normal arm64
(2 failures)

Any ideas on what I could do?

Thanks again for all your help!

annakocheshkova commented 4 years ago

I don't think our SDK does anything specific related to jsbundle, but this feels to me like a question more related to the App Center build system. Could you go over to App Center and open a support ticket there? Our support team should connect you with Build engineering team.

maxckelly commented 4 years ago

Sure, opened up a ticket. Hopefully can get to the bottom of it.

Thank you for your help @annakocheshkova greatly appreciated.

ben-wright commented 3 years ago

@maxckelly did you have any luck finding the cause of this? I'm experiencing the same issue

maxckelly commented 3 years ago

@ben-wright

Unfortunately my solution was to revert back to a stable branch and drop my schemes down to one release and debug.

I'm interested though in finding the cause of this as I spent 4 days on it and still couldn't get to the bottom of it. So please let me know if I can help.

I had three schemes

Part of my solution as well was to cut this down to one scheme

The reason I say this is that I had a feeling I may have duplicated the wrong scheme (duplicated a debug scheme but running it at release etc...) this then would've caused issues with code push.

Do you have a similar setup?

It's a very frustrating build issue so if you need anymore help or want to share files etc let me know.

origamih commented 3 years ago

@maxckelly I had the exact same problem as yours and managed to fix it. First was no URL bundle present, then I added resources and bundle file to ios, it can build but other problems arose. Then I upgraded to RN 0.63.3 then this AppCenter build problem. I deleted main.jsbundle in ios/ and it works. So to recap:

  1. Upgrade RN to 0.63.3 (it's an easy one with no issue at all from 0.62)
  2. Upgrade Xcode to 12.
  3. Delete main.jsbundle from ios/ folder

Xcode build fine locally, run fine on device. AppCenter build without issue.

kpietrzak-web commented 3 years ago

@origamih what do you mean by "I added resources and bundle file to ios" - you added it in xcode some way or how?

I fullfill other conditions but issue still occurs.

origamih commented 3 years ago

@kpietrzak-web run react-native bundle --dev false --entry-file index.js --bundle-output ios/main.jsbundle --platform ios. Xcode > {Select Project} and add main.jsbundle to Copy Bundle Resource in Build Phases. (then add assets)

maheshContco commented 3 years ago

@AnastasiaKubova

Finally! I found the problem. Actually, Xcode creates these 2 files while building. I created them manually as you suggested above before, and this has not been a problem until I created the app in the Appcenter.

  • I deleted ios/main.jsbundle and ios/assets files
  • Removed Xcode> Build Phases > Copy Bundle Resource main.jsbundle and asssets

can you explain more?

xgenem commented 3 years ago

Seems like a re-occurring issue. I am experiencing it only in AppCenter. Building locally seems to work real fine.

xgenem commented 3 years ago

Mine happened after adding 🗡️ OneSignal

AnastasiaKubova commented 3 years ago

Hi @xgenem ! Thanks for getting in touch with us! Could you please clarify:

chenop commented 3 years ago

I've added the main.jsbundle to git to be part of the version control and the appcenter build has passed 💪🏻.

However I think this is not what was intended. the main.jsbundle should be generated as part of the appcenter built and for some reason it does not do it (bug?). Should I "tell" appCenter explicitly to generate main.jsbundle somehow or is it a bug?

DmitriyKirakosyan commented 3 years ago

Hi @chenop

Glad you found a solution.

I think your concern is valid and I wouldn't recommend storing main.jsbundle in repo as well, as I believe it should be generated at a build time. Please check this long-running thread regarding this issue: iOS main.jsbundle will not create automatically or update without manual react-native bundle. And especially this answer, which may work for you. This stackoverflow answer can be helpful tool.

sanjib-tatva commented 2 years ago

Hello Guy's I got below issue in app-center and tried all this things but didn't work , any solution on this??

ARCHIVE FAILED

The following build commands failed: CompileC /Users/runner/Library/Developer/Xcode/DerivedData/projectName-amffifqiaqhjdsaqobgajoyybmsu/Build/Intermediates.noindex/ArchiveIntermediates/proJectName/IntermediateBuildFilesPath/projectName.build/Release-iphoneos/projectNamet.build/Objects-normal/arm64/AppDelegate.o /Users/runner/work/1/s/mobile-app/ios/projectName/AppDelegate.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

[error]Error: /usr/bin/xcodebuild failed with return code: 65

DmitriyKirakosyan commented 2 years ago

Hi @sanjib-tatva thank you for reaching out to us! Could you please share more details about the tools versions that you use or create a separate feature and fill out the issue template?

This issue doesn't look like it is related to the AppCenter SDK. Could you try to remove the AppCenter SDK from your project and confirm that it archives after that? Can you reproduce the issue on an empty project?

sanjib-tatva commented 2 years ago

Hello @DmitriyKirakosyan Thanks for the response. I faced this problem only on app-center in manually from x-code working fine.

I used below version of app-center

"appcenter": "4.3.0", "appcenter-analytics": "4.3.0", "appcenter-crashes": "4.3.0",

AnastasiaKubova commented 2 years ago

Hi, @sanjib-tatva ! Could you please clarify does the issue happen locally or on the App Center Portal only?

sanjib-tatva commented 2 years ago

Hello, @AnastasiaKubova!

In xcode it's working and successfully generating the archive build but in appcenter only I got this issue

ARCHIVE FAILED

The following build commands failed: CompileC /Users/runner/Library/Developer/Xcode/DerivedData/projectName-amffifqiaqhjdsaqobgajoyybmsu/Build/Intermediates.noindex/ArchiveIntermediates/proJectName/IntermediateBuildFilesPath/projectName.build/Release-iphoneos/projectNamet.build/Objects-normal/arm64/AppDelegate.o /Users/runner/work/1/s/mobile-app/ios/projectName/AppDelegate.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

[error]Error: /usr/bin/xcodebuild failed with return code: 65

AnastasiaKubova commented 2 years ago

@sanjib-tatva , thanks for clarifying, if this issue happens only on the App Center portal then this is not an SDK issue. Please open a support ticket on the App Center portal.

sanjib-tatva commented 2 years ago

@AnastasiaKubova , Thanks for quick response. Sure I will open a ticket on App Center.

balukadiyala commented 2 years ago

Hi, we are having the exact issue in MS App center for iOS build.

The build failes intermittently only with below error: /usr/bin/xcodebuild failed with return code: 65

Leading up to is below error fatal error: 'OneSignal/OneSignal.h' file not found 2022-03-10T23:31:51.7063850Z #import <OneSignal/OneSignal.h> 2022-03-10T23:31:51.7064270Z ^~~~~~~ 2022-03-10T23:31:51.7064640Z 1 error generated. 2022-03-10T23:31:51.7064800Z 2022-03-10T23:31:51.7065200Z ARCHIVE FAILED

XCode 13.2.1 ios Native App.

Can you share issue resolution for the support ticket mentioned above?

DmitriyKirakosyan commented 2 years ago

Hi @balukadiyala , please contact support on this question.

GeorgeFean commented 2 years ago

For me the reason was just modified provision profile, because I've enabled some other features through appstoreconnect. I just needed to download the new one and upload it to appcenter.

yvbeek commented 1 year ago

For people who are running into this issue with Xcode 14 and React-Native 0.70.1.

I've modified the post_install in my Podfile to this:

post_install do |installer|
  # Run the React-Native post install
  react_native_post_install(installer, :mac_catalyst_enabled => false)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)

  # Get the development team id from the main project
  dev_team_id = ""
  project = installer.aggregate_targets[0].user_project
  project.targets.each do |target|
    target.build_configurations.each do |config|
      if dev_team_id.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?
        dev_team_id = config.build_settings['DEVELOPMENT_TEAM']
      end
    end
  end

  # Reconfigure the pods, update deployment target and signing settings
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.respond_to?(:product_type) and target.product_type == 'com.apple.product-type.bundle'
        config.build_settings['DEVELOPMENT_TEAM'] = dev_team_id
        config.build_settings['CODE_SIGN_IDENTITY'] = 'Apple Distribution';
        config.build_settings['CODE_SIGN_STYLE'] = 'Manual';
      end if

      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

It will automatically fix the signing settings of some of the Pod projects. It will also reset the deployment targets of those projects (fixes some warnings, but isn't necessary to fix the archive failed error).

shaozhihui commented 11 months ago

Hello, I encountered a problem while building the appcenter, but it can run normally locally. What is the reason for this? Reason for error:

The following build commands failed: CompileC /Users/runner/Library/Developer/Xcode/DerivedData/cfoamobile_app-gbdbrrppfklqfzbbacgrvqvyjqdp/Build/Intermediates.noindex/ArchiveIntermediates/cfoamobile_app/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/RCT-Folly.build/Objects-normal/arm64/json.o /Users/runner/work/1/s/ios/Pods/RCT-Folly/folly/json.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods') (1 failure)

[error]Error: /usr/bin/xcodebuild failed with return code: 65

[warning]Deleting provisioning profile: /Users/runner/Library/MobileDevice/Provisioning Profiles/8ca8e920-aefb-4bd9-a879-175eb82c829a.mobileprovision

I used some environment variables on the appcenter to build the project, and I'm not sure if this is related to it

DmitriyKirakosyan commented 11 months ago

Hi @shaozhihui , It seems you're attempting to build your project on App Center. For assistance with that, please contact our support team directly; they'll be able to assist you promptly. This repository addresses SDK-related issues only.