AICamera icon indicating copy to clipboard operation
AICamera copied to clipboard

Execution failed for task ':app:externalNativeBuildDebug'

Open gavinbai opened this issue 7 years ago • 2 comments

Hi,guys. I just ran the project on android studio2.3 in windows 7. While it reported an error, can you help me?

Build native-lib armeabi-v7a [1/4] Building C object CMakeFiles/cpufeatures.dir/C_/Users/utsc0471/AppData/Local/ Android/sdk/ndk-bundle/sources/android/cpufeatures/cpu-features.c.o [2/4] Linking C static library libcpufeatures.a [3/4] Building CXX object CMakeFiles/native-lib.dir/src/main/cp p/native-lib.cpp.o [4/4] Linking CXX shared library ........\build\inte rmediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so FAILED: cmd.exe /C "cd . && C:\Users\utsc0471\AppData\Local\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi --gcc-toolchain=C:/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/platforms/android-19/arch-arm -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -frtti -fexceptions -std=c++11 -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ........\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -Wl,--whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a -Wl,--no-whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libNNPACK.a ../../../../src/main/jniLibs/armeabi-v7a/libglog.so ../../../../src/main/jniLibs/armeabi-v7a/libprotobuf.a libcpufeatures.a -llog -landroid -ldl -lm "C:/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a" && cd ." ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(flags.cc.o):flags.cc:function bool caffe2::Caffe2FlagParser::Parse(std::string const&, double*): error: u ndefined reference to 'atof' ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(text_file_reader.cc.o):text_file_reader.cc:function caffe2::TextFileReaderReadOp::RunOnDevice(): error: undefined reference to 'strtof' ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(signal_handler.cc.o):signal_handler.cc:function (anonymous namespace)::HookupHandler(): error: undefined reference to 'sigfillset' ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(signal_handler.cc.o):signal_handler.cc:function (anonymous namespace)::UnhookHandler(): error: undefined reference to 'sigfillset' ../../../../src/main/jniLibs/armeabi-v7a/libprotobuf.a(strutil.cc.o):strutil.cc:function google::protobuf::MathLimits::IsNaN(float): error: undefined reference to '__isnanf' ../../../../src/main/jniLibs/armeabi-v7a/libprotobuf.a(strutil.cc.o):strutil.cc:function google::protobuf::safe_strtof(char const*, float*): error: undefined reference to 'strtof' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. :app:externalNativeBuildDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:externalNativeBuildDebug'.

Build command failed. Error while executing process C:\Users\utsc0471\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe with arguments {--build D:\Practise\androidtest\AICamera\app.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib} [1/4] Building C object CMakeFiles/cpufeatures.dir/C_/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/sources/android/cpufeatures/cpu-features.c.o [2/4] Linking C static library libcpufeatures.a [3/4] Building CXX object CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o [4/4] Linking CXX shared library ........\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so FAILED: cmd.exe /C "cd . && C:\Users\utsc0471\AppData\Local\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=armv7-none-linux-androideabi --gcc-toolchain=C:/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 --sysroot=C:/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/platforms/android-19/arch-arm -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -frtti -fexceptions -std=c++11 -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ........\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -Wl,--whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a -Wl,--no-whole-archive ../../../../src/main/jniLibs/armeabi-v7a/libNNPACK.a ../../../../src/main/jniLibs/armeabi-v7a/libglog.so ../../../../src/main/jniLibs/armeabi-v7a/libprotobuf.a libcpufeatures.a -llog -landroid -ldl -lm "C:/Users/utsc0471/AppData/Local/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a" && cd ." ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(flags.cc.o):flags.cc:function bool caffe2::Caffe2FlagParser::Parse(std::string const&, double*): error: undefined reference to 'atof' ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(text_file_reader.cc.o):text_file_reader.cc:function caffe2::TextFileReaderReadOp::RunOnDevice(): error: undefined reference to 'strtof' ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(signal_handler.cc.o):signal_handler.cc:function (anonymous namespace)::HookupHandler(): error: undefined reference to 'sigfillset' ../../../../src/main/jniLibs/armeabi-v7a/libcaffe2.a(signal_handler.cc.o):signal_handler.cc:function (anonymous namespace)::UnhookHandler(): error: undefined reference to 'sigfillset' ../../../../src/main/jniLibs/armeabi-v7a/libprotobuf.a(strutil.cc.o):strutil.cc:function google::protobuf::MathLimits::IsNaN(float): error: undefined reference to '__isnanf' ../../../../src/main/jniLibs/armeabi-v7a/libprotobuf.a(strutil.cc.o):strutil.cc:function google::protobuf::safe_strtof(char const*, float*): error: undefined reference to 'strtof' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.

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

BUILD FAILED

gavinbai avatar Jun 01 '17 06:06 gavinbai

Hi, I face the same issue. Is there any updated solution?

YiLin-Chen avatar May 17 '18 01:05 YiLin-Chen

I face the same issue too, and I try to change the ndk to 15rc, and it work.

yupeihua avatar Jun 14 '18 08:06 yupeihua