Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Reliable build on ^0.39.2 fails when upgrading to ^0.40.0 #11721

Closed
kirkstrobeck opened this issue Jan 4, 2017 · 37 comments
Closed

Reliable build on ^0.39.2 fails when upgrading to ^0.40.0 #11721

kirkstrobeck opened this issue Jan 4, 2017 · 37 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@kirkstrobeck
Copy link

** BUILD FAILED **


The following build commands failed:
	CompileC /XXX-FULLPATH-XXX/ios/build/Build/Intermediates/RCTSettings.build/Debug-iphonesimulator/RCTSettings.build/Objects-normal/x86_64/RCTSettingsManager.o RCTSettingsManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
@joncursi
Copy link
Contributor

joncursi commented Jan 4, 2017

I am also running into trouble going from 0.39.2 -> 0.40.0, with several "file not found" issues.

  • React/RCTDefines.h
  • React/RCTEventEmitter.h

screen shot 2017-01-04 at 1 10 46 pm

@rdixonbhw
Copy link

IIRC, there are a couple pretty major breaking changes in 0.40. It's probably best to wait for change notes.

@nic
Copy link

nic commented Jan 5, 2017

Take a look on the release note:

https://github.com/facebook/react-native/releases/tag/v0.40.0

I recommend to use this tool: https://github.com/ncuillery/rn-diff

@SandroMachado
Copy link
Contributor

SandroMachado commented Jan 5, 2017

I solved it doing this:

- In Xcode, go to the project scheme (Product -> Scheme -> Manage Scheme -> double click your project).

- Click on the 'Build' option at the left pane.

- Uncheck 'Parallelize Build' under Build Options.

- Then in Targets section, click '+' button then search for 'React'. Select it and click 'Add'.
'React' should now appear under Targets section. Click and drag it to the top so that it will be the first item in the list (before your project).

- Clean the project and build.

BTW, I am using https://github.com/beefe/react-native-picker and it also works without updating the import format in the library. Strange, but it is working...

@luhui
Copy link

luhui commented Jan 5, 2017

I have encounter same issue after upgrade from 0.39.2 to 0.40, but @SandroMachado 's workaround not work for me.
use react-native-git-upgrade to upgrade, but no file change
Should I update the search path? And how?

@pvinis
Copy link
Contributor

pvinis commented Jan 6, 2017

how is disabling parallelization a good thing? isnt the packager slow enough, now we slow down xcode too? why? i really dont think this should be turned off.

this change happened here e1577df

AmatsuZero pushed a commit to AmatsuZero/NeteaseNews that referenced this issue Jan 7, 2017
·react-native upgrade
·react-native-git-upgrade
还可以参考这篇讨论:facebook/react-native#11721
===================================我是分割线=================================
Ijkplayer扔到项目中各种头文件找不到,集成待解决。
下次更新不知道什么时候了……
@binchik
Copy link

binchik commented Jan 8, 2017

Hi!

I unchecked the parallelize build option, added React as a target to project's scheme, placed above other targets and it still says "<React/RCTLog.h> file not found". Although every third party dependency is converted to the new imports.

By the way, I'm using CocoaPods to include react-native in my project. May it cause the problem? The contents of my Podfile:

source 'https://github.com/CocoaPods/Specs.git'

target 'Tantalum' do
  pod 'React', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTText',
    'RCTWebSocket',
  ], :path => '../node_modules/react-native'
  pod 'Crashlytics'
  pod 'Fabric'
  pod 'Digits'
end

It used to work before I upgraded to 0.40.

@kirkstrobeck
Copy link
Author

kirkstrobeck commented Jan 8, 2017

I went thru ncuillery/rn-diff@rn-0.39.2...rn-0.40.0 and moved over what seemed to be meaningful, but not what I assume to be compile results.

My remaining issues may be specific to my project, but also likely affect others. Does anyone know how to solve these?

screen shot 2017-01-08 at 4 03 26 am
screen shot 2017-01-08 at 4 03 52 am
screen shot 2017-01-08 at 4 04 13 am

@patrickhaug
Copy link

Same for me. Release scheme stops working in every app, that worked before.

