Jan.Kleinn at partnerre.com
2007-Mar-28 14:10 UTC
[R] changes in behaviour of Rcmd SHLIB since 2.4.0
Dear all, I have some C code using the zlib uncompress. It compiles fine under Win XP (with SP2) with R up to 2.3.1 and generates four files (Makedeps, *.d, *.dll, and *.o): C:\Data\R-packages\cmg>rcmd SHLIB cmg.c -o cmg.dll latex: not found making cmg.d from cmg.c gcc -IC:/PROGRA~1/R/R-2.3.1/include -Wall -O2 -c cmg.c -o cmg.o cmg.c: In function `readcmg': cmg.c:33: warning: assignment from incompatible pointer type cmg.c:40: warning: assignment from incompatible pointer type cmg.c:50: warning: assignment from incompatible pointer type gcc -shared -s -o cmg.dll cmg.def cmg.o -LC:/PROGRA~1/R/R-2.3.1/bin -lR With R 2.4.0 and later, the compilation fails at the linking, so the four files generated are Makedeps, *.d, *.def, and *.o: C:\Data\R-packages\cmg>rcmd SHLIB cmg.c -o cmg.dll latex: not found making cmg.d from cmg.c gcc -IC:/PROGRA~1/R/R-2.4.1/include -Wall -O2 -std=gnu99 -c cmg.c -o cmg.o cmg.c: In function `readcmg': cmg.c:33: warning: assignment from incompatible pointer type cmg.c:40: warning: assignment from incompatible pointer type cmg.c:50: warning: assignment from incompatible pointer type gcc -shared -s -o cmg.dll cmg.def cmg.o -LC:/PROGRA~1/R/R-2.4.1/bin -lR cmg.o:cmg.c:(.text+0xc0): undefined reference to `uncompress' collect2: ld returned 1 exit status make: *** [cmg.dll] Error 1 I have seen the page by Duncan Murdoch (http://www.murdoch-sutherland.com/Rtools/), that since 2.4.0 you need MinGW runtime 3.11 or higher, so I reinstalled the whole MinGW (runtime now 3.11, gcc core and C++ compiler now 3.4.5) and ActivePerl (now 5.8.8. build 820) but the problem persists. Any ideas or hints on how I could compile my C code with the current version of R are highly welcome. Many thanks in advance and best regards, Jan DISCLAIMER: This e-mail contains information solely intended...{{dropped}}
Since R-2.4.0 less symbols are exported from R.dll. Uwe Ligges Jan.Kleinn at partnerre.com wrote:> Dear all, > > I have some C code using the zlib uncompress. It compiles fine under Win XP > (with SP2) with R up to 2.3.1 and generates four files (Makedeps, *.d, > *.dll, and *.o): > > C:\Data\R-packages\cmg>rcmd SHLIB cmg.c -o cmg.dll > latex: not found > making cmg.d from cmg.c > gcc -IC:/PROGRA~1/R/R-2.3.1/include -Wall -O2 -c cmg.c -o cmg.o > cmg.c: In function `readcmg': > cmg.c:33: warning: assignment from incompatible pointer type > cmg.c:40: warning: assignment from incompatible pointer type > cmg.c:50: warning: assignment from incompatible pointer type > gcc -shared -s -o cmg.dll cmg.def cmg.o -LC:/PROGRA~1/R/R-2.3.1/bin > -lR > > With R 2.4.0 and later, the compilation fails at the linking, so the four > files generated are Makedeps, *.d, *.def, and *.o: > > C:\Data\R-packages\cmg>rcmd SHLIB cmg.c -o cmg.dll > latex: not found > making cmg.d from cmg.c > gcc -IC:/PROGRA~1/R/R-2.4.1/include -Wall -O2 -std=gnu99 -c cmg.c -o > cmg.o > cmg.c: In function `readcmg': > cmg.c:33: warning: assignment from incompatible pointer type > cmg.c:40: warning: assignment from incompatible pointer type > cmg.c:50: warning: assignment from incompatible pointer type > gcc -shared -s -o cmg.dll cmg.def cmg.o -LC:/PROGRA~1/R/R-2.4.1/bin > -lR > cmg.o:cmg.c:(.text+0xc0): undefined reference to `uncompress' > collect2: ld returned 1 exit status > make: *** [cmg.dll] Error 1 > > I have seen the page by Duncan Murdoch > (http://www.murdoch-sutherland.com/Rtools/), that since 2.4.0 you need > MinGW runtime 3.11 or higher, so I reinstalled the whole MinGW (runtime now > 3.11, gcc core and C++ compiler now 3.4.5) and ActivePerl (now 5.8.8. build > 820) but the problem persists. > > Any ideas or hints on how I could compile my C code with the current > version of R are highly welcome. > > Many thanks in advance and best regards, Jan > > > > DISCLAIMER: This e-mail contains information solely intended...{{dropped}} > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Prof Brian Ripley
2007-Mar-28 14:46 UTC
[R] changes in behaviour of Rcmd SHLIB since 2.4.0
On Wed, 28 Mar 2007, Jan.Kleinn at partnerre.com wrote:> > Dear all, > > I have some C code using the zlib uncompress. It compiles fine under Win XP > (with SP2) with R up to 2.3.1 and generates four files (Makedeps, *.d, > *.dll, and *.o):No one every said that zlib interface would be exported from R, and as from R 2.4.0 it is not on those platforms where exports can be controlled. `Wrting R Extensions' has always warned you about making use of entry points not in the API, so this should have come as no surprise to you, and CHANGES for 2.4.0 said Entry points which are hidden in libR.so on Unix are now also hidden in R.dll. (Just over half the entry points are hidden, which speeds up loading.) Please use the appropriate list for programming questions (as documented in the R posting guide).> C:\Data\R-packages\cmg>rcmd SHLIB cmg.c -o cmg.dll > latex: not found > making cmg.d from cmg.c > gcc -IC:/PROGRA~1/R/R-2.3.1/include -Wall -O2 -c cmg.c -o cmg.o > cmg.c: In function `readcmg': > cmg.c:33: warning: assignment from incompatible pointer type > cmg.c:40: warning: assignment from incompatible pointer type > cmg.c:50: warning: assignment from incompatible pointer type > gcc -shared -s -o cmg.dll cmg.def cmg.o -LC:/PROGRA~1/R/R-2.3.1/bin > -lR > > With R 2.4.0 and later, the compilation fails at the linking, so the four > files generated are Makedeps, *.d, *.def, and *.o: > > C:\Data\R-packages\cmg>rcmd SHLIB cmg.c -o cmg.dll > latex: not found > making cmg.d from cmg.c > gcc -IC:/PROGRA~1/R/R-2.4.1/include -Wall -O2 -std=gnu99 -c cmg.c -o > cmg.o > cmg.c: In function `readcmg': > cmg.c:33: warning: assignment from incompatible pointer type > cmg.c:40: warning: assignment from incompatible pointer type > cmg.c:50: warning: assignment from incompatible pointer type > gcc -shared -s -o cmg.dll cmg.def cmg.o -LC:/PROGRA~1/R/R-2.4.1/bin > -lR > cmg.o:cmg.c:(.text+0xc0): undefined reference to `uncompress' > collect2: ld returned 1 exit status > make: *** [cmg.dll] Error 1 > > I have seen the page by Duncan Murdoch > (http://www.murdoch-sutherland.com/Rtools/), that since 2.4.0 you need > MinGW runtime 3.11 or higher, so I reinstalled the whole MinGW (runtime now > 3.11, gcc core and C++ compiler now 3.4.5) and ActivePerl (now 5.8.8. build > 820) but the problem persists. > > Any ideas or hints on how I could compile my C code with the current > version of R are highly welcome. > > Many thanks in advance and best regards, Jan > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595