ghci byte compiler + FFI crashes when used with embedded R
The ghci interpreter destroys the C stack when initializing embedded R (the statistical software system available at http://cran.r-project.org/). There is no problem using embedded R with ghc (compiled code). I have had no problems using ghci with other FFI projects, and this does not appear to be a linking problem (there are no undefined references).
To reproduce the problem (under Fedora Linux using ghc 7.6.3) download the R source code, unpack, and (using haskellRtest.hs is attached):
- cd R-3.0.2
- ./configure --enable-R-shlib
- make
- make install
- cd <haskelltestdir>
- ghci -L/usr/local/lib64/R/lib -lR haskellRtest.hs
- Main> main
Loading... Initialize R session... Error: C stack usage is too close to the limit
Notes:
- No computations are done, the failure happens during startup.
- The C functions called are in <R source>/src/unix/Rembedded.c
- The error message is issued from <R source>/src/main/errors.c
- I tried increasing the system level C stack size limit but this didn't help.
- As noted above, there are no problems when ghc is used.
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | hvr |
Operating system | |
Architecture |