2017-02-05 129 views
0

我在ubuntu 14.04 64bit桌面上編譯mxnet(v0.9.3)合併與android NDK獨立工具鏈但遇到了一些錯誤。 第一個錯誤是:android-ndk:stoi/stof/stod/to_string不是'std'的成員

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' 

當我刪除「-msse2」選項,然後再次運行makefile,它可以編譯更多,但後來我遇到了新的錯誤,像:

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' 
…… 

我應該怎麼做解決這些?

BTW: 我的android-ndk版本是android-ndk-r13b。 創建獨立的工具鏈,我跟着這些步驟: $ 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 

的更多信息:https://github.com/dmlc/mxnet/issues/4888


我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> 
+0

是否包含所需的文件使用這些功能呢?例如。 'stoi'是在'string'頭文件中聲明的:你在'mxnet_predict-all.cc'中有'#include '嗎? – wasthishelpful

+0

您使用的是GNU STL嗎?如果是這樣,參見例如http://stackoverflow.com/a/18124627/1524450 – Michael

+0

@wasthishelpful是的,我包括。我剛剛在我的問題中涉及了我的mxnet_predict-all.cc的#includes部分。請檢查。 – ROKIM

回答

1

它似乎是一個GNU STL庫問題。我用選項「--stl = libC++」重新編譯了android-toolchain併成功編譯。

0

這是https://github.com/android-ndk/ndk/issues/82#issuecomment-236979264

這不會是在R13。這個「修復」是因爲我們正在研究libC++,所以gnustl變得不必要了。 r14可能會在何時完成。這一直是r13的全部重點,但是要完成它還有許多中間任務。

(這是不是在R13,R14也沒有,但它現在實際上是什麼,我們正在努力將R15)

相關問題