bedatadriven / renjin-docs

Documentation for Renjin, the R interpreter for the JVM
7 stars 4 forks source link

a section on how to convert a GNU R package (#24) #25

Open perNyfelt opened 3 years ago

perNyfelt commented 3 years ago

(resolves #24)

akbertram commented 3 years ago

Nice write up!

However, I am a bit embarrassed by how difficult and complex this is in practice.

I've updated the command line tool to handle native sources via gradle, and fixed the mavenize command so it puts the pom file in the write place: https://github.com/bedatadriven/renjin/commit/f66ea2e3d49205c1c9f27a37039a15ea6126c3c0

Can you help me test the command line tool + maven plugin? Then we can simplify this description considerably!

perNyfelt commented 3 years ago

I have done some testing. Cannot get it to quite work:

Renjin setup:

  1. vagrant ssh -c "cd /home/ubuntu/renjin && ./gradlew build publishToMavenLocal"

Test project:

  1. wget https://github.com/cran/jsonlite/archive/refs/tags/1.7.2.zip
  2. unzip 1.7.2.zip
  3. cd jsonlite-1.7.2
  4. renjin package mavenize INFO] Resolving dependencies... [INFO] Resolving transitive dependencies... [INFO] Downloading dependencies... [INFO] Successfully wrote pom.xml. Run mvn test to check.
  5. mvn test [INFO] Scanning for projects... [INFO]
    [INFO] ------------------------------------------------------------------------ [INFO] Building jsonlite 1.7.2 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jsonlite --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/vagrant/testProjects/jsonlite-1.7.2/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ jsonlite --- [INFO] No sources to compile [INFO] [INFO] --- renjin-maven-plugin:3.5-dev:gnur-compile (build-package) @ jsonlite --- [WARNING] The POM for org.renjin:renjin-asm:jar:5.0.4b is missing, no dependency information available [WARNING] The POM for org.renjin:renjin-guava:jar:28.0b is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.584 s [INFO] Finished at: 2021-07-31T14:25:06+00:00 [INFO] Final Memory: 12M/217M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.renjin:renjin-maven-plugin:3.5-dev:gnur-compile (build-package) on project jsonlite: Execution build-package of goal org.renjin:renjin-maven-plugin:3.5-dev:gnur-compile failed: Plugin org.renjin:renjin-maven-plugin:3.5-dev or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.renjin:renjin-asm:jar:5.0.4b, org.renjin:renjin-guava:jar:28.0b: Failure to find org.renjin:renjin-asm:jar:5.0.4b in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

FIX: Add a pluginRepositories section:

  <pluginRepositories>
    <pluginRepository>
      <id>bedatadriven-public</id>
      <url>https://nexus.bedatadriven.com/content/groups/public/</url>
    </pluginRepository>
  </pluginRepositories>
  1. mvn test

    [INFO] Scanning for projects... [INFO] [INFO] ----------------------< org.renjin.cran:jsonlite >---------------------- [INFO] Building jsonlite 1.7.2 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jsonlite --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/per/project/jsonlite-1.7.2/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jsonlite --- [INFO] No sources to compile [INFO] [INFO] --- renjin-maven-plugin:3.5-dev:gnur-compile (build-package) @ jsonlite --- EXECUTING: -print-file-name=plugin [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.716 s [INFO] Finished at: 2021-07-31T16:37:26+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.renjin:renjin-maven-plugin:3.5-dev:gnur-compile (build-package) on project jsonlite: Failed to unpack GCC Bridge Plugin: Cannot run program "gcc-4.7" (in directory "/tmp/1627742246699-0"): error=2, No such file or directory -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

ls /tmp/1627742246699-0 plugin.c

So to summarize:

  1. We need to add a
  2. Not sure how to interpret the gcc bridge error. My guess is that the intention is to run the gcc compilation in Vagrant but that this is not quite working, not sure why. No Vagrantfile is left in the directory so cannot try it "manually" to see if there are more errors available that could give some hint.