Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I was compiling mxnet(v0.9.3) amalgamation with android NDK Standalone Toolchain on Ubuntu 14.04 64bit Desktop but met some errors. First error is:

arm-linux-androideabi-g++ -std=c++11 -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -fPIC -M -MT nnvm.o \
    -I `pwd`/../ -I `pwd`/../include \
    -D__MIN__=0 nnvm.cc > nnvm.d
arm-linux-androideabi-g++: error: unrecognized command line option '-msse2'

When I deleted '-msse2' option and runmakefileagain, it can compile more but later I met new errors like those:

jni/../mxnet_predict-all.cc:2801:37: error: 'fopen64' was not declared in this scope
jni/../mxnet_predict-all.cc:21495:14: error: 'stoi' is not a member of 'std'
jni/../mxnet_predict-all.cc:30077:52: error: 'to_string' is not a member of 'std'
jni/../mxnet_predict-all.cc:34298:29: error: 'stof' is not a member of 'std'
jni/../mxnet_predict-all.cc:41383:56: error: 'stod' is not a member of 'std'

What should I do to solve those?

My android-ndk version is android-ndk-r13b. To create Standalone Toolchain, I followed those steps: $ python NDK/build/tools/make_standalone_toolchain.py --arch arm --api 21 --install-dir /tmp/my-android-toolchain

export PATH=$PATH:/tmp/my-android-toolchain/bin
export CXX=arm-linux-androideabi-g++
export CC=arm-linux-androideabi-gcc

More information:https://github.com/dmlc/mxnet/issues/4888

The #includes of my mxnet_predict-all.cc:

#if defined(__MACH__)
#include <mach/clock.h>
#include <mach/mach.h>
#endif
#if !defined(__WIN32__)
#include <sys/stat.h>
#include <sys/types.h>
#if !defined(__ANDROID__) && (!defined(MSHADOW_USE_SSE) || MSHADOW_USE_SSE == 1)
#include <emmintrin.h>
#endif
#endif
#include <algorithm>
#include <array>
#include <assert.h>
#include <atomic>
#include <cblas.h>
#include <cctype>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <condition_variable>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <dirent.h>
#include <errno.h>
#include <fstream>
#include <functional>
#include <inttypes.h>
#include <iostream>
#include <istream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <new>
#include <ostream>
#include <queue>
#include <random>
#include <regex>
#include <sched.h>
#include <set>
#include <sstream>
#include <stdbool.h>
#include <stddef.h>
#include <stdexcept>
#include <stdint.h>
#include <stdlib.h>
#include <streambuf>
#include <string>
#include <thread>
#include <time.h>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
                Did you include the needed files to use these functions? E.g. stoi is declared in string header: do you have a #include <string> in mxnet_predict-all.cc?
– rocambille
                Feb 5, 2017 at 11:19
                @wasthishelpful Yes I included <string>. I just atteched the #includes part of my mxnet_predict-all.cc in my question. Please check.
– ROKIM
                Feb 5, 2017 at 12:40
                @Michael I'm not quite sure since I'm newbie at this. It seems that libstdc++ is used by default, is that mean I'm using GNUSTL?
– ROKIM
                Feb 5, 2017 at 12:52
                Yes it indeed seems to be a GNU STL library problem. I rebuilded android-toolchain with option '--stl=libc++' and compiled successfully.
– ROKIM
                Feb 5, 2017 at 14:13
  

It will not be in r13. The "fix" for this is that we're working on libc++ so gnustl becomes unnecessary. r14 is probably when that will be done. It's been the entire focus of r13, but there are a lot of intermediate tasks to getting it done.

(that wasn't in r13, nor r14, but it now is actually what we're working on for r15)

EDIT: This was fixed in NDK r16.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.