Skip to content

CodePush doesn't build - missing libCodePush.a in /Products path at build time #1236

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
octodriver opened this issue Mar 21, 2018 · 11 comments
Closed

Comments

@octodriver
Copy link

octodriver commented Mar 21, 2018

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

  1. create React Native app and then eject
  2. install codePush by npm and then react-native link
  3. follow 100% of instructions on README

Expected Behavior

App can build

Actual Behavior

App build fails
In Debug mode
In Release mode

Debug mode or Release mode, same result:
clang: error: no such file or directory: '/Users/{my-username}/Library/Developer/Xcode/DerivedData/myapp-cnmaojnjvqijpresrebtdrwvdjzc/Build/Products/Release-iphonesimulator/libCodePush.a'

Reproducible Demo

  • Download https://github.com/Microsoft/react-native-code-push/archive/master.zip and unzip. From Examples folder run node create-app.js appName react-native@0.47.1 react-native-code-push@5.0.0-beta command to generate plain CodePushified React Native app. Please see description on top of create-app.js file content if needed
  • If you can't reproduce the bug on it, provide us as much info as possible about your project

Environment

  • react-native-code-push version: 5.2.1
  • react-native version: 0.54.2
  • iOS/Android/Windows version: iOS 9.0
  • Does this reproduce on a debug build or release build? both
  • Does this reproduce on a simulator, or only on a physical device? simulator

(The more info the faster we will be able to address it!)

An extra fact to help: In Debug mode, it only fails the FIRST time. When I run build again, it always works the second time.

@octodriver
Copy link
Author

It may be a clue that libCodePush.a lives both at root and inside of /Products folder in the Workspace:

screen shot 2018-03-20 at 6 54 53 pm

@octodriver
Copy link
Author

Tail end of build output from my CI:

...
[04:04:36]: ▸ Building myapp/myapp [Release]
[04:04:36]: ▸ Check Dependencies
[04:04:36]: ▸ Running script '[CP] Check Pods Manifest.lock'
[04:04:36]: ▸ Compiling AppDelegate.m
[04:04:41]: ▸ Compiling main.m
[04:04:41]: ▸ Compiling myapp_vers.c
[04:04:41]: ▸ Compiling AppDelegate.m
[04:04:41]: ▸ Compiling main.m
[04:04:41]: ▸ Compiling myapp_vers.c
[04:04:41]: ▸ Linking myapp
[04:04:41]: ▸ ❌ clang: error: no such file or directory: '/Users/vagrant/Library/Developer/Xcode/DerivedData/myapp-cwlqtrwaukfqxsfogpftqhdeqpjx/Build/Intermediates.noindex/ArchiveIntermediates/driverapp/BuildProductsPath/Release-iphoneos/libCodePush.a'
[04:04:41]: ▸ Linking myapp
[04:04:41]: ▸ ❌ clang: error: no such file or directory: '/Users/vagrant/Library/Developer/Xcode/DerivedData/myapp-cwlqtrwaukfqxsfogpftqhdeqpjx/Build/Intermediates.noindex/ArchiveIntermediates/driverapp/BuildProductsPath/Release-iphoneos/libCodePush.a'
[04:04:41]: ▸ ** ARCHIVE FAILED **
[04:04:41]: ▸ The following build commands failed:
[04:04:41]: ▸ Ld /Users/vagrant/Library/Developer/Xcode/DerivedData/myapp-cwlqtrwaukfqxsfogpftqhdeqpjx/Build/Intermediates.noindex/ArchiveIntermediates/driverapp/IntermediateBuildFilesPath/driverapp.build/Release-iphoneos/driverapp.build/Objects-normal/armv7/driverapp normal armv7
[04:04:41]: ▸ Ld /Users/vagrant/Library/Developer/Xcode/DerivedData/myapp-cwlqtrwaukfqxsfogpftqhdeqpjx/Build/Intermediates.noindex/ArchiveIntermediates/driverapp/IntermediateBuildFilesPath/driverapp.build/Release-iphoneos/driverapp.build/Objects-normal/arm64/driverapp normal arm64
[04:04:41]: ▸ (2 failures)

@octodriver
Copy link
Author

The issue seems to be caused by the way that react-native link connected the library. It resulted in a duplicate entry for file libCodePush.a. Manually removing this has settled the issue.

@anishone
Copy link

@octodriver where did you remove the duplicate entry from? I'm stuck with the same error now. Thanks!

@danchokobo
Copy link

@octodriver we are waiting for you response

@octodriver
Copy link
Author

in the end, i still end up getting the duplicate inside the Libraries/CodePush.xcodeproj, that was not the issue.

What ended up fixing my problem was:

  1. uninstall appcenter & codepush (remove entries from Podfile and then pod install)
  2. updating to the latest cocoapods (sudo gem install cocoapods)
  3. update pod cache (pod update)
  4. reinstall appcenter and codepush (add entries to Podfile and pod install)

My RN version = 0.55.2
My Podfile looks like this:

target 'myapp' do
  platform :ios, '9.0'

  rn_path = '../node_modules/react-native'

  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]

  pod 'AppCenter/Crashes', '~> 1.5.0'
  pod 'AppCenter/Analytics', '~> 1.5.0'
  pod 'AppCenterReactNativeShared', '~> 1.4.0'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
end

Important note: you have to have target = 9.0 as shown above
also, the latest React (55) has different pod entries from before: 'CxxBridge', 'DevSupport',

@sobiso
Copy link

sobiso commented May 8, 2018

I have the same problem, removed duplicates from file {projectname}.xcodeproj

@DavidNorena
Copy link

@sobiso thanks I removed duplicates and also worked !

@luskin
Copy link

luskin commented Jul 16, 2018

Same here, had duplicate errors as well as missing libCodePush.a after clearing DerivedData.
Our solution was similar to those above:

1) Comment out codepush in podfile
cd ios && pod install && cd ..
react-native unlink code-push-react-native
react-native link code-push-react-native
(uncomment codepush line in podfile)
cd ios && pod install && cd ..
react-native run-ios

Worked like a charm for us.

@JJMoon
Copy link

JJMoon commented Sep 19, 2018

I just remove tvOS in codepush project.

@JasonFehr
Copy link

JasonFehr commented Nov 16, 2018

I fixed it this way:

-Click on the project target => Link Binary with Libraries
-Remove libCodePush.a
-Add libCodePush.a file from CodePush.xcodeproj/Products (as opposed to the one from the root directory)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants