Dear all,


I have been developing an R package using Rcpp to call C++ functions that use 
the C subroutine library 'fftw3' that implements fast Fourier transform 
algorithm. Since I have the C library 'fftw3' installed on my laptop (running 
MacOS), when I checked my developed package using R CMD CHECK --as-cran, I 
could pass all the checks with no errors or warnings.



However, when I submitted the package to CRAN, during the pre-test, I 
encountered an error. I was wondering whether this error came from the absence 
of the 'fftw3' C library on the checking machine? Or maybe I have made some 
mistakes in the Makevars.win file?



I have done some search on how to use the external C library in R packages with 
Rcpp.

Here is what I have provided in the Makevars.win file:



PKG_CPPFLAGS = -I$(LIB_FFTW)/include

CXX = g++

PKG_CXXFLAGS = -std=c++11

PKG_LIBS = -L$(LIB_FFTW)/lib -lfftw3





Could you please advise me on what to do?



Here is the error message:



* installing *source* package 'KSgeneral' ...

** libs



*** arch - i386

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c RcppExports.cpp -o RcppExports.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c cont_ks_dist.cpp -o cont_ks_dist.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c crossprob_new.cc -o crossprob_new.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c fftw_wrappers.cc -o fftw_wrappers.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c fftwconvolver.cc -o fftwconvolver.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c one_sided_noncrossing_probability.cc -o 
one_sided_noncrossing_probability.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c one_sided_noncrossing_probability_n2.cc -o 
one_sided_noncrossing_probability_n2.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c one_sided_noncrossing_probability_n2logn.cc -o 
one_sided_noncrossing_probability_n2logn.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c poisson_pmf.cc -o poisson_pmf.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c read_boundaries_file.cc -o read_boundaries_file.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c string_utils.cc -o string_utils.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++  -I"D:/RCompile/recent/R/include" 
-DNDEBUG -Id:/Rcompile/CRANpkg/extralibs215/local215/include 
-I"d:/RCompile/CRANpkg/lib/3.5/Rcpp/include"   
-I"d:/Compiler/gcc-4.9.3/local330/include"  -std=c++11   -pedantic -O2 -Wall  
-mtune=core2 -c two_sided_noncrossing_probability.cc -o 
two_sided_noncrossing_probability.o

d:/Compiler/gcc-4.9.3/mingw_32/bin/g++ -shared -s -static-libgcc -o 
KSgeneral.dll tmp.def RcppExports.o cont_ks_dist.o crossprob_new.o 
fftw_wrappers.o fftwconvolver.o one_sided_noncrossing_probability.o 
one_sided_noncrossing_probability_n2.o 
one_sided_noncrossing_probability_n2logn.o poisson_pmf.o read_boundaries_file.o 
string_utils.o two_sided_noncrossing_probability.o 
-Ld:/Rcompile/CRANpkg/extralibs215/local215/lib -lfftw3 
-Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib 
-LD:/RCompile/recent/R/bin/i386 -lR

fftw_wrappers.o:fftw_wrappers.cc:(.text+0x125): undefined reference to 
`_imp__fftw_plan_dft_r2c_1d'

fftw_wrappers.o:fftw_wrappers.cc:(.text+0x14f): undefined reference to 
`_imp__fftw_destroy_plan'

fftw_wrappers.o:fftw_wrappers.cc:(.text+0x29b): undefined reference to 
`_imp__fftw_execute'

fftw_wrappers.o:fftw_wrappers.cc:(.text+0x315): undefined reference to 
`_imp__fftw_plan_dft_c2r_1d'

fftw_wrappers.o:fftw_wrappers.cc:(.text+0x33f): undefined reference to 
`_imp__fftw_destroy_plan'

fftw_wrappers.o:fftw_wrappers.cc:(.text+0x3bb): undefined reference to 
`_imp__fftw_execute'

collect2.exe: error: ld returned 1 exit status

no DLL was created

ERROR: compilation failed for package 'KSgeneral'

* removing 'd:/RCompile/CRANincoming/R-devel/lib/KSgeneral'





Thank you very much.



Best regards,

Senren Tan







        [[alternative HTML version deleted]]

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

Reply via email to