[R-pkg-devel] Windows R 4.2.0 package will not load with UTF-8 encoding

Joseph Park jo@ephp@rk @end|ng |rom |eee@org
Sat Jun 11 11:02:23 CEST 2022


Dear R package developers,

Starting with R 4.2.0 package rEDM (https://cran.r-project.org/package=rEDM)
will not load [library( rEDM )] on Windows with the default UTF-8 encoding.

When the locale is changed from UTF-8 to non UTF-8, the package loads and
runs. One can also change the locale to non-UTF-8, load the package, detach
and unload the package, change the locale back to UTF-8, then load and run
without issue.

Note that installation from source reports:
   ** testing if installed package can be loaded from temporary location
and completes (record below).

This package uses Rcpp to wrap a C++ API.

Having searched here and in general, I don't find that others experiencing
this issue.

I have tried
  Ensure all source files are UTF-8 encoded
  Removed non-ASCII characters from all source files
  Specify non-ASCII characters with \uXXXX
  Checked vignette encoding
  Added "Encoding : UTF-8" to DESCRIPTION

Please excuse my encoding and Windows naivety.

Here is a demonstration changing the encoding to load the package, along
with unloading & reloading under UTF-8:
--
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United
States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C

[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.2.0
>
> Sys.setlocale('LC_ALL','English')
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
Warning message:
In Sys.setlocale("LC_ALL", "English") :
  using locale code page other than 65001 ("UTF-8") may cause problems
>
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252
system code page: 65001

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.2.0
>
> library( rEDM )
>
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252
system code page: 65001

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] rEDM_1.12.2.1.0

loaded via a namespace (and not attached):
[1] compiler_4.2.0 Rcpp_1.0.8.3
>

### All package tests pass....
### Now detach and unload, change to UTF-8, and load

> detach( 'package:rEDM', unload = TRUE )
>
> Simplex( dataFrame = Lorenz5D, columns = 'V1', target = 'V2', lib = "1
500", pred = "501 505", E = 5 )
Error in Simplex(dataFrame = Lorenz5D, columns = "V1", target = "V2",  :
  could not find function "Simplex"

> Sys.setlocale()
[1] "LC_COLLATE=English_United States.utf8;LC_CTYPE=English_United
States.utf8;LC_MONETARY=English_United
States.utf8;LC_NUMERIC=C;LC_TIME=English_United States.utf8"
>
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United
States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C

[5] LC_TIME=English_United States.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] devtools_2.4.3 usethis_2.1.6

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3      magrittr_2.0.3    pkgload_1.2.4     R6_2.5.1
 rlang_1.0.2       fastmap_1.1.0
 [7] fansi_1.0.3       tools_4.2.0       pkgbuild_1.3.1
 sessioninfo_1.2.2 utf8_1.2.2        cli_3.3.0
[13] withr_2.5.0       ellipsis_0.3.2    remotes_2.4.2     rprojroot_2.0.3
  tibble_3.1.7      lifecycle_1.0.1
[19] crayon_1.5.1      brio_1.1.3        processx_3.6.0    purrr_0.3.4
  callr_3.7.0       vctrs_0.4.1
[25] fs_1.5.2          ps_1.7.0          testthat_3.1.4    memoise_2.0.1
  glue_1.6.2        cachem_1.0.6
[31] pillar_1.7.0      compiler_4.2.0    desc_1.4.1
 prettyunits_1.1.1 pkgconfig_2.0.3
>
>
> library( rEDM )

### All tests pass


-- 
Installation log:
> devtools::install()
   checking for file 'C:\Users\\rEDM/DESCRIPTION' ...
   checking for file 'C:\Users\\rEDM/DESCRIPTION' ...
✔  checking for file 'C:\Users\\rEDM/DESCRIPTION' (1.8s)
─  preparing 'rEDM': (853ms)
   checking DESCRIPTION meta-information ...
✔  checking DESCRIPTION meta-information
─  cleaning src

─  building 'rEDM_1.12.2.1.0.tar.gz'

Running "C:/Apps/R/R-4.2.0/bin/x64/Rcmd.exe" INSTALL \
  "C:\Users\AppData\Local\Temp\RtmpcdP2Nx/rEDM_1.12.2.1.0.tar.gz"
--install-tests
* installing to library 'C:/Apps/R/R-4.2.0/library'
* installing *source* package 'rEDM' ...
** using staged installation
** libs

g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c CCM.cpp -o CCM.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c ComputeError.cpp -o ComputeError.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c DataFrame.cpp -o DataFrame.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c Embed.cpp -o Embed.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c EmbedDim.cpp -o EmbedDim.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c Multiview.cpp -o Multiview.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c ParameterList.cpp -o ParameterList.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c PredictInterval.cpp -o
PredictInterval.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c PredictNL.cpp -o PredictNL.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c RcppEDMCommon.cpp -o RcppEDMCommon.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c RcppExports.cpp -o RcppExports.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c SMap.cpp -o SMap.o
g++  -std=gnu++11 -I"C:/Apps/R/R-4.2.0/include" -DNDEBUG -I./cppEDM/src
-I../ -I'C:/Apps/R/R-4.2.0/library/Rcpp/include'
-I'C:/Apps/R/R-4.2.0/library/RcppThread/include'
-I"C:/Apps/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall
 -mfpmath=sse -msse2 -mstackrealign  -c Simplex.cpp -o Simplex.o
make[1]: Entering directory
'/c/Users/jpark/AppData/Local/Temp/Rtmp0UDIkt/R.INSTALL2d3c6fa91a0b/rEDM/src/cppEDM/src'
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c API.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c CCM.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
Common.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
DateTime.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c EDM.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
EDM_Formatting.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
EDM_Neighbors.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c Eval.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
Multiview.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
Parameter.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c
Simplex.cc
gcc  -std=c++11 -DCCM_THREADED -DMULTIVIEW_VALUES_OVERLOAD -I../  -c SMap.cc
ar -rcs libEDM.a API.o CCM.o Common.o DateTime.o EDM.o EDM_Formatting.o
EDM_Neighbors.o Eval.o Multiview.o Parameter.o Simplex.o SMap.o
cp libEDM.a ../lib/
make[1]: Leaving directory
'/c/Users//AppData/Local/Temp/Rtmp0UDIkt/R.INSTALL2d3c6fa91a0b/rEDM/src/cppEDM/src'
g++ -shared -s -static-libgcc -o rEDM.dll tmp.def CCM.o ComputeError.o
DataFrame.o Embed.o EmbedDim.o Multiview.o ParameterList.o
PredictInterval.o PredictNL.o RcppEDMCommon.o RcppExports.o SMap.o
Simplex.o -L./cppEDM/src/ -lEDM -LC:/Apps/R/R-4.2.0/bin/x64 -lRlapack
-LC:/Apps/rtools42/x86_64-w64-mingw32.static.posix/lib/x64
-LC:/Apps/rtools42/x86_64-w64-mingw32.static.posix/lib
-LC:/Apps/R/R-4.2.0/bin/x64 -lR
installing to C:/Apps/R/R-4.2.0/library/00LOCK-rEDM/00new/rEDM/libs/x64

** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation
path
* DONE (rEDM)

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list