[Rcpp-devel] Help reading libzma file

Serguei Sokol serguei.sokol at gmail.com
Thu Jun 23 10:05:17 CEST 2022


Le 23/06/2022 à 04:07, Roberto Spadim a écrit :
> Hi folks
> 
> I have a .xz file and need to read it and "convert" to a DataFrame using 
> Rcpp if possible.
> 
> But... I'm with a problem (first time testing this) using liblzma with 
> Rcpp, I already know how to do this with CMakeLists.txt, but I don't 
> know how to do with RCpp
> 
> Anyone have an idea?
You have to use Makevars file, either in src/ or in $HOME/.R/ dir.
In this file you have to add something like:

   PKG_CPPFLAGS += -I<dir_where_lzma.h_leaves>
   PKG_LDFLAGS += -L<dir_where_liblzma.so_lives> -llzma

To make this solution portable, you can want to use configure script 
which usage is described in WRE 
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Configure-and-cleanup

Best,
Serguei.

> 
> Output from compile time:
> 
>  > sourceCpp("D:/Trabalho/FTDB-R/FTDB/src/ftdbR.cpp")
> /mingw64/bin/g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-41~1.2/include" 
> -DNDEBUG   -I"C:/Users/rspadim/Documents/R/win-library/4.1/Rcpp/include" 
> -I"D:/Trabalho/FTDB-R/FTDB/src" -I"D:/Trabalho/FTDB-R/FTDB/inst/include" 
>         -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c 
> D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.cpp -o 
> D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.o
> D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.cpp:5:10: fatal error: lzma.h: 
> No such file or directory
>   #include <lzma.h>
>            ^~~~~~~~
> compilation terminated.
> make: *** [C:/PROGRA~1/R/R-41~1.2/etc/x64/Makeconf:245: 
> D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.o] Error 1
> Error in sourceCpp("D:/Trabalho/FTDB-R/FTDB/src/ftdbR.cpp") :
>    Error 1 occurred building shared library.
> In addition: Warning message:
> In normalizePath(path.expand(path), winslash, mustWork) :
>    path[1]="D:/Trabalho/FTDB-R/FTDB/src/../inst/include": O sistema não 
> pode encontrar o caminho especificado
> 
> 
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel



More information about the Rcpp-devel mailing list