rwinlib / gcc-4.9.3

Building R for Windows with the new gcc 4.9.3 toolchain
28 stars 7 forks source link

use <regex> <locale> make pakckage fail to be loaded on 64bit Windows R EXPERIMENTAL #2

Open qinwf opened 8 years ago

qinwf commented 8 years ago

I have made a small package to replicate this issue. https://github.com/qinwf/testlocale .

For 32bit R it works fine. This function will remove punctuation in Chinese locale using c++11 regex with wstring.

library(testlocale)
rcpp_hello(c("test","你好","。",";","】","]"))
#[1] "test" "你好"

> sessionInfo()
R version 3.3.0 EXPERIMENTAL (2015-09-22 r69418)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] Chinese (Simplified)_China.936

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

other attached packages:
[1] testlocale_0.1

loaded via a namespace (and not attached):
[1] tools_3.3.0 Rcpp_0.12.1

For 64bit R.

> library(testlocale)
> rcpp_hello(c("test","你好","。",";","】","]"))
Error in .Call("testlocale_rcpp_hello", PACKAGE = "testlocale", x) : 
  "testlocale_rcpp_hello" not available for .Call() for package "testlocale"

> sessionInfo()
R version 3.3.0 EXPERIMENTAL (2015-09-22 r69418)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 
[2] LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

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

other attached packages:
[1] testlocale_0.1

loaded via a namespace (and not attached):
[1] tools_3.3.0 Rcpp_0.12.1
qinwf commented 8 years ago

There is another package, which has some similar functions, will fail to be installed on 64bit R and it will work on 32bit R.

..... all fine
C:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o jiebaR.dll tmp.def RcppExports.o detect.o init.o segtype.o word_freq.o -LC:/Rbuild/R-devel-win32/extsoft/lib/i386 -LC:/Rbuild/R-devel-win32/extsoft/lib -LC:/PROGRA~1/R/R-EXPE~1/bin/i386 -lR
installing to D:/git/jiebaR.Rcheck/jiebaR/libs/i386

.... all fine
C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o jiebaR.dll tmp.def RcppExports.o detect.o init.o segtype.o word_freq.o -LC:/Rbuild/R-devel-win64/extsoft/lib/x64 -LC:/Rbuild/R-devel-win64/extsoft/lib -LC:/PROGRA~1/R/R-EXPE~1/bin/x64 -lR

collect2.exe: error: ld returned 5 exit status

installing to D:/git/jiebaR.Rcheck/jiebaR/libs/x64
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  无法载入共享目标对象 (unable to load shared object) ‘D:/git/jiebaR.Rcheck/jiebaR/libs/x64/jiebaR.dll’::
  LoadLibrary failure:  %1 不是有效的 Win32 应用程序。(is not an valid Win32 application.)

错误: 载入失败
停止执行
ERROR: loading failed for 'x64'
* removing 'D:/git/jiebaR.Rcheck/jiebaR'