Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有Rcpp的R Cran包构建在除Solaris之外的所有系统上_R_Solaris_Rcpp - Fatal编程技术网

带有Rcpp的R Cran包构建在除Solaris之外的所有系统上

带有Rcpp的R Cran包构建在除Solaris之外的所有系统上,r,solaris,rcpp,R,Solaris,Rcpp,我正在编写一个提交给CRAN的R库,它可以在除Solaris以外的所有平台上编译。 多亏了这个网站,我才能够在那个系统上得到两种不同类型的错误(否则我就无法访问任何Solaris机器) 然而,我不知道我得到的错误。此外,两个编译器的行为完全不同: 使用“Oracle Solaris 10,x86,32位,R-release”选项,我的代码可以编译,但在运行时会出现“segfault”崩溃 使用选项:“Oracle Solaris 10,x86,32位,R-release,Oracle Deve

我正在编写一个提交给CRAN的R库,它可以在除Solaris以外的所有平台上编译。 多亏了这个网站,我才能够在那个系统上得到两种不同类型的错误(否则我就无法访问任何Solaris机器)

然而,我不知道我得到的错误。此外,两个编译器的行为完全不同:

  • 使用“Oracle Solaris 10,x86,32位,R-release”选项,我的代码可以编译,但在运行时会出现“segfault”崩溃

  • 使用选项:“Oracle Solaris 10,x86,32位,R-release,Oracle Developer Studio 12.6”,代码甚至不会编译,出现一个奇怪的错误:

  • “rcpp_module.cpp”,第340行:错误:name函数不明确,无效rcpp::function(const char*,RESULT_TYPE(),const char)和std::function

    由于该软件包在Windows、Ubuntu、CentOs和Mac OS X上编译(没有警告)和执行,但我不知道应该查找哪些可能的错误

    其他人也有同样的问题吗?你有什么提示吗

    谢谢你的支持

    于2021年4月30日更新:我已经制定了一个最小的示例,重现了Oracle Solaris 10、x86、32位、R-release、Oracle Developer Studio 12.6系统上R-hub builder的错误。结果是可以得到的

    在rcpp_module.cpp文件中,我们有:

    #include <Rcpp.h>
    
    #include "KWD_Histogram2D.h"
    
    Rcpp::List compareAll(Rcpp::NumericMatrix Coordinates,  // This is line 49
        Rcpp::NumericMatrix Weights, int L = 3,
        bool recode = true, const std::string& method = "approx",
        const std::string& algorithm = "colgen",
        const std::string& model = "mincostflow",
        const std::string& verbosity = "silent",
        double timelimit = 14400, double opt_tolerance = 1e-06,
        bool unbalanced = false, double unbal_cost = 1e+09,
        bool convex = true) {
    
        Rcpp::List sol;
    
        return sol;
    }
    
    RCPP_MODULE(SKWD) {
        using namespace Rcpp;
    
        function("compareAll", &compareAll,
            List::create(_["Coordinates"], _["Weights"], _["L"] = 3,
                _["recode"] = true, _["method"] = "approx",
                _["algorithm"] = "colgen", _["model"] = "mincostflow",
                _["verbosity"] = "silent", _["timelimit"] = 14400,
                _["opt_tolerance"] = 1e-06, _["unbalanced"] = false,
                _["unbal_cost"] = 1e+09, _["convex"] = true),
            "compare all histograms using the given search options");
    }
    
    我刚刚在上报告了这个问题

    <0> 05.0212021/Stult>:我的C++代码在Solaris 11(通过VILALOLBOX)编译并正确运行,使用GCC-5.5安装。因此,这个bug位于我编写的Rcpp包装器和在Solaris下运行的R系统之间

    于2021年5月7日更新:我已经回答了下面我自己的问题。

    在335-340行的代码中

      .method("num_arcs", &KWD::Solver::num_arcs,
              "get the number of arcs in the Network model")
    
      .method("num_nodes", &KWD::Solver::num_nodes,
              "get the number of arcs in the Network model")
    
    不应该是第二个节点吗

     .method("num_nodes", &KWD::Solver::num_nodes,
             "get the number of nodes in the Network model")
    

    重现CRAN自动构建系统上发生的问题的唯一方法是使用位于的映像在VirtualBox中本地安装Solaris 10,并按照GitHub存储库中描述的说明更新R的版本

    最后,错误出现在我的代码中,因为浮点数之间的一个危险的逻辑表达式导致了无限递归调用,因此C堆栈溢出


    Solaris提出这个问题纯属偶然。

    不同的编译器有不同程度的挑剔。如果它在Solaris上失败,可能会出现问题。但由于你没有提供回购协议或与回购协议的链接,我们不能说得更多。你是对的@DirkEddelbuettel,我希望我的错误是“常见的”。我会试着做一个mcve。谢谢。我不知道你为什么拒绝链接到你的Githubrepo@HongOoi抱歉,GitHub的链接为。自从Dirk申请mcve后,我尽了最大努力隔离错误。谢谢,在我当地的分支机构修复了。明天将在线更新。顺便说一下,这只是一个文档错误,因为第四个字符串用于在R帮助文件中记录该方法,它与我的问题的错误完全无关。请更正注释。我不明白为什么有四个人对此投了赞成票。这可能是出于好意,但与您的问题无关。是否可以在此处复制导致此问题的代码或链接到修复提交?错误出现在文件的第383行,并且循环从第381行的0(而不是1)开始。从0开始,当将元素与自身进行比较时,第383行的比较始终为真。整个计算凸包的算法确实可以改进。
      .method("num_arcs", &KWD::Solver::num_arcs,
              "get the number of arcs in the Network model")
    
      .method("num_nodes", &KWD::Solver::num_nodes,
              "get the number of arcs in the Network model")
    
     .method("num_nodes", &KWD::Solver::num_nodes,
             "get the number of nodes in the Network model")