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

[Android][Linux] Building master RNTester on Linux fails while building Folly #28298

Closed
willholen opened this issue Mar 12, 2020 · 13 comments
Closed
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@willholen
Copy link
Contributor

Description:

I'm on the latest git commit, and RNTester fails to build on Linux:

/tmp$ git clone https://github.com/facebook/react-native &&
   cd react-native &&
   npm install && 
   ./gradlew :RNTester:android:app:installJSCDebug
[...]
[armeabi-v7a] Compile++ thumb: folly_json <= FileUtil.cpp
make: Leaving directory '/tmp/react-native/ReactAndroid/src/main/jni/react/jni'
/tmp/react-native/ReactAndroid/build/third-party-ndk/folly/folly/FileUtil.cpp:37:14: error: no matching function for call to 'wrapNoInt'
  return int(wrapNoInt(open, name, flags, mode));
             ^~~~~~~~~
/tmp/react-native/ReactAndroid/build/third-party-ndk/folly/folly/detail/FileUtilDetail.h:34:9: note: candidate template ignored: couldn't infer template argument 'F'
ssize_t wrapNoInt(F f, Args... args) {
        ^
1 error generated.
make: *** [/tmp/fetchleak/sdk/ndk-bundle/build/core/build-binary.mk:478: /tmp/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/folly_json/folly/FileUtil.o] Error 1
make: *** Waiting for unfinished jobs....
[...]
make: Leaving directory '/tmp/react-native/ReactAndroid/src/main/jni/react/jni'

> Task :ReactAndroid:buildReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command '/tmp/fetchleak/sdk/ndk-bundle/ndk-build'' finished with non-zero exit value 2

React Native version:

Git master, commit 5ebca70 from Mar 12 (Android SDK downloaded today, commandlinetools-linux-6200805_latest.zip)

Steps To Reproduce

  1. Be on Linux. The problem does not appear on macOS.
  2. git clone https://github.com/facebook/react-native
  3. cd react-native
  4. npm install
  5. ./gradlew :RNTester:android:app:installJSCDebug

Expected Results

I expected RNTester to run

Snack, code example, screenshot, or link to a repository:

https://github.com/facebook/react-native/

The first commit that fails is 6e2131b, "Upgrade Folly to v2020.01.13.00 (#27811)". The preceding commit, a3cb377, builds successfully.

@willholen
Copy link
Contributor Author

I kludged around this by overwriting ReactAndroid/build/third-party-ndk/folly/folly/FileUtil.cpp with a version that defines openNoInt by copying the logic from wrapNoInt rather than calling it. I can then build successfully:

int openNoInt(const char* name, int flags, mode_t mode) {
  ssize_t r;
  do {
    r = open(name, flags, mode);
  } while (r == -1 && errno == EINTR);
  return r;
}

@tempbottle
Copy link

wrapNoInt error also appear on windows build.
read here for help:
https://github.com/tempbottle/react-native/blob/master/downloads/Readme.md

@hsource
Copy link
Contributor

hsource commented May 10, 2020

I have this problem on MacOS as well.

I think the underlying problem is that Folly doesn't know which signature of open to use in cases where both the standard library open and the Folly version of open (in Fcntl.h) are different.

I adapted the solution @willholen into something that'll stick between builds:

Replace prepareFolly in your build.gradle file to fix this for all future builds:

def follyReplaceContent = '''
  ssize_t r;
  do {
    r = open(name, flags, mode);
  } while (r == -1 && errno == EINTR);
  return r;
'''

task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
    from(dependenciesPath ?: tarTree(downloadFolly.dest))
    from("src/main/jni/third-party/folly/Android.mk")
    include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
    eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
    // Fixes problem with Folly failing to build on certain systems. See
    // https://github.com/facebook/react-native/issues/28298
    filter { line -> line.replaceAll('return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);', follyReplaceContent) }
    includeEmptyDirs = false
    into("$thirdPartyNdkDir/folly")
}

hsource added a commit to wanderlog/react-native that referenced this issue May 10, 2020
hsource added a commit to wanderlog/react-native that referenced this issue May 10, 2020
hsource added a commit to wanderlog/react-native that referenced this issue Jul 16, 2020
EvanBacon added a commit to expo/expo that referenced this issue Jul 27, 2020
EvanBacon added a commit to expo/expo that referenced this issue Jul 27, 2020
karol-bisztyga pushed a commit to software-mansion/react-native-reanimated that referenced this issue Jul 29, 2020
Fixes #1024

Solution was taken from facebook/react-native#28298.

Change wrapNoInt template function invocation to it's code, after downloading folly
hsource added a commit to wanderlog/react-native that referenced this issue Jul 30, 2020
EvanBacon added a commit to expo/expo that referenced this issue Jul 30, 2020
EvanBacon added a commit to expo/expo that referenced this issue Jul 30, 2020
* Use react-native/sdk-39 branch

