嗨,我是R语言和renjin的新手。在我的项目中,下面是添加的maven依赖项。

<dependency>
        <groupId>org.renjin.cran</groupId>
        <artifactId>rgeos</artifactId>
        <version>0.3-2-b24</version>
    </dependency>


我添加了以上依赖。我也尝试了不同和最新版本的rgeos依赖关系。

我在代码中将rgeos包查找为engine.eval(“ library(rgeos)”);
在Java中加载此程序包时出现以下错误

org.renjin.eval.EvalException: IOException while loading package org.renjin.cran:rgeos: Could not resolve native method 'rgeos_Init' in package 'rgeos'
    at org.renjin.primitives.packaging.NamespaceRegistry.tryLoad(NamespaceRegistry.java:215)
    at org.renjin.primitives.packaging.NamespaceRegistry.tryGetNamespace(NamespaceRegistry.java:168)
    at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:130)
    at org.renjin.primitives.packaging.NamespaceRegistry.getNamespace(NamespaceRegistry.java:98)
    at org.renjin.primitives.packaging.Packages.library(Packages.java:40)
    at org.renjin.primitives.R$primitive$library.doApply(R$primitive$library.java:73)
    at org.renjin.primitives.R$primitive$library.apply(R$primitive$library.java:34)
    at org.renjin.primitives.special.InternalFunction.apply(InternalFunction.java:45)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:38)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.eval.Context.evaluate(Context.java:198)
    at org.renjin.sexp.Closure.doApply(Closure.java:98)
    at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:80)
    at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:51)
    at org.renjin.sexp.Closure.apply(Closure.java:83)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.eval.Context.evaluateExpressionVector(Context.java:390)
    at org.renjin.eval.Context.evaluate(Context.java:280)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:168)
    at org.renjin.script.RenjinScriptEngine.eval(RenjinScriptEngine.java:127)
    at com.nact.Test.main(Test.java:21)
Caused by: org.renjin.eval.EvalException: Could not resolve native method 'rgeos_Init' in package 'rgeos'
    at org.renjin.primitives.Native.findMethodByName(Native.java:572)
    at org.renjin.primitives.Native.findMethod(Native.java:545)
    at org.renjin.primitives.Native.redotCall(Native.java:364)
    at org.renjin.primitives.R$primitive$$Call.apply(R$primitive$$Call.java:62)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:38)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.eval.Context.evaluate(Context.java:198)
    at org.renjin.sexp.Closure.doApply(Closure.java:98)
    at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:80)
    at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:51)
    at org.renjin.sexp.Closure.apply(Closure.java:83)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.sexp.Promise.doEval(Promise.java:92)
    at org.renjin.sexp.Promise.force(Promise.java:86)
    at org.renjin.eval.Context.evaluateSymbol(Context.java:345)
    at org.renjin.eval.Context.evaluate(Context.java:278)
    at org.renjin.sexp.Promise.doEval(Promise.java:92)
    at org.renjin.sexp.Promise.force(Promise.java:86)
    at org.renjin.eval.Context.evaluateSymbol(Context.java:345)
    at org.renjin.eval.Context.evaluate(Context.java:278)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.invoke.codegen.ArgumentIterator.evalNext(ArgumentIterator.java:70)
    at org.renjin.primitives.R$primitive$assign.apply(R$primitive$assign.java:30)
    at org.renjin.primitives.special.InternalFunction.apply(InternalFunction.java:45)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.eval.Context.evaluate(Context.java:198)
    at org.renjin.sexp.Closure.doApply(Closure.java:98)
    at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:80)
    at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:51)
    at org.renjin.sexp.Closure.apply(Closure.java:83)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:38)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.eval.Context.evaluate(Context.java:198)
    at org.renjin.sexp.Closure.doApply(Closure.java:98)
    at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:80)
    at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:51)
    at org.renjin.sexp.Closure.apply(Closure.java:83)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.primitives.special.BeginFunction.apply(BeginFunction.java:38)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.eval.Context.evaluate(Context.java:198)
    at org.renjin.sexp.Closure.doApply(Closure.java:98)
    at org.renjin.eval.ClosureDispatcher.apply(ClosureDispatcher.java:80)
    at org.renjin.eval.ClosureDispatcher.applyClosure(ClosureDispatcher.java:51)
    at org.renjin.sexp.Closure.apply(Closure.java:83)
    at org.renjin.eval.Context.evaluateCall(Context.java:407)
    at org.renjin.eval.Context.evaluate(Context.java:282)
    at org.renjin.eval.Context.evaluate(Context.java:264)
    at org.renjin.primitives.packaging.NamespaceRegistry.tryLoad(NamespaceRegistry.java:198)
    ... 28 more

最佳答案

您可以在packages.renjin.org上检查软件包的状态。在这里,您可以搜索rgeos软件包,它将与您交谈rgeos package page

在包裹页面上,您可以看到状态显示:


  Renjin可以加载此软件包,但编译C / FORTRAN源时出错,并且所有测试均失败。此软件包的较旧版本与Renjin兼容。


如果向下滚动,可以看到所有测试当前都失败。您可以单击“查看构建日志”或在失败的测试之一上查看失败的确切原因。在这种情况下,由于您遇到的相同原因,所有测试均失败。

从页面顶部的构建日志中,我看到构建过程不顺利,因为./configure步骤未成功:


  检查/ usr / bin / svnversion ...否
  配置:错误:找不到geos-config或无法执行。
  配置:svn版本:560
  正在检查geos-config ...否
  没有
  [错误] GNU R源的编译失败。
  org.renjin.gcc.InternalCompilerException:无法执行./configure
    在org.renjin.packaging.NativeSourceBuilder.configure(NativeSourceBuilder.java:97)


可能是由于缺少对我们的构建机器的依赖关系。在这种情况下,您可以尝试在本地构建此软件包。通过单击左下角的“ BUILD LOCALLY”按钮,将为您提供一个可粘贴并在终端上运行的链接。在这种情况下:


  卷曲http://packages.renjin.org/package/org.renjin.cran/rgeos/0.3-26/build/4/rebuild.sh | SH


您可以在“构建日志”部分下面看到此链接。

如果您可以在本地构建此文件,请告诉我们。我们对处理包中使用的configure和make文件有一定程度的支持。但是我们尚不支持在构建脚本中可以完成的所有操作,并且rgeos具有相当丰富的configure文件。

09-25 21:21