<div dir="ltr">Nice, thanks Dirk, I will test it!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em qui., 23 de jun. de 2022 às 21:28, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 23 June 2022 at 20:46, Roberto Spadim wrote:<br>
| Uhm, yes I see<br>
| I testd with package, and linux, it works<br>
| But with Windows it don't find the liblzma<br>
<br>
"Par for the course" as they say -- Windows has not standard library location<br>
so you will need an 'extra convention' as either the CRAN rules of installing<br>
a bunch of library in one jointly accessed directory, or by following<br>
per-library environment variables. Here is what RcppGSL does for GSL:<br>
<br>
PKG_CPPFLAGS= -I../windows/gsl-2.7/include -I../inst/include<br>
PKG_LIBS= -L../windows/gsl-2.7/lib${R_ARCH}${CRT} -lgsl -lgslcblas<br>
<br>
all: clean winlibs<br>
<br>
winlibs:<br>
        "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"<br>
<br>
clean:<br>
        rm -f $(SHLIB) $(OBJECTS)<br>
<br>
ie it can just assume GSL is present. CRAN documents somewhere what libraries<br>
yu can expect; I cannot from the top of my head recall if LZMA is part of<br>
that set.<br>
<br>
Portable development is hard for a reason. Operating systems are idiosyncratic.<br>
<br>
Dirk<br>
<br>
| <br>
| Em qui., 23 de jun. de 2022 às 07:59, Dirk Eddelbuettel <<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>><br>
| escreveu:<br>
| <br>
| ><br>
| > On 23 June 2022 at 10:05, Serguei Sokol wrote:<br>
| > | Le 23/06/2022 à 04:07, Roberto Spadim a écrit :<br>
| > | > Hi folks<br>
| > | ><br>
| > | > I have a .xz file and need to read it and "convert" to a DataFrame<br>
| > using<br>
| > | > Rcpp if possible.<br>
| > | ><br>
| > | > But... I'm with a problem (first time testing this) using liblzma with<br>
| > | > Rcpp, I already know how to do this with CMakeLists.txt, but I don't<br>
| > | > know how to do with RCpp<br>
| > | ><br>
| > | > Anyone have an idea?<br>
| > | You have to use Makevars file, either in src/ or in $HOME/.R/ dir.<br>
| > | In this file you have to add something like:<br>
| > |<br>
| > |    PKG_CPPFLAGS += -I<dir_where_lzma.h_leaves><br>
| > |    PKG_LDFLAGS += -L<dir_where_liblzma.so_lives> -llzma<br>
| > |<br>
| > | To make this solution portable, you can want to use configure script<br>
| > | which usage is described in WRE<br>
| > |<br>
| > <a href="https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Configure-and-cleanup" rel="noreferrer" target="_blank">https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Configure-and-cleanup</a><br>
| > |<br>
| > | Best,<br>
| > | Serguei.<br>
| > |<br>
| > | ><br>
| > | > Output from compile time:<br>
| > | ><br>
| > | >  > sourceCpp("D:/Trabalho/FTDB-R/FTDB/src/ftdbR.cpp")<br>
| ><br>
| > And you want to look into using a package, not `sourceCpp()` which is<br>
| > designed for more one-off interactive work.<br>
| ><br>
| > You can start a package with the `Rcpp.package.skeleton()` function, and<br>
| > then<br>
| > add a src/Makevars as correctly suggested by Serguei.  There are also many<br>
| > example Rcpp on CRAN, GitHub and other places to look at.  The `qs` and<br>
| > `fst`<br>
| > packages both cover compression too (but do a lot more...), I can't right<br>
| > now<br>
| > think of a simpler package adding just one compressor but there may well<br>
| > be one.<br>
| ><br>
| > Regards, Dirk<br>
| ><br>
| > | > /mingw64/bin/g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-41~1.2/include"<br>
| > | > -DNDEBUG<br>
| > -I"C:/Users/rspadim/Documents/R/win-library/4.1/Rcpp/include"<br>
| > | > -I"D:/Trabalho/FTDB-R/FTDB/src"<br>
| > -I"D:/Trabalho/FTDB-R/FTDB/inst/include"<br>
| > | >         -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c<br>
| > | > D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.cpp -o<br>
| > | > D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.o<br>
| > | > D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.cpp:5:10: fatal error:<br>
| > lzma.h:<br>
| > | > No such file or directory<br>
| > | >   #include <lzma.h><br>
| > | >            ^~~~~~~~<br>
| > | > compilation terminated.<br>
| > | > make: *** [C:/PROGRA~1/R/R-41~1.2/etc/x64/Makeconf:245:<br>
| > | > D:/Trabalho/FTDB-R/FTDB/src/xz/xz/decode.o] Error 1<br>
| > | > Error in sourceCpp("D:/Trabalho/FTDB-R/FTDB/src/ftdbR.cpp") :<br>
| > | >    Error 1 occurred building shared library.<br>
| > | > In addition: Warning message:<br>
| > | > In normalizePath(path.expand(path), winslash, mustWork) :<br>
| > | >    path[1]="D:/Trabalho/FTDB-R/FTDB/src/../inst/include": O sistema<br>
| > não<br>
| > | > pode encontrar o caminho especificado<br>
| > | ><br>
| > | ><br>
| > | > _______________________________________________<br>
| > | > Rcpp-devel mailing list<br>
| > | > <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| > | ><br>
| > <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
| > |<br>
| > | _______________________________________________<br>
| > | Rcpp-devel mailing list<br>
| > | <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| > | <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
| > --<br>
| > <a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
| ><br>
| <br>
| <br>
| -- <br>
| Roberto Spadim<br>
| SPAEmpresarial - Software ERP/Scada<br>
| Eng. Automação e Controle, Eng. Financeira<br>
<br>
-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Roberto Spadim<br>SPAEmpresarial - Software ERP/Scada<div>Eng. Automação e Controle, Eng. Financeira</div></div></div></div></div></div></div>