Reputation: 646
I'm trying to compile .cc files for android from linux with arm-linux-androideabi-g++ tool. It includes #include<algorithm>
.
When I try to compile it I get this error:
fatal error: algorithm: No such file or directory
I think that I should point library headers to the compiler with -I flag, but I'm not sure what directory it should be.
Does anyone has any idea how to compile it?
I tried looking in ndk package for the header file:
./toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0.300080/include/cuda_wrappers/algorithm
./toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/5.0/include/cuda_wrappers/algorithm
./sources/cxx-stl/llvm-libc++/include/algorithm
./sources/cxx-stl/llvm-libc++/include/experimental/algorithm
./sources/cxx-stl/stlport/stlport/algorithm
./sources/cxx-stl/gnu-libstdc++/4.9/include/algorithm
./sources/cxx-stl/gnu-libstdc++/4.9/include/ext/algorithm
./sources/cxx-stl/gnu-libstdc++/4.9/include/parallel/algorithm
I tried with these two directories:
arm-linux-androideabi-g++ hello.cc -I/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include
In file included from /ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/algorithm:60:0,
from hello.cc:1:
/ndk/sources/cxx-stl/gnu-libstdc++/4.9/include/utility:68:28:
fatal error: bits/c++config.h: No such file or directory
compilation terminated.
arm-linux-androideabi-g++ hello.cc -I/ndk/sources/cxx-stl/llvm-libc++/include/
In file included from /ndk/sources/cxx-stl/llvm-libc++/include/exception:82:0,
from /ndk/sources/cxx-stl/llvm-libc++/include/typeinfo:61,
from /ndk/sources/cxx-stl/llvm-libc++/include/memory:644,
from /ndk/sources/cxx-stl/llvm-libc++/include/algorithm:643,
from hello.cc:1:
/ndk/sources/cxx-stl/llvm-libc++/include/cstdlib:114:9: error: '::strtold' has not been declared
/ndk/sources/cxx-stl/llvm-libc++/include/cstdlib:132:9: error: '::_Exit' has not been declared
What I try to do is build protobuf library for android. The build fails with missing algorithm file. This is my attempt to break it down.
Upvotes: 4
Views: 1821
Reputation: 10499
You can't invoke the compilers directly with the NDK (though fixing that is on the roadmap for r19). Use a standalone toolchain or one of the supported build systems.
Upvotes: 1