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
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,开启断点,系统成功初始化
相关推荐
lbyd0 2020-11-17
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09
zhushenghan 2020-11-09
sunnnyduan 2020-10-16
不要皱眉 2020-10-14
xiaohai 2020-09-29
songxiugongwang 2020-09-22
萌亖 2020-09-17
LuckyLXG 2020-09-08
sdmzhu 2020-09-01
mkhhxxttxs 2020-09-16
xiaohai 2020-09-16
newcome 2020-09-09
jaylong 2020-08-19
大秦铁骑 2020-08-19
thatway 2020-08-19