* Use react@16.13.1, react-dom@16.13.1, react-native@0.63.0

* Updated podfiles

* bare-expo pod install

* Remove unused template properties from bare-expo android

* [WIP] Folly

* exponent pod install

* [android] Cast ids to int in transformer

* [WIP] upgrade android

* et update-react-native

* [ios] Add upstream AsyncStorage module to bare project

- Same as RNTester does in expo/react-native@bd13960
- This fixes the error: `Error: Requiring module "../../react-native-lab/react-native/Libraries/Storage/AsyncStorage.js", which threw an exception: TypeError: null is not an object (evaluating 'RCTAsyncStorage.multiMerge')`

* [android] Fix Linking and AsyncStorage client bug

* Upgrade react-native-web

* Upgrade react-native

* et update-react-native

* pod install

* pod-install client

* Update yarn.lock

* pod install

* Try folly fix proposed in facebook/react-native#28298

* [ReactAndroid] Use folly patch facebook/react-native#28298

* pod-install

* pod install
@stale
Copy link

stale bot commented Aug 8, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 8, 2020
@hsource
Copy link
Contributor

hsource commented Aug 8, 2020

As of the latest master ~1 week ago, this is still an issue. Perhaps updating folly will fix it?

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 8, 2020
douglowder added a commit to react-native-tvos/react-native-tvos that referenced this issue Aug 18, 2020
@safaiyeh
Copy link
Contributor

Checked Folly's master it looks like it still has this. Should this be raised with Folly?

evelant added a commit to evelant/react-native that referenced this issue Sep 5, 2020
evelant added a commit to evelant/react-native that referenced this issue Sep 5, 2020
kseniamukhortova pushed a commit to kseniamukhortova/react-native that referenced this issue Oct 21, 2020
@stale
Copy link

stale bot commented Dec 25, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

pxpeterxu pushed a commit to wanderlog/react-native that referenced this issue Jun 23, 2021
mrkcsc added a commit to discord/react-native that referenced this issue Jul 20, 2021
vishnevskiy pushed a commit to discord/react-native that referenced this issue Aug 18, 2021
danielgindi added a commit to danielgindi/react-native that referenced this issue Aug 24, 2021
danielgindi added a commit to danielgindi/react-native that referenced this issue Aug 24, 2021
mrkcsc added a commit to discord/react-native that referenced this issue Dec 12, 2021
@stale
Copy link

stale bot commented Jan 9, 2022

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 9, 2022
@cortinico
Copy link
Contributor

The problem still exists, I tried ndk 21 and 22 and both report this error.

Can someone give it another try. I've been pushing a lot of changes to the NDK setup recently and I believe folly + NDK21 + Linux setup should be good to go 👍

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 10, 2022
prakashbask pushed a commit to prakashbask/expo that referenced this issue Mar 16, 2022
* Use react-native/sdk-39 branch

* Use react@16.13.1, react-dom@16.13.1, react-native@0.63.0

* Updated podfiles

* bare-expo pod install

* Remove unused template properties from bare-expo android

* [WIP] Folly

* exponent pod install

* [android] Cast ids to int in transformer

* [WIP] upgrade android

* et update-react-native

* [ios] Add upstream AsyncStorage module to bare project

- Same as RNTester does in expo/react-native@bd13960
- This fixes the error: `Error: Requiring module "../../react-native-lab/react-native/Libraries/Storage/AsyncStorage.js", which threw an exception: TypeError: null is not an object (evaluating 'RCTAsyncStorage.multiMerge')`

* [android] Fix Linking and AsyncStorage client bug

* Upgrade react-native-web

* Upgrade react-native

* et update-react-native

* pod install

* pod-install client

* Update yarn.lock

* pod install

* Try folly fix proposed in facebook/react-native#28298

* [ReactAndroid] Use folly patch facebook/react-native#28298

* pod-install

* pod install
denbeigh2000 pushed a commit to discord/react-native that referenced this issue Apr 19, 2022
Flewp pushed a commit to discord/react-native that referenced this issue Sep 19, 2022
Flewp pushed a commit to discord/react-native that referenced this issue Oct 14, 2022
Flewp pushed a commit to discord/react-native that referenced this issue Oct 27, 2022
Flewp pushed a commit to discord/react-native that referenced this issue Oct 27, 2022
Flewp pushed a commit to discord/react-native that referenced this issue Nov 18, 2022
Flewp pushed a commit to discord/react-native that referenced this issue Jan 17, 2023
Flewp pushed a commit to discord/react-native that referenced this issue Jan 31, 2023
pxpeterxu pushed a commit to wanderlog/react-native that referenced this issue Mar 4, 2023
pxpeterxu pushed a commit to wanderlog/react-native that referenced this issue Mar 4, 2023
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 13, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

pxpeterxu pushed a commit to wanderlog/react-native that referenced this issue Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

7 participants