From tom@@@k@||ber@ @end|ng |rom gm@||@com  Wed Apr 14 08:34:19 2021
From: tom@@@k@||ber@ @end|ng |rom gm@||@com (Tomas Kalibera)
Date: Wed, 14 Apr 2021 08:34:19 +0200
Subject: [Rd] R CMD check fails with: During startup - Warning message:
 Setting LC_CTYPE=en_US.UTF-8 failed
In-Reply-To: <CAAjnpdgw9z9ihiwefoxPy13t8Tp4DLisuD4dCc0kqHFGxVBOBw@mail.gmail.com>
References: <CAAjnpdgw9z9ihiwefoxPy13t8Tp4DLisuD4dCc0kqHFGxVBOBw@mail.gmail.com>
Message-ID: <44ea5485-3979-c7f6-b48e-81518740c7d4@gmail.com>

On 4/13/21 4:36 PM, Witold E Wolski wrote:
> Hello,
>
> I am trying to run a package check on windows 10.
> But it fails with the following errors:
>
> ```
> $ R CMD check prolfqua_0.1.5.3.tar.gz
> During startup - Warning message:
> Setting LC_CTYPE=en_US.UTF-8 failed
> * using log directory 'C:/Users/wewol/__checkout/prolfqua.Rcheck'
> * using R version 4.0.3 (2020-10-10)
> * using platform: x86_64-w64-mingw32 (64-bit)
> * using session charset: ASCII
> ....
> * checking DESCRIPTION meta-information ... WARNING
> During startup - Warning message:
> Setting LC_CTYPE=en_US.UTF-8 failed
>   ERROR
> During startup - Warning message:
> Setting LC_CTYPE=en_US.UTF-8 failed
> * DONE
>
> Status: 1 ERROR, 1 WARNING, 3 NOTEs
> See
>    'C:/Users/wewol/__checkout/prolfqua.Rcheck/00check.log'
> for details.
> ```
>
> I am puzzled. I did a web search but all I found is:
> https://stackoverflow.com/questions/54102869/during-startup-warning-message-setting-lc-ctype-failed-on-windows
>
> I am reluctant to use .Rprofiles because otherwise, my R installation
> works just fine.

I'd just clear the content of LC_CTYPE and LC_ALL before running R (so 
also before installing packages, building packages, checking packages). 
I suppose you are running the checks from Msys2/bash (or cygwin or 
similar), which by default sets LC_CTYPE to this value.

The problem is that R cannot set the current encoding to UTF-8, because 
it is built against MSVCRT. You can set UTF-8 as the current encoding in 
the (experimental) UCRT build of R. But even there, it is better to run 
package checks with the variables cleared/not set, unless your intention 
is to debug the checks to work in different encodings.

Best
Tomas


>
> Best regards
> Witek
>
>



[Rd] R CMD check fails with: During startup - Warning message: Setting LC_CTYPE=en_US.UTF-8 failed
Tomas Kalibera