Undefined symbols for architecture arm64: "___gxx_personality_v0", referenced from: _RCTDefaultLogFunction_block_invoke in libReact.a(RCTLog.o) _RCTFormatLog in libReact.a(RCTLog.o) ___RCTAddLogFunction_block_invoke in libReact.a(RCTLog.o) _RCTPerformBlockWithLogFunction in libReact.a(RCTLog.o) _RCTPerformBlockWithLogPrefix in libReact.a(RCTLog.o) RCTGetLocalLogFunction() in libReact.a(RCTLog.o) ___RCTPerformBlockWithLogPrefix_block_invoke in libReact.a(RCTLog.o) ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

@joncursi
Copy link
Contributor

joncursi commented Jan 9, 2017

@patrickhaug I ran into that same issue with release schemes failing to build, I read in a different issue tracker and can confirm that deleting your release scheme and re-creating it again in Xcode will get you past that problem

@patrickhaug
Copy link

@joncursi that seems to fix it! thank you sir!

@ncuillery
Copy link
Contributor

use react-native-git-upgrade to upgrade, but no file change

@luhui Maybe you have installed RN 0.40.0 before running the react-native-git-upgrade. It's important that the process starts while the old version of RN is installed in node_modules. See the upgrading guide for details.

@yoniji
Copy link

yoniji commented Jan 12, 2017

+1 @SandroMachado's solution. It worked for me. Thank you!

@binchik I have the same problem and #2685 fix my issue:

  • In Build Phases - Link Binary with Libraries, make sure libReact.a is listed
  • In Build Settings - All, find Dead Code Stripping option, and set to no
  • In Build Settings - All, find Other Linker Flags option, and after add -lc++ flag

@binchik
Copy link

binchik commented Jan 12, 2017

@yoniji Thanks for the suggestion. I tried it, Xcode still can't find React libs.

I stopped using CocoaPods, imported everything the usual way, now everything works fine. I'd like to use CocoaPods though :-(

@MattFoley
Copy link

Xcode can help with this to some degree, at least the replacing of the imports. Xcode has a find and replace with regular expression option.

These regex will let you do find and replace on any files that are importing the wrong way:

