On 23 June 2022 at 10:05, Serguei Sokol wrote: | 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")
And you want to look into using a package, not `sourceCpp()` which is designed for more one-off interactive work. You can start a package with the `Rcpp.package.skeleton()` function, and then add a src/Makevars as correctly suggested by Serguei. There are also many example Rcpp on CRAN, GitHub and other places to look at. The `qs` and `fst` packages both cover compression too (but do a lot more...), I can't right now think of a simpler package adding just one compressor but there may well be one. Regards, Dirk | > /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@lists.r-forge.r-project.org | > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel | | _______________________________________________ | Rcpp-devel mailing list | Rcpp-devel@lists.r-forge.r-project.org | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel