2

I'm trying to cross-compile CppCheck for Android with stand-alone NDK toolchain (gcc 4.8):

#NDK_ROOT="/softdev/android-ndk-r9"
ARCH="arm-linux-androideabi"

export PATH="/softdev/arm-toolchain-gcc4.8/bin/:$PATH"
export SYS_ROOT="/softdev/arm-toolchain-gcc4.8/sysroot"
export CC="${ARCH}-gcc --sysroot=$SYS_ROOT"
export CXX="${ARCH}-g++ --sysroot=$SYS_ROOT"
export LD="${ARCH}-ld"
export AR="${ARCH}-ar"
export RANLIB="${ARCH}-ranlib"
export STRIP="${ARCH}-strip"

export CPPFLAGS="-I${SYS_ROOT}/usr/include  \
-I${SYS_ROOT}/include \
-I/Users/asmirnov/Documents/dev/src/TokyoCabinet/ \
-I/softdev/android-ndk-r9/sources/cxx-stl/gnu-libstdc++/4.8/include"

export LDFLAGS="$LDFLAGS \
-L${SYS_ROOT}/usr/lib \
-L${SYS_ROOT}/lib \
-L/softdev/android-ndk-r9/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi"

make

It seems to compile the files but fails to link into executable (most errors are skipped below):

...
lib/tokenize.cpp:8731: error: undefined reference to 'std::string::replace(unsigned int, unsigned int, char const*)'
lib/mathlib.h:40: error: undefined reference to 'std::ostream::operator<<(unsigned long)'
/softdev/android-ndk-r9/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/stl_vector.h:794: error: undefined reference to 'std::__throw_out_of_range(char const*)'
collect2: error: ld returned 1 exit status
make: *** [cppcheck] Error 1

What should i do?

4ntoine
  • 19,816
  • 21
  • 96
  • 220
  • Possible duplicate http://stackoverflow.com/questions/7185831/what-this-error-means-and-how-to-solve-it – Shmil The Cat Feb 25 '14 at 12:08
  • In the question above it's using NDK and i'm using NDK as standalone toolchain - they are configured in different ways so the answers do not suit – 4ntoine Feb 25 '14 at 17:50
  • Are you trying to compile this [tool](https://github.com/danmar/cppcheck)? If yes, then it is a tool for static code analysis. What are you going to do with it on Android? – yegorich Mar 05 '14 at 20:26
  • I try to make cpp executable to be used on android. – 4ntoine Mar 06 '14 at 05:24

0 Answers0