当我编译XG-Bosst时,出现以下错误:“错误:'Split'不是'xgboost :: common'的成员……”

问题描述 投票:0回答:1

我想在win10中安装要在C ++中使用的XG-Boost。

而且我使用下面的命令(在git bash中:)>

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

使用命令“ make -j4”后,得到结果:

    Makefile:31: MAKE [E:/mingw64/bin/mingw32-make] - checked OK
g++ -m64 -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp -MM -MT build/data/data.o src/data/data.cc >build/data/data.d
g++ -m64 -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp -MM -MT build/gbm/gbm.o src/gbm/gbm.cc >build/gbm/gbm.d
g++ -m64 -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp -MM -MT build/data/ellpack_page_source.o src/data/ellpack_page_source.cc >build/data/ellpack_page_source.d
g++ -m64 -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp -MM -MT build/data/sparse_page_dmatrix.o src/data/sparse_page_dmatrix.cc >build/data/sparse_page_dmatrix.d
g++ -m64 -c -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp src/data/sparse_page_dmatrix.cc -o build/data/sparse_page_dmatrix.o
g++ -m64 -c -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp src/data/data.cc -o build/data/data.o
g++ -m64 -c -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp src/gbm/gbm.cc -o build/gbm/gbm.o
g++ -m64 -c -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp src/data/ellpack_page_source.cc -o build/data/ellpack_page_source.o
g++ -m64 -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp -MM -MT build/gbm/gblinear.o src/gbm/gblinear.cc >build/gbm/gblinear.d
g++ -m64 -c -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude -DDMLC_ENABLE_STD_THREAD=0 -Idmlc-core/include -Irabit/include -I/include -O3 -funroll-loops -fopenmp src/gbm/gblinear.cc -o build/gbm/gblinear.o
In file included from src/data/ellpack_page_source.h:12:0,
                 from src/data/ellpack_page_source.cc:6:
src/data/sparse_page_source.h:370:31: error: 'ThreadedIter' is not a member of 'dmlc'
   std::vector<std::unique_ptr<dmlc::ThreadedIter<T>>> prefetchers_;
                               ^
src/data/sparse_page_source.h:370:31: error: 'ThreadedIter' is not a member of 'dmlc'
src/data/sparse_page_source.h:370:50: error: template argument 1 is invalid
   std::vector<std::unique_ptr<dmlc::ThreadedIter<T>>> prefetchers_;
                                                  ^
src/data/sparse_page_source.h:370:50: error: template argument 2 is invalid
src/data/sparse_page_source.h:370:51: error: template argument 1 is invalid
   std::vector<std::unique_ptr<dmlc::ThreadedIter<T>>> prefetchers_;
                                                   ^
src/data/sparse_page_source.h:370:51: error: template argument 2 is invalid
src/data/sparse_page_source.h:370:53: error: expected unqualified-id before '>' token
   std::vector<std::unique_ptr<dmlc::ThreadedIter<T>>> prefetchers_;
                                                     ^
src/data/sparse_page_source.h: In constructor 'xgboost::data::SparsePageSource<T>::SparsePageSource(const string&, const string&)':
src/data/sparse_page_source.h:122:5: error: 'prefetchers_' was not declared in this scope
     prefetchers_.resize(cache_shards.size());
     ^
src/data/sparse_page_source.h:134:33: error: expected type-specifier
       prefetchers_[i].reset(new dmlc::ThreadedIter<T>(4));
                                 ^
src/data/sparse_page_source.h: In member function 'bool xgboost::data::SparsePageSource<T>::Next()':
src/data/sparse_page_source.h:153:18: error: 'prefetchers_' was not declared in this scope
       size_t n = prefetchers_.size();
                  ^
