caffe能否移植到arm平台( 二 )


6 directories, 11 files
二.移植lmdb
1.移植环境
* Ubuntu16.04 + arm-hisiv500-linux-gcc * lmdb下载地址:https://github.com/LMDB/lmdb/releases
2.编译步骤
* 修改makefile
21 #CC = gcc 22 CC = arm-hisiv500-linux-gcc 23 #AR = ar 24 AR = arm-hisiv500-linux-ar26 THREADS = -lpthread32 prefix = /home/shunzhi/software/lmdb/libraries/liblmdb/install
* 新建安装目录:mkdir _install * 编译: make * 安装: sudo make install
3.编译结果:
shunzhi@ubuntu:~/software/lmdb/lmdb-LMDB_0.9.19/libraries/liblmdb/install$ tree.├── bin│ ├── mdb_copy│ ├── mdb_dump│ ├── mdb_load│ └── mdb_stat├── include│ └── lmdb.h├── lib│ ├── liblmdb.a│ └── liblmdb.so└── share └── man └── man1 ├── mdb_copy.1 ├── mdb_dump.1 ├── mdb_load.1 └── mdb_stat.1
6 directories, 11 files
三.移植protobuf
【caffe能否移植到arm平台】 1.编译环境:
* Ubuntu16.04 + arm-hisiv500-linux- * protobuf3.20下载地址:https://github.com/google/protobuf/tags
2.移植到3519:
1)编译步骤:
* 生成配置文件:autoconf.sh * 配置:./configure --build=i686-pc-linux --host=arm-hisiv500-linux CC=arm-hisiv500-linux-gcc CXX=arm-hisiv500-linux-g++ --with-protoc=../../protobuf/protobuf-3.2.0/src/protoc --prefix=/home/shunzhi/software/protobuf/hi_proto/protobuf-3.2.0/install * 编译:make * 检测:make check # 检测会出现错误,不用管他( If "make check" fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk.) * 安装:make install
2)配置参数解释:
* --build:指明执行编译的平台为64位x86的Linux平台。 * --host :指明运行的平台。 * CC :gcc交叉编译工具。 * CXX :c++交叉编译工具。 * --prefix:安装目录。 * --with-protoc:指明protoc的查找路径,当我们在pc机上进行交叉编译时,src目录下protoc可能会无法执行,所以我们必须要编译一个protoc可执行文件,将其拷贝到src目录或者执行用这个配置参数来指明protoc的路径;上述参数就是指明protoc路径为我之前在pc编译protobuf时生成的protoc。
四.移植leveldb:
1.编译环境
* Ubuntu16.4 + arm-hisiv500-linux- * leveldb 下载地址:https://github.com/google/leveldb/releases
2.移植步骤:
* 修改build_detect_platform文件:
#添加海思编译工具CC=arm-hisiv500-linux-gccif test -z "$CC"; then CC=gccfi
CXX=arm-hisiv500-linux-g++if test -z "$CXX"; then CXX=g++fi
* 修改db/db_iter.h文件
在#endif前添加如下一行
typedef int ssize_t;如果不定义会出现如下错误:
arm-hisiv500-linux-g++ -I. -I./include -std=c++0x -fno-builtin-memcmp -lpthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT -O2 -DNDEBUG -fPIC -c db/http://db_iter.cc -o out-shared/db/db_iter.odb/db_iter.cc:107:3: error: ‘ssize_t’ does not name a type ssize_t RandomPeriod() { ^db/db_iter.cc:123:3: error: ‘ssize_t’ does not name a type ssize_t bytes_counter_; ^db/db_iter.cc: In constructor ‘leveldb::{anonymous}::DBIter::DBIter(leveldb::DBImpl*, const leveldb::Comparator*, leveldb::Iterator*, leveldb::SequenceNumber, uint32_t)’:db/db_iter.cc:60:9: error: class ‘leveldb::{anonymous}::DBIter’ does not have any field named ‘bytes_counter_’ bytes_counter_(RandomPeriod()) { ^db/db_iter.cc:60:37: error: ‘RandomPeriod’ was not declared in this scope bytes_counter_(RandomPeriod()) { ^db/db_iter.cc: In member function ‘bool leveldb::{anonymous}::DBIter::ParseKey(leveldb::ParsedInternalKey*)’:db/db_iter.cc:132:3: error: ‘ssize_t’ was not declared in this scope ssize_t n = k.size() + iter_-\u0026gt;value().size(); ^db/db_iter.cc:133:3: error: ‘bytes_counter_’ was not declared in this scope bytes_counter_ -= n; ^db/db_iter.cc:133:21: error: ‘n’ was not declared in this scope bytes_counter_ -= n; ^db/db_iter.cc:135:36: error: ‘RandomPeriod’ was not declared in this scope bytes_counter_ += RandomPeriod(); ^Makefile:415: recipe for target \u0026#39;out-shared/db/db_iter.o\u0026#39; failedmake: *** Error 1


推荐阅读