Find: (#import )(")(RCT.*.h)(")

Replace: $1<React/$3>

screen shot 2017-01-12 at 5 49 41 pm

@alloy
Copy link
Contributor

alloy commented Feb 1, 2017

@rops Do the 3rd party libs' podspecs explicitly depend on React?

@rops
Copy link

rops commented Feb 1, 2017

I've done some digging and it seems that the third party libraries can't find <React> because they don't have the Pods header path in their Header Search Path. Can you think of some cocoapods hackery to fix that?

(cont above)

Most of 3rd party libs don't have podspecs. They are usually distributed only as an XCode proj.

To add those, I just

  • Drag SomeLibrary.xcodeproj to my xcode proj
  • Add "libSomeLibrary.a" to "Link Binary Phases"

( which is the same steps that react-native link automates )

If I manually override the HEADER_SEARCH_PATH in SomeLibrary.xcodeproj and make it point to MyProject/Pods/Headers/Public then it builds fine.

Is there maybe a way to include SomeLibrary in my Podfile even if there is no SomeLibrary.podspec? Or maybe just some XCode settings to propagate MyProject HEADER_SEARCH_PATH to its children projects?

@alloy
Copy link
Contributor

alloy commented Feb 1, 2017

@rops I’m getting confused. Is your issue really the same issue that this ticket was originally about?

With regards to your specific issue, there’s not much I can help you with. You can either create local podspecs for the libraries you’re using and have CP integrate them for you, or you’ll have to keep doing what you’re doing (adding the header search paths) which you can maybe try to automate.

@kirkstrobeck
Copy link
Author

kirkstrobeck commented Feb 7, 2017

Circling back to this to try again.

I believe the #11721 (comment) has moved resolution forward, but still seeing a blocking error. Anybody know how to address bringing other deps/libs along with the upgrade?

** BUILD FAILED **


The following build commands failed:

  CompileC <FULLPATH>/project/ios/build/Build/Intermediates/RCTFBSDK.build/Debug-iphonesimulator/RCTFBSDK.build/Objects-normal/x86_64/RCTFBSDKShareButtonManager.o RCTFBSDK/share/RCTFBSDKShareButtonManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/project.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/project.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


error Command failed with exit code 1.

@kirkstrobeck
Copy link
Author

kirkstrobeck commented Feb 7, 2017

Additionally, if I run ./node_modules/.bin/react-native-git-upgrade (version ^0.2.5) then I get the following:

./node_modules/.bin/react-native-git-upgrade
<FULLPATH>/project/node_modules/react-native-git-upgrade/cliEntry.js:9
'use strict';var checkForUpdates=function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(
                                                                       ^

ReferenceError: regeneratorRuntime is not defined
    at <FULLPATH>/project/node_modules/react-native-git-upgrade/cliEntry.js:9:72
    at Object.<anonymous> (<FULLPATH>/project/node_modules/react-native-git-upgrade/cliEntry.js:205:208)
    at Module._compile (module.js:571:32)
    at loader (<FULLPATH>/project/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (<FULLPATH>/project/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)

@igor10k
Copy link

igor10k commented Feb 11, 2017

From e1577df description:

To make Xcode copy headers phase work properly, you may need to add React as an explicit dependency to your app's scheme and disable "parallelize build".

Can somebody explain why it says "you may need"? Does it work for somebody without doing this? Why?

@steveccable
Copy link
Contributor

The underlying issue is that the sub-projects like RCTVibration, RCTWebSocket, etc all depend on things in the React project, but do not have it as a build dependency, so it is possible for them to try to build before the things they depend on have built.

I actually found that if you make the React project a dependency of all the other RCT* sub-projects, you can turn parallel builds back on and it works fine.

To add the React project as a dependency, do the following:

1. Open up your project in XCode.
2. Open up the Libraries folder.  You should see React.xcodeproj and several RCT*.xcodeproj.
3. Drag the React.xcodeproj into each of the other projects.
4. Click on each project and navigate to the Build Phases tab.
5. Click on Target Dependencies and add React as a target dependency

If somebody could go through these steps and verify it solves the issue for them AND allows them to turn parallel builds back on, that would be greatly appreciated. Once I verify that this works for other people's projects, I would be fine with making a PR against React Native to make this happen by default.

@heatnode
Copy link

@steveccable I can confirm your steps worked in my case. I went from RN 0.36 to 0.41 and resolved the dependency issues following your steps. Thanks for posting that. It was tedious, but it worked.

@pgarciacamou
Copy link

@steveccable please keep us posted if you do create a PR.

@tanmynguyen
Copy link

I see problem???

screen shot 2017-02-28 at 12 28 25

@kirkstrobeck
Copy link
Author

I just did a fresh project with the new version and ported over all the code. None of the above worked for me.

@kirkstrobeck
Copy link
Author

Closing, because it looks like #11721 (comment) is solving for most folks.

@tanmynguyen
Copy link

@kirkstrobeck you see warning???

screen shot 2017-02-28 at 12 28 25

@kirkstrobeck
Copy link
Author

kirkstrobeck commented Feb 28, 2017

@tanguyantoine would you please open a new issue and reference this one?

@tanguyantoine
Copy link
Contributor

@kirkstrobeck I think you can :)

@kirkstrobeck
Copy link
Author

kirkstrobeck commented Feb 28, 2017

^ ha! oops, I meant to mention @tanmynguyen -- autocomplete ftw

okmttdhr added a commit to okmttdhr/Miss-YT that referenced this issue May 4, 2017
xcode
facebook/react-native#11721 (comment)

react-native upgrade
oblador/react-native-vector-icons#373 (comment)

update react-native-config and `react-native link react-native-config`
lugg/react-native-config#72
@codler
Copy link
Contributor

codler commented Jul 15, 2017

If Libraries/React.xcodeproj are red in xcode then reinstall node_modules

rm -rf node_modules && yarn

My newly created project from react-native 0.46.3 was red :S I have npm 5.3.0 and yarn 0.24.5 when I did react-native init

@GopiKrishna10
Copy link

GopiKrishna10 commented Dec 13, 2017

Hi @kirkstrobeck @tanguyantoine @steveccable @SandroMachado @joncursi

I tried to upgrade the React-native 0.39.0 to 0.50.0 and React 15.3.1 to 16.0.0 facing errors in Xcode could you guys please help me
screen shot 2017-12-13 at 9 58 46 pm

@tanguyantoine
Copy link
Contributor

do you mean @tanmynguyen ?

@GopiKrishna10
Copy link

@tanmynguyen Actually i saw the comments above and typed the names.If you know the solution for above comment.Could you please suggest the solution

@kirkstrobeck
Copy link
Author

@GopiKrishna10 as mentioned at #11721 (comment), I could not resolve this. Hope you have better luck 👍

@GopiKrishna10
Copy link

Ok @kirkstrobeck Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests