[R-pkg-devel] cmake, Windows

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Mon Mar 7 10:45:30 CET 2022


On 3/6/22 21:46, Simon Urbanek wrote:
> BTW: one option I forgot to mention would be to add SWI-Prolog to the toolchain instead so you don't need to build it. However, I don't know how tied you are to the development branch that you're using. There is also the official SWI release Windows binary which may be another option, but I didn't look at the details if that fits your bill. I would suggest setting up the UCRT environment locally and testing the different options so you can decide which is the best path forward.

Right, primarily the package should use an existing installation of SWI 
Prolog in the system. This is also required by the CRAN repository 
policy, see "Using external C/C++/Fortran libraries.").

So if SWI Prolog official release for Windows has the necessary headers 
and DLLs, your R package could link to them. One example of R package 
doing this is rjags, dynamically linking to JAGS (though when there is a 
plain C interface, it is preferable as it is easier to maintain, see 
WRE). This would be the simplest option and you could use dynamically 
linked SWI Prolog.

Adding a complete language runtime into an R package feels a bit odd to 
me, but in principle is possible. If Rtools42 libraries included a 
static library of SWI Prolog, your package could link to that. Rtools42 
doesn't include it, but in principle it could be added (Rtools42 
libraries themselves are built on Linux and indeed cmake is available 
there, some of those use it), I could help with that. This wouldn't work 
well if you needed to use dynamic linking.

Building SWI Prolog from source included in the R package should not be 
needed and it won't be any easier than adding it to Rtools42. Rtools42 
currently doesn't have cmake ready for use (adding it is trivial via 
pacman, but some work and documentation would be needed to make it find 
the libraries).

Best
Tomas

>
> Cheers,
> Simon
>
>
>> On Mar 7, 2022, at 9:05 AM, Simon Urbanek <simon.urbanek using R-project.org> wrote:
>>
>> Matthias,
>>
>> that, that is helpful. So we are talking about UCRT here. The toolchain from https://github.com/kalibera/ucrt3 appears to not include the cmake binary. I suspect the reason is that since it is based on MXE, the cmake binary used for the toolchain is native (Linux) and not the Windows binary. I think there are two options: either use the CMake officially released binary or have the toolchain supply cmake.exe. I'd defer to Tomas who is maintaining the UCRT toolchain to advise which is the better option.
>>
>> Cheers,
>> Simon
>>
>>
>>
>>> On Mar 6, 2022, at 12:37 PM, matthias-gondan <matthias-gondan using gmx.de> wrote:
>>>
>>> Thanks Simon,
>>>
>>> I'll remove the paths and report the results. I'll also check Dirks suggestion (the other response).
>>>
>>> For what it's worth, the error message was simply "cmake not found"; when I added the path it was "/ucrt64/bin/cmake not found"
>>>
>>> https://win-builder.r-project.org/incoming_pretest/rolog_0.9_20220305_172741/Windows/00install.out
>>>
>>> Best wishes,
>>>
>>> Matthias
>>>
>>> -------- Ursprüngliche Nachricht --------
>>> Von: Simon Urbanek <simon.urbanek using R-project.org>
>>> Datum: 05.03.22 23:19 (GMT+01:00)
>>> An: matthias-gondan <matthias-gondan using gmx.de>
>>> Cc: r-package-devel using r-project.org
>>> Betreff: Re: [R-pkg-devel] cmake, Windows
>>>
>>> Matthias,
>>>
>>> You didn't supply any output, so we can only guess. From what I can see in your package you are hard-coding incorrect paths to compilers and tools in your Makevars.{win|ucrt}. Please make sure you use R's compilers - never hard-code paths to tools, you need to use R's settings since the toolchain can be installed in any location.
>>>
>>> Cheers,
>>> Simon
>>>
>>>
>>>> On Mar 6, 2022, at 6:17 AM, matthias-gondan <matthias-gondan using gmx.de> wrote:
>>>>
>>>> Dear package developers, I have submitted a source package to CRAN, and it is rejected because installation fails on Windows.https://github.com/mgondan/rologThe compilation needs cmake, which is available on RTools4+.Is there any chance that cmake is included on the build system? If not, does anyone know a good solution for this problem?Best regards,Matthias
>>>> [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-package-devel using r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list