1.編譯環境
- Ubuntu16.4 + arm-hisiv500-linux-
- leveldb 下載下傳位址:https://github.com/google/leveldb/releases
2.移植步驟
- 修改build_detect_platform檔案:
- 添加海思編譯工具
if test -z "$CC"; then
CC=gcc
fi
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++x -fno-builtin-memcmp -lpthread -DOS_LINUX -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT -O2 -DNDEBUG -fPIC -c db/db_iter.cc -o out-shared/db/db_iter.o
db/db_iter.cc::: error: ‘ssize_t’ does not name a type
ssize_t RandomPeriod() {
^
db/db_iter.cc::: 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::: error: class ‘leveldb::{anonymous}::DBIter’ does not have any field named ‘bytes_counter_’
bytes_counter_(RandomPeriod()) {
^
db/db_iter.cc::: 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::: error: ‘ssize_t’ was not declared in this scope
ssize_t n = k.size() + iter_->value().size();
^
db/db_iter.cc::: error: ‘bytes_counter_’ was not declared in this scope
bytes_counter_ -= n;
^
db/db_iter.cc::: error: ‘n’ was not declared in this scope
bytes_counter_ -= n;
^
db/db_iter.cc::: error: ‘RandomPeriod’ was not declared in this scope
bytes_counter_ += RandomPeriod();
^
Makefile:: recipe for target 'out-shared/db/db_iter.o' failed
make: *** [out-shared/db/db_iter.o] Error
- 編譯:
make
- 編譯後生成的庫和頭檔案在如下目錄:
out-shared out-static include