使用R包分发已编译的可执行文件

时间:2023-02-12 04:54:51

I am preparing an R package that will include a third party compiled executable. The plan is to interface it to R using system() calls. I have permission to distribute this executable, but not its source code. Unfortunately it is only compiled under Windows 32 bit, and it is not possible to easily recompile it under different architectures.

我正在准备一个包含第三方编译可执行文件的R包。计划是使用system()调用将其与R连接。我有权分发这个可执行文件,但不是它的源代码。不幸的是,它仅在Windows 32位下编译,并且不可能在不同的体系结构下轻松地重新编译它。

Understanding that this package will have a somewhat limited audience, how should the executable be distributed? I also recognize that it will not be allowed on CRAN for this reason.

了解此程序包的受众人数有限,应该如何分发可执行文件?我也承认,出于这个原因,CRAN不允许这样做。

For example, should the executable be included in the /bin/ subfolder of the package installation, or alternately should the package somehow download the executable when it is itself installed.

例如,应该将可执行文件包含在软件包安装的/ bin /子文件夹中,或者应该在软件包本身安装时以某种方式下载可执行文件。

In addition, what licensing issues, if any do I face under this scenario?

此外,如果在这种情况下我面临什么许可问题?

2 个解决方案

#1


9  

I have worked on two packages that do something like this, both hosted on R-forge because of the CRAN binary restriction (which, by the way, seems perfectly sensible to me). (I don't think you're missing anything obvious in your question -- just saying here what I chose to do.)

我已经开发了两个类似于此类的软件包,这两个软件包都托管在R-forge上,因为CRAN二进制限制(顺便说一下,这对我来说似乎是非常明智的)。 (我不认为你错过任何明显的问题 - 只是在这里说我选择做什么。)

  • the cpcbp package (common principal components/back-projection) uses a binary compiled from code written by Patrick Phillips; the source code is unredistributable because it uses some Numerical Recipes routines. I've been meaning to re-write this core in R (it's just straightforward numerical linear algebra, it wouldn't be that hard). It occurs to me that I probably have to go modify the license on this one -- I probably said "GPL" but I don't think I can actually do that given the unredistributable component ...
  • cpcbp包(公共主要组件/反投影)使用由Patrick Phillips编写的代码编译的二进制文件;源代码是不可分发的,因为它使用了一些Numerical Recipes例程。我一直想在R中重写这个核心(它只是简单的数值线性代数,它不会那么难)。在我看来,我可能不得不修改这个版本的许可证 - 我可能会说“GPL”但我不认为我实际上可以做到这一点,因为不可分发的组件......
  • the glmmADMB package uses freely redistributable source code (BSD license), but the toolchain is sufficiently complicated that I don't want users to have to download the entire supporting package
  • glmmADMB包使用可*再分发的源代码(BSD许可证),但工具链非常复杂,我不希望用户必须下载整个支持包

In both cases I put the binaries in inst/bin and possibly under architecture-specific subdirectories (which get installed in /bin) and use the appropriate logic to detect the architecture and run the correct binary.

在这两种情况下,我都将二进制文件放在inst / bin中,并且可能放在特定于体系结构的子目录下(它们安装在/ bin中),并使用适当的逻辑来检测体系结构并运行正确的二进制文件。

I guess in principle you could get around the inability to license via GPL by making the non-redistributable part into a download (as you suggest), but that would seem to violate the spirit ...

我想原则上你可以通过将不可再发行的部分变成下载(如你所说)来解决无法通过GPL许可的问题,但这似乎违反了精神......

#2


3  

The approach suggested by Ben Bolker is also used by the CRAN package "dismo" - to make the function maxent() work, you have to download the maxent java binary and place it into the appropriate subdirectory within the main package folder.

Ben Bolker建议的方法也被CRAN软件包“dismo”使用 - 为了使函数maxent()起作用,你必须下载maxent java二进制文件并将其放入主包文件夹中的相应子目录中。

#1


9  

I have worked on two packages that do something like this, both hosted on R-forge because of the CRAN binary restriction (which, by the way, seems perfectly sensible to me). (I don't think you're missing anything obvious in your question -- just saying here what I chose to do.)

我已经开发了两个类似于此类的软件包,这两个软件包都托管在R-forge上,因为CRAN二进制限制(顺便说一下,这对我来说似乎是非常明智的)。 (我不认为你错过任何明显的问题 - 只是在这里说我选择做什么。)

  • the cpcbp package (common principal components/back-projection) uses a binary compiled from code written by Patrick Phillips; the source code is unredistributable because it uses some Numerical Recipes routines. I've been meaning to re-write this core in R (it's just straightforward numerical linear algebra, it wouldn't be that hard). It occurs to me that I probably have to go modify the license on this one -- I probably said "GPL" but I don't think I can actually do that given the unredistributable component ...
  • cpcbp包(公共主要组件/反投影)使用由Patrick Phillips编写的代码编译的二进制文件;源代码是不可分发的,因为它使用了一些Numerical Recipes例程。我一直想在R中重写这个核心(它只是简单的数值线性代数,它不会那么难)。在我看来,我可能不得不修改这个版本的许可证 - 我可能会说“GPL”但我不认为我实际上可以做到这一点,因为不可分发的组件......
  • the glmmADMB package uses freely redistributable source code (BSD license), but the toolchain is sufficiently complicated that I don't want users to have to download the entire supporting package
  • glmmADMB包使用可*再分发的源代码(BSD许可证),但工具链非常复杂,我不希望用户必须下载整个支持包

In both cases I put the binaries in inst/bin and possibly under architecture-specific subdirectories (which get installed in /bin) and use the appropriate logic to detect the architecture and run the correct binary.

在这两种情况下,我都将二进制文件放在inst / bin中,并且可能放在特定于体系结构的子目录下(它们安装在/ bin中),并使用适当的逻辑来检测体系结构并运行正确的二进制文件。

I guess in principle you could get around the inability to license via GPL by making the non-redistributable part into a download (as you suggest), but that would seem to violate the spirit ...

我想原则上你可以通过将不可再发行的部分变成下载(如你所说)来解决无法通过GPL许可的问题,但这似乎违反了精神......

#2


3  

The approach suggested by Ben Bolker is also used by the CRAN package "dismo" - to make the function maxent() work, you have to download the maxent java binary and place it into the appropriate subdirectory within the main package folder.

Ben Bolker建议的方法也被CRAN软件包“dismo”使用 - 为了使函数maxent()起作用,你必须下载maxent java二进制文件并将其放入主包文件夹中的相应子目录中。