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] Build from source in Android Studio OSX fails :ReactAndroid:buildReactNdkLib #6689

Closed
berickson1 opened this issue Mar 28, 2016 · 7 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@berickson1
Copy link
Contributor

Using the latest React Native master (a7e5312), I'm unable to build from source inside of Android Studio.

Followed the documents for building Android React Native from source at the following URL:
https://facebook.github.io/react-native/docs/android-building-from-source.html

Attempted with both Android NDK r11b and r10e with the same results.

This looks somewhat related to issue #6608 but using the same NDK version on Mac did not resolve the issue.

OS: OSX 10.11.4
Android Studio Version: 1.5.1
Branch: master

Log:

:ReactAndroid:downloadJSCHeaders UP-TO-DATE
:ReactAndroid:prepareJSC
:ReactAndroid:buildReactNdkLib
Android NDK: WARNING:/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni//react/Android.mk:reactnative: LOCAL_LDLIBS is always ignored for static libraries    
Android NDK: WARNING:/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni//react/Android.mk:reactnative: LOCAL_LDLIBS is always ignored for static libraries    
make: Entering directory `/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni/react/jni'
[armeabi-v7a] Compile++ thumb: reactnativejni <= JSCPerfLogging.cpp
[armeabi-v7a] Compile++ thumb: reactnativejni <= JSLogging.cpp
[armeabi-v7a] Compile++ thumb: reactnativejni <= OnLoad.cpp
[armeabi-v7a] Compile++ thumb: reactnativejni <= ProxyExecutor.cpp
[armeabi-v7a] Prebuilt       : libjsc.so <= /mySourceCodePath/node_modules/react-native/ReactAndroid/build/third-party-ndk/jsc/jni/armeabi-v7a/
[armeabi-v7a] Compile++ thumb: reactnative <= Bridge.cpp
[armeabi-v7a] Compile++ thumb: reactnative <= JSCExecutor.cpp

./OnLoad.cpp: In member function 'void facebook::react::{anonymous}::bridge::PlatformBridgeCallback::executeCallbackOnCallbackQueueThread(std::function<void(facebook::jni::ResolvedWeakReference&)>&&)':
./OnLoad.cpp:634:39: error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]
     auto runnableWrapper = std::bind([weakCallback=weakCallback_] (std::function<void(ResolvedWeakReference&)>& runnable) {
                                       ^

[armeabi-v7a] Compile++ thumb: reactnative <= JSCHelpers.cpp

/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni//react/JSCExecutor.cpp: In member function 'void facebook::react::JSCExecutor::postMessageToOwner(JSValueRef)':
/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni//react/JSCExecutor.cpp:381:46: error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]
   m_owner->m_messageQueueThread->runOnQueue([workerId=m_workerId, owner=m_owner, ownerIsDestroyed, msgString] () {
                                              ^
/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni//react/JSCExecutor.cpp:381:67: error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]
   m_owner->m_messageQueueThread->runOnQueue([workerId=m_workerId, owner=m_owner, ownerIsDestroyed, msgString] () {
                                                                   ^

[armeabi-v7a] Compile++ thumb: reactnative <= Platform.cpp
[armeabi-v7a] Compile++ thumb: reactnative <= Value.cpp
[armeabi-v7a] Install        : libfolly_json.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libfolly_json.so
[armeabi-v7a] Install        : libfbjni.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libfbjni.so
[armeabi-v7a] Install        : libjsc.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libjsc.so
[armeabi-v7a] Install        : libglog_init.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libglog_init.so
[armeabi-v7a] Install        : libgnustl_shared.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libgnustl_shared.so
[armeabi-v7a] Install        : libfb.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libfb.so
[armeabi-v7a] Install        : libglog.so => /mySourceCodePath/node_modules/react-native/ReactAndroid/build/react-ndk/all/armeabi-v7a/libglog.so
[x86] Compile++      : reactnativejni <= JSCPerfLogging.cpp
[x86] Compile++      : reactnativejni <= JSLogging.cpp

cc1plus: all warnings being treated as errors
make: *** [/mySourceCodePath/node_modules/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/reactnative/JSCExecutor.o] Error 1
make: *** Waiting for unfinished jobs....
cc1plus: all warnings being treated as errors
make: *** [/mySourceCodePath/node_modules/react-native/ReactAndroid/build/tmp/buildReactNdkLib/local/armeabi-v7a/objs/reactnativejni/OnLoad.o] Error 1

make: Leaving directory `/mySourceCodePath/node_modules/react-native/ReactAndroid/src/main/jni/react/jni'
:ReactAndroid:buildReactNdkLib FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command '/Users/*****/Library/Android/ndk/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

@chirag04
Copy link
Contributor

@berickson1 NDK r11e is not supported. Can you try again with r10e:

Refer links here:
http://facebook.github.io/react-native/releases/next/docs/android-building-from-source.html#content

@satya164
Copy link
Contributor

@facebook-github-bot answered

@facebook-github-bot
Copy link
Contributor

Closing this issue as @satya164 says the question asked has been answered. Please help us by asking questions on StackOverflow. StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Mar 28, 2016
@satya164
Copy link
Contributor

@berickson1 make sure you change the NDK path in the ANDROID_NDK variable as well as your local.properties file.

@berickson1
Copy link
Contributor Author

@chirag04 I've verified with that I'm using Android NDK r10e. I've set the ANDROID_NDK environment variable properly (and set android.ndk in local.properties)

The build is failing with the aforementioned error.

@chirag04
Copy link
Contributor

@berickson1 Make sure android studio is not overriding your local.properties(it re-generates local.properties automatically) and android studio can see you environment variables.

Goto Terminal tab inside android studio and see if you have ANDROID_NDK set. otherwise set the variable in Android Studio -> Preferences -> Path Variables.

@berickson1
Copy link
Contributor Author

Looks like my Android Studio was overriding my NDK version and using r11b. Thanks for the help!

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants