首页 > 开发 > C++ > 正文

在raspberry pi上编译mongo时错误

2017-09-11 21:35:46  来源: 网友分享

我试过好几个版本的,包括官方的2.1还有nonx86.都提出出错, template argument 1 is invalid。何解?
错误信息如下:

g++ -o build/linux2/normal/mongo/db/db.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -Wstrict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Wcast-align -Winvalid-pch -O3 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DJS_C_STRINGS_ARE_UTF8 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -DHAVE_SYNC_FETCH_AND_ADD -DALIGNMENT_IMPORTANT -DHAVE_BSWAP32 -DHAVE_BSWAP64 -DXP_UNIX -Ibuild/linux2/normal/third_party/boost -Isrc/third_party/boost -Ibuild/linux2/normal/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/linux2/normal -Isrc -Ibuild/linux2/normal/mongo -Isrc/mongo -Ibuild/linux2/normal/third_party/snappy -Isrc/third_party/snappy -Ibuild/linux2/normal/third_party/js-1.7 -Isrc/third_party/js-1.7 src/mongo/db/db.cpp
In file included from src/third_party/boost/boost/config/no_tr1/complex.hpp:21:0,
                 from src/third_party/boost/boost/math/special_functions/math_fwd.hpp:30,
                 from src/third_party/boost/boost/math/special_functions/sign.hpp:17,
                 from src/third_party/boost/boost/lexical_cast.hpp:70,
                 from src/third_party/boost/boost/date_time/string_parse_tree.hpp:13,
                 from src/third_party/boost/boost/date_time/period_parser.hpp:14,
                 from src/third_party/boost/boost/date_time/date_facet.hpp:23,
                 from src/third_party/boost/boost/date_time/gregorian/gregorian_io.hpp:16,
                 from src/third_party/boost/boost/date_time/gregorian/gregorian.hpp:31,
                 from src/third_party/boost/boost/date_time/posix_time/time_formatters.hpp:12,
                 from src/third_party/boost/boost/date_time/posix_time/posix_time.hpp:24,
                 from src/mongo/db/../util/net/../../db/../bson/../util/time_support.h:28,
                 from src/mongo/db/../util/net/../../db/../bson/bson_db.h:29,
                 from src/mongo/db/../util/net/../../db/jsobj.h:44,
                 from src/mongo/db/../util/net/../../db/cmdline.h:20,
                 from src/mongo/db/../util/net/hostandport.h:21,
                 from src/mongo/db/../util/net/message.h:21,
                 from src/mongo/db/db.h:20,
                 from src/mongo/db/db.cpp:20:
/usr/include/c++/4.6/complex:103:62: error: template argument 1 is invalid
src/third_party/boost/boost/system/error_code.hpp:214:36: warning: 'boost::system::posix_category' defined but not used [-Wunused-variable]
src/third_party/boost/boost/system/error_code.hpp:215:36: warning: 'boost::system::errno_ecat' defined but not used [-Wunused-variable]
src/third_party/boost/boost/system/error_code.hpp:216:36: warning: 'boost::system::native_ecat' defined but not used [-Wunused-variable]
scons: *** [build/linux2/normal/mongo/db/db.o] Error 1
scons: building terminated because of errors.

解决方案

知道为什么了。。。
/usr/include/c++/4.6/complex这个文件里103行把“~”改成“>”