В Fri, 22 Aug 2025 16:05:31 +0200
quirin stier <quirin_st...@gmx.de> пишет:

> Hi everyone,
> 
> building an R package following the work of Simon Urbanek 
> (https://github.com/s-u/OpenCL and 
> https://cran.r-project.org/web/packages/OpenCL/index.html) still
> yields the error from CRAN about environmental variables required for
> linking.

In theory, copying the OpenCL approach should have been enough (most
Windows users would get the binaries from CRAN and not worry about
environment variables), except (as you point out) OpenCL is not
currently built on Win-Builder for R-release and R-devel (only R-oldrel
works). I think you need to ask Uwe Ligges to help set up the OpenCL
SDK for R-release and R-devel the same way it's set up for R-oldrel.
But there might be a better solution:

> Could you please tell me more about the procedure (or possible 
> formalities with CRAN) how to submit an R package using OpenCL
> headers?

Since a free software (Apache-2.0) OpenCL SDK exists [1], it could be
made part of Rtools, which is the recommended approach for non-trivial
third-party dependencies [2]. It's already packaged in MSYS2 [3], but
not in MXE. I think the best way forward is to write an MXE Makefile
[4] to produce a package with the OpenCL headers, the import library,
and the ICD loader.

There is one complication: unlike most third-party dependencies in
Rtools, OpenCL must be dynamically linked. This probably means
packaging OpenCL.dll and putting it on the %PATH% (so that R packages
can be built and loaded even on systems without a real OpenCL ICD).
Hopefully this won't cause any conflicts with the system OpenCL.dll
(all it needs to do is export a standard set of functions and look for
ICDs in standard locations).

Someone even started that work back in 2017 [5], but didn't complete
it. Try contacting the people who worked the GitHub pull request, see
if they need any help. When MXE accepts the patch, or if you get stuck,
ask Tomas Kalibera about including the two packages in Rtools.

-- 
Best regards,
Ivan

[1]
https://github.com/KhronosGroup/OpenCL-ICD-Loader
https://github.com/KhronosGroup/OpenCL-Headers

[2]
https://cran.r-project.org/web/packages/external_libs.html#Windows

[3]
https://packages.msys2.org/base/mingw-w64-opencl-headers
https://packages.msys2.org/base/mingw-w64-opencl-icd

[4]
https://mxe.cc/#creating-packages

[5]
https://github.com/mxe/mxe/pull/1938

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to