There is no problem in porting, but there is some problem in DbEnv
here is the code from BerkeleyDB documentation,
DbEnv myEnv(0);
try {
myEnv.open(envHome.c_str(), env_flags, 0);
} catch(DbException &e) {
std::cerr << "Error opening database environment: " << envHome <<
std::endl;
std::cerr << e.what() << std::endl;
exit( -1 );
} catch(std::exception &e) {
std::cerr << "Error opening database environment: " << envHome <<
std::endl;
std::cerr << e.what() << std::endl;
exit( -1 );
}
I compiled the above code and make it runs in my S3C2410 board, but got
the following error, do you know what is the problem?
Error opening database environment: ./testEnv
DbEnv::open: Function not implemented
Regards,
ZhangZQ
The first thing to do is to set up the Berkeley DB error stream:
myEnv.set_error_stream(&std::cerr);
That should give you more information about what is failing.
My hunch is that you have configured Berkeley DB to use POSIX mutexes
but that this system does not support having POSIX mutexes shared
between processes. If that is the issue, adding DB_PRIVATE to
env_flags should allow you to open an environment. However, if you
need to have multiple processes sharing data, you'll need to find an
appropriate mutex implementation. Berkeley DB has a "ARM/gcc-assembly"
mutexes, which should do what you need in that case.
Regards,
Michael.
Thank you very much! That is the problem, now I rebuild the Berkeley DB
by
"configure --enable-cxx -with-mutex=ARM/gcc-assembly --host=arm-linux"
to fixed that problem!
Regards,
ZhangZQ