[Rcpp-devel] Help reading libzma file

Dirk Eddelbuettel edd at debian.org
Fri Jun 24 02:28:50 CEST 2022


On 23 June 2022 at 20:46, Roberto Spadim wrote:
| Uhm, yes I see
| I testd with package, and linux, it works
| But with Windows it don't find the liblzma

"Par for the course" as they say -- Windows has not standard library location
so you will need an 'extra convention' as either the CRAN rules of installing
a bunch of library in one jointly accessed directory, or by following
per-library environment variables. Here is what RcppGSL does for GSL:

PKG_CPPFLAGS= -I../windows/gsl-2.7/include -I../inst/include
PKG_LIBS= -L../windows/gsl-2.7/lib${R_ARCH}${CRT} -lgsl -lgslcblas

all: clean winlibs

winlibs:
	"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"

clean:
	rm -f $(SHLIB) $(OBJECTS)

ie it can just assume GSL is present. CRAN documents somewhere what libraries
yu can expect; I cannot from the top of my head recall if LZMA is part of
that set.

Portable development is hard for a reason. Operating systems are idiosyncratic.

Dirk

| 
| Em qui., 23 de jun. de 2022 às 07:59, Dirk Eddelbuettel <edd at debian.org>
| escreveu:
| 
| >
| > 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 at 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 at lists.r-forge.r-project.org
| > | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| > --
| > dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
| >
| 
| 
| -- 
| Roberto Spadim
| SPAEmpresarial - Software ERP/Scada
| Eng. Automação e Controle, Eng. Financeira

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list