react-native: Reliable build on `^0.39.2` fails when upgrading to `^0.40.0`

** 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)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 9
  • Comments: 37 (11 by maintainers)

Commits related to this issue

Most upvoted comments

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…

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

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.

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?

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

@binchik I have the same problem and https://github.com/facebook/react-native/issues/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

I went thru https://github.com/ncuillery/rn-diff/compare/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

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 https://github.com/facebook/react-native/commit/e1577df1fd70049ce7f288f91f6e2b18d512ff4d

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

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

@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 😦