Compiling MongoDB C++ driver on Cygwin

梦想与她 提交于 2019-12-24 10:45:05

问题


I junt trying compile the MongoDB C++ driver on Cygwin with the 'scons' command and i getting this follow error:

src/mongo/db/nonce.cpp:48:20: error: ‘srandomdev’ was not declared in this scope

What lib is that?

Thanks.


回答1:


The srandomdev function is available in stdlib.h on BSD or OSX systems, not on GNU systems like Cygwin or Linux.

It looks like the build script does not recognize the fact that you are running on Cygwin. There are a few options that you can try. The easiest ones are

Change ifdef clause

Without a Windows machine to test this on, it is hard to confirm this will work for you. In src/mongo/platform/random.cpp , edit line 108

#elif defined(__linux__) || defined(__sunos__) || defined(__APPLE__)

to be

#elif defined(__linux__) || defined(__sunos__) || defined(__APPLE__) || defined(__CYGWIN__)

Delete the last else clause

Find the line (141 in my version) of src/mongo/platform/random.cpp that looks like

#else
class SRandSecureRandom : public SecureRandom {
public:

Delete the lines down to the #endif clause and then edit

#elif defined(__linux__) || defined(__sunos__) || defined(__APPLE__)

to simply be

#else


来源:https://stackoverflow.com/questions/14185815/compiling-mongodb-c-driver-on-cygwin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!