I was trying to install the package videoplayR from github but failed to do the same. I tried two ways:
1. Using the installation guidance mentioned in README file.It gave the following error:
> install_github("sjmgarnier/videoplayR")
Downloading github repo sjmgarnier/videoplayR#master
Error in function (type, msg, asError = TRUE) :
2. Using R CMD SHLIB etc gives the following error while running R CMD check. It is a part of the install.out file:
* installing source package ‘videoplayR’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/home/nandy/R/x86_64-pc-linux-gnu-library/3.1/Rcpp/include" -I"/home/nandy/R/x86_64-pc-linux-gnu-library/3.1/RcppArmadillo/include" pkg-config --cflags opencv Rscript -e <p>'Rcpp:::CxxFlags()' -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -I/usr/share/R/include -DNDEBUG -I"/home/nandy/R/x86_64-pc-linux-gnu-library/3.1/Rcpp/include" -I"/home/nandy/R/x86_64-pc-linux-gnu-library/3.1/RcppArmadillo/include" pkg-config --cflags opencv Rscript -e <p>'Rcpp:::CxxFlags()' -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c Video.cpp -o Video.o
Video.cpp: In member function ‘double Video::current_frame()’:
Video.cpp:42:25: error: ‘CV_CAP_PROP_POS_FRAMES’ was not declared in this scope
return(inputVideo.get(CV_CAP_PROP_POS_FRAMES));
^
Video.cpp: In member function ‘void Video::set_current_frame(int)’:
Video.cpp:46:18: error: ‘CV_CAP_PROP_POS_FRAMES’ was not declared in this scope
inputVideo.set(CV_CAP_PROP_POS_FRAMES, n);
^
Video.cpp: In member function ‘void Video::next_frame_cv()’:
Video.cpp:63:22: error: ‘CV_CAP_PROP_POS_FRAMES’ was not declared in this scope
if (inputVideo.get(CV_CAP_PROP_POS_FRAMES) == inputVideo.get(CV_CAP_PROP_FRAME_COUNT)) {
^
Video.cpp:63:64: error: ‘CV_CAP_PROP_FRAME_COUNT’ was not declared in this scope
if (inputVideo.get(CV_CAP_PROP_POS_FRAMES) == inputVideo.get(CV_CAP_PROP_FRAME_COUNT)) {
^
Video.cpp: In member function ‘void Video::get_frame_cv(int)’:
Video.cpp:76:27: error: ‘CV_CAP_PROP_FRAME_COUNT’ was not declared in this scope
if (n > inputVideo.get(CV_CAP_PROP_FRAME_COUNT)) {
^
Video.cpp:80:18: error: ‘CV_CAP_PROP_POS_FRAMES’ was not declared in this scope
inputVideo.set(CV_CAP_PROP_POS_FRAMES, n);
^
Video.cpp: In member function ‘int Video::length()’:
Video.cpp:91:25: error: ‘CV_CAP_PROP_FRAME_COUNT’ was not declared in this scope
return(inputVideo.get(CV_CAP_PROP_FRAME_COUNT));
^
I am guessing problem 2 is occurring due to version problem of OpenCV. Am I right? Is there any way out of this?
Looks similar to these 2 reported problems: https://github.com/hadley/devtools/issues/650 and https://github.com/hadley/devtools/issues/467. It seems that you need to update your system (Linux I presume) to the latest version of Curl.
I believe this is my fault. I forgot to exclude the compiled shared object videoplayR.so last time I committed changes to the GitHub repo. If you're using a different OS than mine (OSX Yosemite), it is most certainly the cause of the problem that you encountered. I fixed it and now it should compile nicely on your computer as well.
FYI I compiled and ran the package with both OpenCV 2.4.9 and 2.4.10, but it should work with any 2.4.X version of OpenCV (never tried the latest OpenCV 3.0 beta).
Related
I can’t figure out how to give my R package’s shared library’s debug symbols source line information. What am I missing?
I create the following src/Makevars file:
PKG_CXXFLAGS=-O0 -ggdb
PKG_LIBS=-O0 -ggdb
I compile the package using R CMD INSTALL --no-multiarch --with-keep.source:
* installing to library ‘~/.local/lib/R/3.6’
* installing *source* package ‘reticulate’ ...
** using staged installation
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG -I"$HOME/.local/lib/R/3.6/Rcpp/include" -D_FORTIFY_SOURCE=2 -O0 -ggdb -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c RcppExports.cpp -o RcppExports.o
** libs
g++ -std=gnu++11 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o reticulate.so RcppExports.o event_loop.o libpython.o output.o python.o readline.o -O0 -ggdb -L/usr/lib64/R/lib -lR
installing to ~/.local/lib/R/3.6/00LOCK-reticulate/00new/reticulate/libs
I debug like this:
R -d gdb --slave -e 'reticulate::py_eval("print")()'
GNU gdb (GDB) 8.3
[...]
(No debugging symbols found in /usr/lib64/R/bin/exec/R)
(gdb) break py_get_formals
Function "py_get_formals" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (py_get_formals) pending.
(gdb) run
Starting program: /usr/lib/R/bin/exec/R --slave -e reticulate::py_eval\(\"print\"\)\(\)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[...]
Thread 1 "R" hit Breakpoint 1, 0x00007fffeb6b79a0 in py_get_formals(PyObjectRef, bool) () from /home/angerer/.local/lib/R/3.6/reticulate/libs/reticulate.so
(gdb) step
Single stepping until exit from function _Z14py_get_formals11PyObjectRefb,
which has no line number information.
[...]
Why does my function not have line numbers even though I specified -ggdb in both compilation? I see that only RcppExports.cpp is mentioned in the command line, is that the problem? If so, how can I change this?
Changing the Makevars doesn’t prompt recompilation.
I needed to rm -f src/*.o src/*.so before the object files get recompiled.
This is specifically for Windows. The simplest way to do it is to set the R_MAKEVARS_USER environment to point to the Makevars.win file. That seems to work. However, debug break points have stopped working!!!!
I can’t figure out how to give my R package’s shared library’s debug symbols source line information. What am I missing?
I create the following src/Makevars file:
PKG_CXXFLAGS=-O0 -ggdb
PKG_LIBS=-O0 -ggdb
I compile the package using R CMD INSTALL --no-multiarch --with-keep.source:
* installing to library ‘~/.local/lib/R/3.6’
* installing *source* package ‘reticulate’ ...
** using staged installation
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG -I"$HOME/.local/lib/R/3.6/Rcpp/include" -D_FORTIFY_SOURCE=2 -O0 -ggdb -fpic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -c RcppExports.cpp -o RcppExports.o
** libs
g++ -std=gnu++11 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o reticulate.so RcppExports.o event_loop.o libpython.o output.o python.o readline.o -O0 -ggdb -L/usr/lib64/R/lib -lR
installing to ~/.local/lib/R/3.6/00LOCK-reticulate/00new/reticulate/libs
I debug like this:
R -d gdb --slave -e 'reticulate::py_eval("print")()'
GNU gdb (GDB) 8.3
[...]
(No debugging symbols found in /usr/lib64/R/bin/exec/R)
(gdb) break py_get_formals
Function "py_get_formals" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (py_get_formals) pending.
(gdb) run
Starting program: /usr/lib/R/bin/exec/R --slave -e reticulate::py_eval\(\"print\"\)\(\)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[...]
Thread 1 "R" hit Breakpoint 1, 0x00007fffeb6b79a0 in py_get_formals(PyObjectRef, bool) () from /home/angerer/.local/lib/R/3.6/reticulate/libs/reticulate.so
(gdb) step
Single stepping until exit from function _Z14py_get_formals11PyObjectRefb,
which has no line number information.
[...]
Why does my function not have line numbers even though I specified -ggdb in both compilation? I see that only RcppExports.cpp is mentioned in the command line, is that the problem? If so, how can I change this?
Changing the Makevars doesn’t prompt recompilation.
I needed to rm -f src/*.o src/*.so before the object files get recompiled.
This is specifically for Windows. The simplest way to do it is to set the R_MAKEVARS_USER environment to point to the Makevars.win file. That seems to work. However, debug break points have stopped working!!!!
I have problems to compile the "raster" package.
I tried
install.packages("raster", dependencies = TRUE)
with no success.
Any suggestions?
The main problem is:
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I"/home/zfgbe/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RasterModule.cpp -o RasterModule.o
In file included from RasterModule.cpp:2:
spat.h:158: error: ISO C++ forbids initialization of member ‘crs’
spat.h:158: error: making ‘crs’ static
spat.h:158: error: invalid in-class initialization of static data member of non-integral type ‘std::string’
spat.h: In member function ‘std::string SpRaster::getCRS()’:
spat.h:200: error: ‘crs’ was not declared in this scope
spat.h: In member function ‘void SpRaster::setCRS(std::string)’:
spat.h:201: error: ‘crs’ was not declared in this scope
make: *** [RasterModule.o] Error 1
ERROR: compilation failed for package ‘raster’
The problem is the depend on the rather new C++ Implementation (C++11).
The version 2.5-8 of raster does not have this dependency.
For me this installation command worked:
install.packages("https://cran.r-project.org/src/contrib/Archive/raster/raster_2.5-8.tar.gz", repos = NULL, type="source")
I am running MRO 3.5.0 on Win10, and trying to install a package image.CannyImage from bnosac/image on the github. But it keeps reporting fatal errors as following.
* installing *source* package 'image.CannyEdges' ...
** libs
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_64/bin/gcc -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -std=gnu99 -mtune=core2 -c adsf.c -o adsf.o
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c rcpp_canny.cpp -o rcpp_canny.o
In file included from rcpp_canny.cpp:13:0:
canny.h:8:19: fatal error: fftw3.h: No such file or directory
#include <fftw3.h>
^
compilation terminated.
make: *** [C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/etc/x64/Makeconf:215: rcpp_canny.o] Error 1
ERROR: compilation failed for package 'image.CannyEdges'
* removing 'C:/Users/eric1/Documents/R/win-library/3.5/image.CannyEdges'
In R CMD INSTALL
Installation failed: Command failed (1)
^
compilation terminated.
Google says I can solve the issue by sudo apt-get remove libfftw3-dev. Unfortunately, I am on Windows, and some advised, apply lib /machine:i386 /def:libfftw3-3.def on cmd mode. Ouch, there is no such command or file called lib.exe on Win10.
Please advise, how I can solve this issue on my Win10+MRO system. Thanks.
Even though this question is already a bit old:
By now (Feb 2020) there are precompiled packages available that work also under Windows:
Canny Edges - Package
and more general:
List of all available packages
I have tried installing them and (at least for me) it worked.
Attempting to compile rgl for r on arch linux x86_64. I copied just the error portion of the installation. This has occurred after I recently updated R. Any idea how to solve this?
g++ -I/usr/include/R/ -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng16 -DHAVE_FREETYPE -Iext/ftgl -I/usr/include/freetype2 -Iext -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fvisibility=hidden -fpic -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -c init.cpp -o init.o
In file included from /usr/include/freetype2/freetype.h:33:0,
from ext/ftgl/FTGL/ftgl.h:33,
from glgui.h:12,
from gui.h:10,
from rglview.h:11,
from Device.h:11,
from DeviceManager.h:9,
from init.cpp:6:
init.cpp: In function ‘SEXPREC* rgl::rgl_init(SEXP, SEXP, SEXP)’:
/usr/include/freetype2/config/ftconfig.h:369:26: error: expected primary-expression before ‘__typeof__’
#define TYPEOF( type ) (__typeof__ (type))
^
init.cpp:58:13: note: in expansion of macro ‘TYPEOF’
else if ( TYPEOF(initValue) == EXTPTRSXP ) {
^
/usr/include/freetype2/config/ftconfig.h:369:26: error: expected ‘)’ before ‘__typeof__’
#define TYPEOF( type ) (__typeof__ (type))
^
init.cpp:58:13: note: in expansion of macro ‘TYPEOF’
else if ( TYPEOF(initValue) == EXTPTRSXP ) {
^
init.cpp:61:3: error: expected ‘)’ before ‘else’
else if ( !isNull(initValue) )
^
/usr/lib64/R/etc/Makeconf:143: recipe for target 'init.o' failed
make: *** [init.o] Error 1
ERROR: compilation failed for package ‘rgl’
* removing ‘/home/user/R/x86_64-unknown-linux-gnu-library/3.2/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
Freetype is optional. Disabling it is the least hassles solution.
install.packages("rgl", repo="http://cran.r-project.org", configure.args="--disable-ftgl")
The issue is with freetype2 2.6. Downgrading to freetype2 2.5 allows rgl to compile properly.
For archlinux you can just run pacman -U /var/cache/pacman/pkg/freetype2-2.5.5-1-x86_64.pkg.tar.xz to downgrade to the older package.
For others who come looking I solved this on ubuntu by installing libfreetype6-dev
Get the binary from the repos:
sudo apt-get build-dep r-cran-rgl
or
Install OpenGL before building rgl from source.