src/data/sparse_page_source.h:156:9: error: 'prefetchers_' was not declared in this scope
     if (prefetchers_[clock_ptr_]->Next(&page_)) {
         ^
src/data/sparse_page_source.h: In member function 'void xgboost::data::SparsePageSource<T>::BeforeFirst()':
src/data/sparse_page_source.h:171:20: error: 'prefetchers_' was not declared in this scope
     for (auto& p : prefetchers_) {
                    ^
src/data/sparse_page_source.h: In static member function 'static void xgboost::data::SparsePageSource<T>::CreateRowPage(dmlc::Parser<unsigned int>*, const string&, size_t)':
src/data/sparse_page_source.h:197:7: error: 'SparsePageWriter' was not declared in this scope
       SparsePageWriter<SparsePage> writer(cinfo.name_shards, cinfo.format_shards, 6);
       ^
src/data/sparse_page_source.h:197:34: error: expected primary-expression before '>' token
       SparsePageWriter<SparsePage> writer(cinfo.name_shards, cinfo.format_shards, 6);
                                  ^
src/data/sparse_page_source.h:197:84: error: there are no arguments to 'writer' that depend on a template parameter, so a declaration of 'writer' must be available [-fpermissive]
       SparsePageWriter<SparsePage> writer(cinfo.name_shards, cinfo.format_shards, 6);
                                                                                    ^
src/data/sparse_page_source.h:197:84: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
src/data/sparse_page_source.h:199:7: error: 'writer' was not declared in this scope
       writer.Alloc(&page); page->Clear();
       ^
src/data/sparse_page_source.h: In static member function 'static void xgboost::data::SparsePageSource<T>::CreatePageFromDMatrix(xgboost::DMatrix*, const string&, const string&, size_t)':
src/data/sparse_page_source.h:322:7: error: 'SparsePageWriter' was not declared in this scope
       SparsePageWriter<SparsePage> writer(cinfo.name_shards, cinfo.format_shards, 6);
       ^
src/data/sparse_page_source.h:322:34: error: expected primary-expression before '>' token
       SparsePageWriter<SparsePage> writer(cinfo.name_shards, cinfo.format_shards, 6);
                                  ^
src/data/sparse_page_source.h:322:84: error: there are no arguments to 'writer' that depend on a template parameter, so a declaration of 'writer' must be available [-fpermissive]
       SparsePageWriter<SparsePage> writer(cinfo.name_shards, cinfo.format_shards, 6);
                                                                                    ^
src/data/sparse_page_source.h:324:7: error: 'writer' was not declared in this scope
       writer.Alloc(&page);
       ^
src/data/data.cc: In static member function 'static xgboost::DMatrix* xgboost::DMatrix::Load(const string&, bool, bool, const string&, size_t)':
src/data/data.cc:175:47: error: 'Split' is not a member of 'xgboost::common'
       std::vector<std::string> cache_shards = common::Split(cache_file, ':');
                                               ^
src/data/data.cc:175:47: note: suggested alternative:
In file included from dmlc-core/include/dmlc/././optional.h:15:0,
                 from dmlc-core/include/dmlc/./parameter.h:29,
                 from dmlc-core/include/dmlc/registry.h:14,
                 from src/data/data.cc:5:
dmlc-core/include/dmlc/./././common.h:23:33: note:   'dmlc::Split'
 inline std::vector<std::string> Split(const std::string& s, char delim) {
                                 ^
src/data/data.cc:237:40: error: 'Split' is not a member of 'xgboost::common'
     std::vector<std::string> splited = common::Split(fname, '#');
                                        ^
src/data/data.cc:237:40: note: suggested alternative:
In file included from dmlc-core/include/dmlc/././optional.h:15:0,
                 from dmlc-core/include/dmlc/./parameter.h:29,
                 from dmlc-core/include/dmlc/registry.h:14,
                 from src/data/data.cc:5:
dmlc-core/include/dmlc/./././common.h:23:33: note:   'dmlc::Split'
 inline std::vector<std::string> Split(const std::string& s, char delim) {
                                 ^
src/data/data.cc:238:37: error: 'Split' is not a member of 'xgboost::common'
     std::vector<std::string> args = common::Split(splited.front(), '?');
                                     ^
src/data/data.cc:238:37: note: suggested alternative:
In file included from dmlc-core/include/dmlc/././optional.h:15:0,
                 from dmlc-core/include/dmlc/./parameter.h:29,
                 from dmlc-core/include/dmlc/registry.h:14,
                 from src/data/data.cc:5:
dmlc-core/include/dmlc/./././common.h:23:33: note:   'dmlc::Split'
 inline std::vector<std::string> Split(const std::string& s, char delim) {
                                 ^
src/data/data.cc:241:24: error: 'Split' is not a member of 'xgboost::common'
       auto extension = common::Split(args.front(), '.').back();
                        ^
src/data/data.cc:241:24: note: suggested alternative:
In file included from dmlc-core/include/dmlc/././optional.h:15:0,
                 from dmlc-core/include/dmlc/./parameter.h:29,
                 from dmlc-core/include/dmlc/registry.h:14,
                 from src/data/data.cc:5:
dmlc-core/include/dmlc/./././common.h:23:33: note:   'dmlc::Split'
 inline std::vector<std::string> Split(const std::string& s, char delim) {
                                 ^
mingw32-make: *** [Makefile:138: build/data/ellpack_page_source.o] Error 1
mingw32-make: *** Waiting for unfinished jobs....
mingw32-make: *** [Makefile:138: build/data/data.o] Error 1

我尝试了很多方法,但是所有方法都失败了。

这里是版本:

    $ g++ -v
    Using built-in specs.
    COLLECT_GCC=E:\dev-cpp_gr\Dev-Cpp\MinGW64\bin\g++.exe
    COLLECT_LTO_WRAPPER=e:/dev-cpp_gr/dev-cpp/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.1/lto-wrapper.exe
    Target: x86_64-w64-mingw32
    Configured with: ../../../src/gcc-4.8.1/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-2 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
    Thread model: posix
    gcc version 4.8.1 (tdm64-2)

版本号:

    $ make -v
    GNU Make 4.2.1
    Built for x86_64-w64-mingw32
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

我希望有人能给我一些解决方案或有关如何在win10中安装xg-boost的指南。

我想在win10中安装要在C ++中使用的XG-Boost。然后,我使用以下命令(在git bash中):git clone --recursive https://github.com/dmlc/xgboost cd xgboost / git ...

c++ xgboost
1个回答
0
投票

没关系,MinGW-W64可以升级到最新版本(对我来说是8.1.0),可以轻松解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.