`
zjjxxl
  • 浏览: 20165 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

mongodb 源码编译

 
阅读更多
    MongoDB2.4.8 在win7下用VS2010编译出现了几个问题,解决后整理下供大家参考。
 
1、下载2.4.8源代码 
wget http://fastdl.mongodb.org/src/mongodb-src-r2.4.8.zip
 
2、VS2010 打开mongodb-src-r2.4.8\src\mongodb.sln,举行编译,会陆续报错,在相应目录执行如下语句
 

a、D:\work\mongodb-src-r2.4.8\src\mongo\base>generate_error_codes.py error_codes.err error_codes.h error_codes.cpp

 
b、D:\work\mongodb-src-r2.4.8\src\mongo\db\auth>generate_action_types.py action_types.txt action_type.h action_type.cpp
 
c、D:\work\mongodb-src-r2.4.8\src\mongo\db\fts>generate_stop_words.py stop_words_danish.txt stop_words_dutch.txt stop_words_english.txt stop_words_finnish.txt stop_words_french.txt st
op_words_german.txt stop_words_hungarian.txt stop_words_italian.txt stop_words_list.h stop_words_list.cpp
 
3、用如下代码段替换stop_words_list.cpp文件的words[]变量初始化代码
const char * const words[] = {
       "// stop_words.h" ,
       "" ,
       "/**" ,
       "*    Copyright (C) 2012 10gen Inc." ,
       "*" ,
       "*    This program is free software: you can redistribute it and/or  modify" ,
       "*    it under the terms of the GNU Affero General Public License, version 3," ,
       "*    as published by the Free Software Foundation." ,
       "*" ,
       "*    This program is distributed in the hope that it will be useful," ,
       "*    but WITHOUT ANY WARRANTY; without even the implied warranty of" ,
       "*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" ,
       "*    GNU Affero General Public License for more details." ,
       "*" ,
       "*    You should have received a copy of the GNU Affero General Public License" ,
       "*    along with this program.  If not, see <http://www.gnu.org/licenses/>." ,
       "*/" ,
       "" ,
       "" ,
       "#pragma once" ,
       "" ,
       "#include <set>" ,
       "#include <string>" ,
       "" ,
       "#include \"mongo/platform/unordered_set.h\"" ,
       "" ,
       "namespace mongo {" ,
       "" ,
       "namespace fts {" ,
       "" ,
       "class StopWords {" ,
       "public:" ,
       "StopWords();" ,
       "StopWords( const std::set<std::string>& words );" ,
       "" ,
       "void loadStopWordMap( std::map< std::string, std::set< std::string > >* m ){}" ,
       "" ,
       "bool isStopWord( const std::string& word ) const {" ,
       "return _words.count( word ) > 0;" ,
       "}" ,
       "" ,
       "size_t numStopWords() const { return _words.size(); }" ,
       "" ,
       "static const StopWords* getStopWords( const std::string& langauge );" ,
       "private:" ,
       "~StopWords(){}" ,
       "unordered_set<std::string> _words;" ,
       "};" ,
       "" ,
       "}" ,
       "}" ,
       "" ,
   };
 
4、添加 dbhash.h,dbhash.cpp两个文件加入编译

 
5、设置命令参数:--dbpath D:\work\data,开启断点,系统成功初始化


 
 
  • 大小: 18.9 KB
  • 大小: 174 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics