From cstrato at aon.at  Sat Sep 19 00:12:12 2009
From: cstrato at aon.at (cstrato)
Date: Sat, 19 Sep 2009 00:12:12 +0200
Subject: [Rd] Package crashes R under Windows Vista
Message-ID: <4AB405BC.7020903@aon.at>

Dear all,

Please, please I really need your help, since I am not able to solve the 
problem myself:
It seems that until now most Windows users of my Bioconductor package 
"xps" use Windows XP, but recently a user tried to use it on Windows 
Vista where it crashed R immediately. Since I assume that some users may 
migrate to the upcoming Windows 7 where the problem will be the same, I 
would appreciate any help to be able to support Vista/Windows 7, thank 
you in advance.

The problem ist that my package consists mainly of C++ code which I must 
compile with Visual C++ (Express Edition 2008), since it depends on the 
ROOT C++ framework. Windows users download and install first the ROOT 
Windows binary compiled with VC9 and then install the Windows binary of xps.

Thus package xps contains a "Makefile.win" where I use one of the 
compiler options "/MT" or "/MD", respectively, see: 
http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

Since the Windows binary of ROOT is compiled with option "/MD" I should 
in principle use this option, however, R does not accept this option. 
Luckily, for Winodws XP I can compile xps with "/MT" and this works 
perfectly fine.

The real problem is that neither option works on Windows Vista, although 
I can run "R CMD INSTALL" in both cases. However, when loading 
"library(xps)" using Rterm.exe I get the following two cases:

1, xps compiled on Vista with option "/MD":
   new R session:
   > library(xps,lib.loc="C:/home/Rabbitus/CRAN/myRlib")
   Error in inDL(x, as.logical(local), as.logical(now), ...) :
     cannot load shared library 'C:/home/CS/CRAN/myRlib/xps/libs/xps.dll':
    LoadLibrary failure:  A DLL-Initialisationroutine failed.

Then R crashes and Vista displays a Dialogbox with the following message:
R for Windows terminal front-end does no longer function
  Anwendungszeitstempel:    4a928a5c
  Fehlermodulname:    libCore.dll_unloaded
  Fehlermodulversion:    0.0.0.0
  Fehlermodulzeitstempel:    4a4b94a1
  Ausnahmecode:    c0000005
  Ausnahmeoffset:    0413a6f0
  Betriebsystemversion:    6.0.6001.2.1.0.768.3
  Gebietsschema-ID:    1031
  Zusatzinformation 1:    b2be
  Zusatzinformation 2:    82109204b3973566ace818217390e302
  Zusatzinformation 3:    1563
  Zusatzinformation 4:    deee40b8797d25628c21b9ef47e8a50c

2, xps compiled on Vista with option "/MT":
   new R session:
   > library(xps,lib.loc="C:/home/CS/CRAN/myRlib")
   > scheme.test3 <- 
root.scheme(paste(.path.package("xps"),"schemes/SchemeTest3.root",sep="/"))
   > data.test3 <- import.data(scheme.test3, "DataTest3", 
celdir=paste(.path.package("xps"),"raw",sep="/"))

   ==========================================
   =============== STACKTRACE ===============
   ==========================================


   ==========================================
   ============= END STACKTRACE =============
   ==========================================

Then R crashes and Vista displays a Dialogbox with the following message:
R for Windows terminal front-end does no longer function
Problemsignatur:
  Problemereignisname:    APPCRASH
  Anwendungsname:    Rterm.exe
  Anwendungsversion:    2.92.49384.0
  Anwendungszeitstempel:    4a928a5c
  Fehlermodulname:    ntdll.dll
  Fehlermodulversion:    6.0.6001.18000
  Fehlermodulzeitstempel:    4791a7a6
  Ausnahmecode:    c0000005
  Ausnahmeoffset:    0006814c
  Betriebsystemversion:    6.0.6001.2.1.0.768.3
  Gebietsschema-ID:    1031
  Zusatzinformation 1:    92ec
  Zusatzinformation 2:    c556221fb8ba46fdaae5867fc20d6575
  Zusatzinformation 3:    c65f
  Zusatzinformation 4:    9d4dfe391e0e922aa627634d4d47a122


Here is the same information for Windows XP:

1, xps compiled on WinXP with option "/MD":
   new R session:
   > library(xps,lib.loc="C:/home/CS/CRAN/myRlib")

R crashes and the following Dialogbox from "Microsoft Visual C++ Runtime 
Library" is displayed:
   Runtime Error!
   Program: c:\Programme\R\R-2.9.0\bin\Rterm.exe
   R6034
   An application has made an attempt to load the C runtime library 
incorrectly.
   Please contact the application's support team for more  information.

2, xps compiled on WinXP with option "/MT":
   new R session:
   > library(xps,lib.loc="C:/home/CS/CRAN/myRlib")
Luckily, R runs w/o any  problems and this is the setting of the current 
Windows binary of "xps".

In summary, on WinXP package xps must be compiled with option "/MT" to 
be used with R.

In contrast, on Vista library(xps) does not work when compiled with 
either option:
- for option "/MT" library(xps) can be loaded but crashes R with 
"Errormodulename: "ntdll.dll"
- for option "/MD" library(xps) cannot be loaded, since the ROOT library 
"libCore.dll" cannot be loaded ("Errormodulename: "libCore.dll_unloaded")

It is important to note that on both WinXP AND Vista library "xps.dll" 
compiled with option "/MD" does work perfectly fine when running from 
within ROOT!

Please, can anybody tell me why Rterm on Vista crashes when running 
library(xps)?
It seems that for option "/MD" Rterm is not able to load the ROOT core 
library "libCore.dll", why?

Any help is greatly appreciated otherwise my package "xps" will not be 
able to run on Vista and more important, Windows 7.

Thank you in advance.
Best regards
Christian
_._._._._._._._._._._._._._._._._._
C.h.r.i.s.t.i.a.n   S.t.r.a.t.o.w.a
V.i.e.n.n.a           A.u.s.t.r.i.a
e.m.a.i.l:        cstrato at aon.at
_._._._._._._._._._._._._._._._._._



[Rd] Package crashes R under Windows Vista
cstrato