R 3.1.2
Windows 7
Colleagues
I am working with c code that reads sas7bdat files into R. I have been
successful in compiling and running the code in both OS X and Windows.
Recently, the author of the c code added code that calls iconv.h (in order to
convert encodings). Using the new version of the c code, I can run compile and
run the code in OS X without problems. However, when I run the code in Windows,
I encounter a series of warnings, followed by what appear to be errors ? and the
code is not compiled.
I have installed the latest version of Rtools and I have set the path as
follows:
set PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\program files
(c86)\gnuwin32\bin;c:\MiKTeX\miktex\bin;%R32%;c:\windows;c:\windows\system32
where R32 is the path to the 32-but version of R
The command that I execute is:
R CMD SHLIB -o ../compiled/Windows32.so ConvertSAS.c CKHashTable.c
readstat_convert.c readstat_bits.c readstat_io.c readstat_sas.c)
I get a series of warnings:> gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall
-std=gnu99 -mtune=core2 -c ConvertSAS.c -o ConvertSAS.o
> gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall
-std=gnu99 -mtune=core2 -c CKHashTable.c -o CKHashTable.o
> gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall
-std=gnu99 -mtune=core2 -c readstat_convert.c -o readstat_convert.o
> readstat_convert.c: In function 'readstat_convert':
> readstat_convert.c:23:9: warning: passing argument 2 of 'libiconv'
from incompatible pointer type [enabled by default]
> iconv.h:92:37: note: expected 'const char **' but argument is of
type 'char **'
> gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall
-std=gnu99 -mtune=core2 -c readstat_bits.c -o readstat_bits.o
> readstat_bits.c: In function 'byteswap_float':
> readstat_bits.c:59:5: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
> readstat_bits.c:60:5: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
> readstat_bits.c: In function 'byteswap_double':
> readstat_bits.c:64:5: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
> readstat_bits.c:65:5: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
> gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall
-std=gnu99 -mtune=core2 -c readstat_io.c -o readstat_io.o
> gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
-I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall
-std=gnu99 -mtune=core2 -c readstat_sas.c -o readstat_sas.o
> readstat_sas.c: In function 'sas_read_header':
> readstat_sas.c:204:20: warning: variable 'a2' set but not used
[-Wunused-but-set-variable]
> readstat_sas.c: In function 'sas_parse_page_pass1':
> readstat_sas.c:788:23: warning: variable 'subheader_type' set but
not used [-Wunused-but-set-variable]
> readstat_sas.c:770:14: warning: variable 'page_type' set but not
used [-Wunused-but-set-variable]
> readstat_sas.c: In function 'sas_parse_page_pass2':
> readstat_sas.c:861:27: warning: variable 'subheader_type' set but
not used [-Wunused-but-set-variable]
> readstat_sas.c: In function 'parse_sas7bdat':
> readstat_sas.c:1029:9: warning: implicit declaration of function
'dprintf' [-Wimplicit-function-declaration]
>
followed by a series of errors:> gcc -m32 -shared -s -static-libgcc -o ../compiled/Windows32.so tmp.def
ConvertSAS.o CKHashTable.o readstat_convert.o readstat_bits.o readstat_io.o
readstat_sas.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386
-Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.2/bin/i386
-lR
> readstat_convert.o:readstat_convert.c:(.text+0x42): undefined reference to
`_imp__libiconv'
> readstat_sas.o:readstat_sas.c:(.text+0x10b5): undefined reference to
`_imp__libiconv_close'
> readstat_sas.o:readstat_sas.c:(.text+0x1126): undefined reference to
`_imp__libiconv_open'
> readstat_sas.o:readstat_sas.c:(.text+0x1808): undefined reference to
`dprintf'
> readstat_sas.o:readstat_sas.c:(.text+0x1da1): undefined reference to
`_imp__libiconv_open'
> readstat_sas.o:readstat_sas.c:(.text+0x1de4): undefined reference to
`_imp__libiconv_close'
> collect2: ld returned 1 exit status
>
The errors all reference libiconv. Note that the first line in the errors
references extralibs64. I don?t understand where this is coming from since the
gcc command is created by R CMD SHLIB using the 32-fit version of R. I replaced
both instance of extralibs64 with extralibs32 but the identical error messages
appear.
Does anyone have an idea as to the problem here?
Any help would be much appreciated.
Dennis
Dennis
Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com