Reputation: 34810
I'm trying to build an old Android project which has native components.
When I try to build the project I get the following error:
Task :app:externalNativeBuildDebug FAILED
Build myappNative x86
[1/1] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/x86/libmyappNative.so
FAILED: : && /Users/Can/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=i686-none-linux-android16 --gcc-toolchain=/Users/Can/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/Can/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -fno-addrsig -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -shared -Wl,-soname,libmyappNative.so -o ../../../../build/intermediates/cmake/debug/obj/x86/libmyappNative.so CMakeFiles/myappNative.dir/src/main/cpp/src/com_myapp_system_Native.cpp.o CMakeFiles/myappNative.dir/src/main/cpp/src/sha256.c.o -llog -latomic -lm "/Users/Can/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a" && :
clang++: error: no such file or directory: '/Users/Can/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a'
ninja: build stopped: subcommand failed.
Which is pretty obvious:
error: no such file or directory: '/Users/Can/Library/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a'
When I go to /Users/Can/Library/Android/sdk/ndk-bundle/sources/cxx-stl/
there are only the following:
llvm-libc++
llvm-libc++abi
system
There is no such gnu-libstdc++
directory. What am I doing wrong?
UPDATE: For the meantime, I've switched back to old NDK r17c upon Alex Cohn's suggestion. It works, though that NDK is obsolete and this is just a temporary workaround, not a long term solution.
Upvotes: 3
Views: 1198
Reputation: 2113
The following commands can be used to install the missing packages in linux
based systems.
sudo apt-get update
sudo apt-get install libstdc++6
Upvotes: -2
Reputation: 57203
Since that project was released, NDK has dropped gnustl. You can still download NDK r.17 or earlier, or you can change your project to use libc++_static instead.
Upvotes: 3