【问题标题】:R package 'Boom' fails to install on Ubuntu linuxR 包“Boom”无法在 Ubuntu linux 上安装
【发布时间】:2016-03-16 11:25:38
【问题描述】:

由于某种原因,R 包“Boom”无法在我的系统(Ubuntu 14.04)上安装。 R 和所有其他软件包都处于最新版本(包括“BH”)。由于“Boom”在 CRAN 上,因此应该预期该软件包将安装没有任何问题(例如 Installing package on R, need C++11 support for OSX)。但是,我不知道如何追踪原因:我的设置可能以何种方式与“标准”不同,从而导致软件包无法安装?去哪里看?

这是安装日志中的违规部分:

g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -I. -I../inst/include -IBmath -Imath/cephes -DNO_BOOST_THREADS -DNO_BOOST_FILESYSTEM -DADD_ -DRLANGUAGE  -I"/home/mbojan/R/library/3.2/BH/include"   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c Models/PosteriorSamplers/DirichletPosteriorSampler.cpp -o Models/PosteriorSamplers/DirichletPosteriorSampler.o
Models/PosteriorSamplers/DirichletPosteriorSampler.cpp: In member function ‘void BOOM::DirichletPosteriorSampler::draw_impl(const std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> >&, const BOOM::Vector&)’:
Models/PosteriorSamplers/DirichletPosteriorSampler.cpp:90:65: error: no matching function for call to ‘std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> >::erase(__gnu_cxx::__normal_iterator<const std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*, std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> > >)’
         other_implementations.erase(impl.begin() + which_sampler);
                                                                 ^
Models/PosteriorSamplers/DirichletPosteriorSampler.cpp:90:65: note: candidates are:
In file included from /usr/include/c++/4.8/vector:69:0,
                 from ../inst/include/Models/DataTypes.hpp:24,
                 from ../inst/include/Models/ParamTypes.hpp:22,
                 from ../inst/include/Models/ModelTypes.hpp:22,
                 from ../inst/include/Models/DirichletModel.hpp:22,
                 from ../inst/include/Models/PosteriorSamplers/DirichletPosteriorSampler.hpp:23,
                 from Models/PosteriorSamplers/DirichletPosteriorSampler.cpp:18:
/usr/include/c++/4.8/bits/vector.tcc:134:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::iterator) [with _Tp = std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>; _Alloc = std::allocator<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*, std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*]
     vector<_Tp, _Alloc>::
     ^
/usr/include/c++/4.8/bits/vector.tcc:134:5: note:   no known conversion for argument 1 from ‘__gnu_cxx::__normal_iterator<const std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*, std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> > >’ to ‘std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> >::iterator {aka __gnu_cxx::__normal_iterator<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*, std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> > >}’
/usr/include/c++/4.8/bits/vector.tcc:146:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::iterator) [with _Tp = std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>; _Alloc = std::allocator<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> >; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*, std::vector<std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl> > >; typename std::_Vector_base<_Tp, _Alloc>::pointer = std::shared_ptr<BOOM::DirichletSampler::DirichletSamplerImpl>*]
     vector<_Tp, _Alloc>::
     ^
/usr/include/c++/4.8/bits/vector.tcc:146:5: note:   candidate expects 2 arguments, 1 provided
make: *** [Models/PosteriorSamplers/DirichletPosteriorSampler.o] Error 1
ERROR: compilation failed for package ‘Boom’

【问题讨论】:

    标签: r ubuntu


    【解决方案1】:

    尝试更新的编译器:安装g++-4.9 并设置

    CXX=g++-4.9
    CXX1X=g++-4.9
    

    ~/.R/Makevars 或您的/etc/R/Makeconf 中。我昨天刚刚在工作的机器上重建了 Boom(尽管那是 Ubuntu 15.04 到 15.10 的升级,由于切换到 g++-5 需要重建)。

    【讨论】:

    • 我从ubuntu-toolchain-r PPA 安装了g++-4.9,并按照您的建议设置了 envars。该软件包几乎已安装,但在与/usr/bin/ld: cannot find -lgfortran 链接(我认为)时出错。我还缺少其他一些 ubuntu 软件包吗?运行gfortran -v 表示它来自 gcc 4.8.5(我认为)。为 C++ 的无知道歉!
    • Fortran != C++,但是是的,你也需要它。在这里查看数十个其他问题。同一个 PPA 可能有你需要的 gfortran 包。
    • 好的,从上面的 PPA 中安装了 g++-4.9gfortran-4.9,“Boom”安装起来就像一个魅力。谢谢!
    猜你喜欢
    • 2023-03-20
    • 1970-01-01
    • 2015-01-03
    • 2021-05-28
    • 1970-01-01
    • 1970-01-01
    • 2015-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多