以下是我尝试安装xgboost的过程:
git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update
cp make/mingw64.mk config.mk
直到我在我的git bash中运行代码
才很好 make -j4
出错了:
F:/mingw64/x86_64-w64-mingw32/include/stdio.h:450:83: error: 'FILE* std::fopen(const char*, const char*)' should have been declared inside 'std'
FILE *fopen64(const char * __restrict__ filename,const char * __restrict__ mode);
^
F:/mingw64/x86_64-w64-mingw32/include/stdio.h:450:83: error: 'FILE* std::fopen(const char*, const char*)' conflicts with a previous declaration
F:/mingw64/x86_64-w64-mingw32/include/stdio.h:449:17: note: previous declaration 'FILE* fopen(const char*, const char*)'
FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
^
Makefile:97: recipe for target 'build/c_api/c_api_error.o' failed
make: *** [build/c_api/c_api_error.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from dmlc-core/include/dmlc/registry.h:14:0,
from include/xgboost/./gbm.h:11,
from include/xgboost/learner.h:16,
from src/learner.cc:8:
dmlc-core/include/dmlc/./parameter.h:254:43: warning: 'xgboost::__make__LearnerModelParamParamManager__' defined but not used [-Wunused-variable]
static ::dmlc::parameter::ParamManager &__make__ ## PType ## ParamManager__ = \
^
src/learner.cc:107:1: note: in expansion of macro 'DMLC_REGISTER_PARAMETER'
DMLC_REGISTER_PARAMETER(LearnerModelParam);
^
dmlc-core/include/dmlc/./parameter.h:254:43: warning: 'xgboost::__make__LearnerTrainParamParamManager__' defined but not used [-Wunused-variable]
static ::dmlc::parameter::ParamManager &__make__ ## PType ## ParamManager__ = \
^
src/learner.cc:108:1: note: in expansion of macro 'DMLC_REGISTER_PARAMETER'
DMLC_REGISTER_PARAMETER(LearnerTrainParam);
我找到一些参考资料,说明原因可能与Windows系统和Unix之间的区别有关,但它超出了我的知识范围。
我安装了mingw64
答案 0 :(得分:2)
github page上出现了一个问题。
克隆后,请结帐到版本9a48a40
,然后重复上面执行的步骤。我遇到了同样的问题,这对我有用。
从链接引用:
修正了,只需克隆回购然后结帐到9a48a40直到他们修复它, 最后提交中的内容必须搞砸编译:
git clone --recursive https://github.com/dmlc/xgboost cd xgboost git checkout 9a48a40 git submodule init git submodule update