error happens when install xgboost4.0 in windows7, python2.7

这一生的挚爱 提交于 2019-12-08 11:40:41

问题


Here is the process I tried to install xgboost:

git clone --recursive https://github.com/dmlc/xgboost
git submodule init
git submodule update
cp make/mingw64.mk config.mk

It was good until I ran the code in my git bash

 make -j4

It goes wrong:

    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);

I find some reference which shows the reason may be related to the difference between the windows system and Unix, but it is beyond my konwledge.

I installed mingw64


回答1:


There was an issue raised on the github page.

After cloning, checkout to version 9a48a40 then repeat the steps you performed above. I was having the same issue, and this worked for me.

Quoting from the link:

Fixed, just clone repo and then checkout to 9a48a40 until they fix it, something in the last commits must have screwed up the compilation:

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git checkout 9a48a40
git submodule init
git submodule update


来源:https://stackoverflow.com/questions/37773939/error-happens-when-install-xgboost4-0-in-windows7-python2-7

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