[Rd] memory allocation problem under linux

2005-06-13 Thread [EMAIL PROTECTED]
I have some compiled code that works under winXp but not under linux (kernel
2.6.10-5). I'm also using R 2.1.0
After debugging, I've discovered that in this code:
  #define NMAX 256
  long **box;
  ...
  box   = (long **)R_alloc(NMAX,   sizeof(long *));   //<---HERE THE SIGSEGV
  for (i=0; ihttps://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] memory allocation problem under linux

2005-06-13 Thread [EMAIL PROTECTED]
Scrive Prof Brian Ripley :

> You keep on sending similar messages -- this is at least the third.  You 
> need to find out where the segfault is occurring using gdb, and you have 
> not told us.

Sorry for the repeated post (in 2 different mailing lists).
Tnx for your suggestion. Now I think I've found the problem. Try this:
file foo.c
#include 
int **box;
void foo(){
  int i;
  box =   (int**)R_alloc(1,   sizeof(int *));
}
/
Compiled with R CMD SHLIB foo.c
In R:
>dyn.load("foo.so")
>.C("foo")
*Segmentation fault*
The problem disappears when the declaration of 'box' comes inside the function
foo... Is this a bug?

Antonio, Fabio Di Narzo.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R-latest.tar.gz make error

2006-04-13 Thread [EMAIL PROTECTED]
Hello,


2006/4/13, Robin Hankin <[EMAIL PROTECTED]>:
> Hi.
>
>
> (MacOSX 10.4.6) I downloaded R-latest.tar.gz  just now from src/base-
> prerelease
> on CRAN.  "make" gave the following error after an apparently successful
> ./configure:
>
>
> [snip]
> util.c: In function 'Rf_type2char':
> util.c:247: warning: return discards qualifiers from pointer target type
> gcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/
> pcre  -no-cpp-precomp -I. -I../../src/include -I../../src/include -I/
> usr/local/include -DHAVE_CONFIG_H  -fPIC -fno-common  -g -O2 -
> std=gnu99 -c version.c -o version.o
> gcc -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/
> pcre  -no-cpp-precomp -I. -I../../src/include -I../../src/include -I/
> usr/local/include -DHAVE_CONFIG_H  -fPIC -fno-common  -g -O2 -
> std=gnu99 -c vfonts.c -o vfonts.o
> g77  -fPIC -fno-common  -g -O2 -c xxxpr.f -o xxxpr.o
> gcc -dynamiclib -L/usr/local/lib -dynamiclib -install_name libR.dylib
> -compatibility_version 2.3.0  -current_version 2.3.0  -
> headerpad_max_install_names -o libR.dylib Rembedded.o CConverters.o
> CommandLineArgs.o Rdynload.o Renviron.o RNG.o apply.o arithmetic.o
> apse.o array.o attrib.o base.o bind.o builtin.o character.o coerce.o
> colors.o complex.o connections.o context.o cov.o cum.o dcf.o
> datetime.o debug.o deparse.o deriv.o dotcode.o dounzip.o dstruct.o
> duplicate.o engine.o envir.o errors.o eval.o format.o fourier.o
> gevents.o gram.o gram-ex.o graphics.o identical.o internet.o
> iosupport.o lapack.o list.o localecharset.o logic.o main.o mapply.o
> match.o memory.o model.o names.o objects.o optim.o optimize.o
> options.o par.o paste.o pcre.o platform.o plot.o plot3d.o plotmath.o
> print.o printarray.o printvector.o printutils.o qsort.o random.o
> regex.o registration.o relop.o rlocale.o saveload.o scan.o seq.o
> serialize.o size.o sort.o source.o split.o sprintf.o startup.o
> subassign.o subscript.o subset.o summary.o sysutils.o unique.o util.o
> version.o vfonts.o xxxpr.o   `ls ../appl/*.o ../nmath/*.o ../unix/
> *.o  2>/dev/null` -framework vecLib -L/usr/local/lib/gcc/powerpc-
> apple-darwin7.9.0/3.4.4 -lg2c -lgcc_s -lSystem  ../extra/zlib/
> libz.a ../extra/bzip2/libbz2.a ../extra/pcre/libpcre.a  ../extra/intl/
> libintl.a  -Wl,-framework -Wl,CoreFoundation -lreadline  -lm -liconv
> ld: warning multiple definitions of symbol _xerbla_
> print.o definition of _xerbla_ in section (__TEXT,__text)
> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/
> vecLib.framework/Versions/A/libBLAS.dylib(single module) definition
> of _xerbla_
> ld: Undefined symbols:
> restFP
> saveFP
> /usr/bin/libtool: internal link edit command failed
> make[3]: *** [libR.dylib] Error 1
> make[2]: *** [R] Error 2
> make[1]: *** [R] Error 1
> make: *** [R] Error 1
> 238-250:~/scratch/R-beta%


A similar error message can be found here:

http://www.mail-archive.com/r-sig-mac@stat.math.ethz.ch/msg00476.html

Does this help to solve your problem?

TS

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] bug: code not working as expected (PR#8783)

2006-04-20 Thread [EMAIL PROTECTED]
Hi Nicolai,


2006/4/20, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> This is a multi-part message in MIME format.
> --020909040800030906040005
> Content-Type: text/plain; charset=KOI8-R; format=flowed
> Content-Transfer-Encoding: 7bit
>
> Hi,
>
> I've attached two files with the sources for a function to implement the
> finite difference method for solving a particular differential equation.
>
> One of them works correctly, the other gives wrong results or returns an
> error, depending on the version of R.
>
> The difference between them is that in the 'broken' version in line 42 I
> check if the items in the two-dimensional array are bigger than a
> certain value, and in the working one I do it in a separate loop.


diff working.r broken.r

also reveals that your expression is differently bracketed


broken.txt says in line 42:

 (...) = (X-(j-1)*dS);

working.txt:

(...) = X-(j-1)*dS;

Don't know what the rationale of this difference really is since I'm
no expert for finite difference methods.
But your examples apparently don't only differ in terms of checking
the size of your array-values.

Does this matter?

Thomas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel