React-native: [Android] :ReactAndroid:buildReactNdkLib FAILED when running Movie Examples

Created on 23 Mar 2016  路  8Comments  路  Source: facebook/react-native

When running following command on latest master branch on Windows 7:

./gradlew :Examples:Movies:android:app:installDebug

I got following errors:

:ReactAndroid:prepareJSC
:ReactAndroid:buildReactNdkLib
Android NDK: WARNING:D:\react\react-native\ReactAndroid/src/main/jni//react/Android.mk:reactnative: LOCAL_LDLIBS is always ignored for static libraries    
Android NDK: WARNING:D:\react\react-native\ReactAndroid/src/main/jni//react/Android.mk:reactnative: LOCAL_LDLIBS is always ignored for static libraries    
make.exe: Entering directory `D:/react/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 <= D:/react/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
[armeabi-v7a] Compile++ thumb: reactnative <= JSCHelpers.cpp
[armeabi-v7a] Compile++ thumb: reactnative <= Platform.cpp
[armeabi-v7a] Install        : libfolly_json.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libfolly_json.so
[armeabi-v7a] Compile++ thumb: reactnative <= Value.cpp
[armeabi-v7a] Install        : libfbjni.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libfbjni.so
[armeabi-v7a] Install        : libjsc.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libjsc.so
[armeabi-v7a] Install        : libglog_init.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libglog_init.so
[armeabi-v7a] Install        : libgnustl_shared.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libgnustl_shared.so
[armeabi-v7a] Install        : libfb.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libfb.so
[armeabi-v7a] Install        : libglog.so => D:\react\react-native\ReactAndroid\build/react-ndk/all/armeabi-v7a/libglog.so
[x86] Compile++      : reactnativejni <= JSCPerfLogging.cpp
[x86] Compile++      : reactnativejni <= JSLogging.cpp
[x86] Compile++      : reactnativejni <= OnLoad.cpp
D:/react/react-native/ReactAndroid/src/main/jni//react/Bridge.cpp: In member function 'void facebook::react::Bridge::loadApplicationUnbundle(std::unique_ptr<facebook::react::JSModulesUnbundle>, const string&, const string&)':
D:/react/react-native/ReactAndroid/src/main/jni//react/Bridge.cpp:49:8: error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]
       [holder=std::make_shared<std::unique_ptr<JSModulesUnbundle>>(std::move(unbundle)), startupCode, sourceURL]
        ^
D:/react/react-native/ReactAndroid/src/main/jni//react/Bridge.cpp: In member function 'void facebook::react::Bridge::runOnExecutorQueue(facebook::react::ExecutorToken, std::function<void(facebook::react::JSExecutor*)>)':
D:/react/react-native/ReactAndroid/src/main/jni//react/Bridge.cpp:237:77: error: lambda capture initializers only available with -std=c++1y or -std=gnu++1y [-Werror]
   executorMessageQueueThread->runOnQueue([this, isDestroyed, executorToken, task=std::move(task)] {
                                                                             ^
D:/react/react-native/ReactAndroid/src/main/jni//react/JSCExecutor.cpp: In member function 'void facebook::react::JSCExecutor::postMessageToOwner(JSValueRef)':
D:/react/react-native/ReactAndroid/src/main/jni//react/JSCExecutor.cpp:399: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] () {
                                              ^
D:/react/react-native/ReactAndroid/src/main/jni//react/JSCExecutor.cpp:399: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] () {
                                                                   ^
./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) {
                                       ^
[x86] Compile++      : reactnativejni <= ProxyExecutor.cpp
[x86] Compile++      : fbjni <= WeakReference.cpp
[x86] Compile++      : fbjni <= ByteBuffer.cpp
[x86] Compile++      : fbjni <= Exceptions.cpp
[x86] Compile++      : fbjni <= Hybrid.cpp
cc1plus.exe: all warnings being treated as errors
make.exe: *** [D:\react\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/reactnative/Bridge.o] Error 1
make.exe: *** Waiting for unfinished jobs....
./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) {
                                       ^
cc1plus.exe: all warnings being treated as errors
make.exe: *** [D:\react\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/reactnative/JSCExecutor.o] Error 1
cc1plus.exe: all warnings being treated as errors
make.exe: *** [D:\react\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/reactnativejni/OnLoad.o] Error 1
cc1plus.exe: all warnings being treated as errors
make.exe: *** [D:\react\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/x86/objs/reactnativejni/OnLoad.o] Error 1
make.exe: Leaving directory `D:/react/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 'D:\Android\android-ndk-r10e\ndk-build.cmd'' 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

I already installed gcc (5.2.0) and make (4.1) with Cygwin.

Any suggestions are appreciated.

Ran Commands Locked

Most helpful comment

@chaosink ,

I changed Android NDK version to r10e and pulled the latest master branch, now everything works well.
You can download ndk r10e version from http://dl.google.com/android/repository/android-ndk-r10e-windows-x86_64.zip

Good luck.

All 8 comments

@facebook-github-bot label android

Same situation...

@chaosink ,

I changed Android NDK version to r10e and pulled the latest master branch, now everything works well.
You can download ndk r10e version from http://dl.google.com/android/repository/android-ndk-r10e-windows-x86_64.zip

Good luck.

@facebook-github-bot answered

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.

@xsq007 Thanks for your tips~!!

Oops... RN still uses ndk from 2015 馃憥

Was this page helpful?
0 / 5 - 0 ratings