ropensci / opencv

R bindings for OpenCV
https://docs.ropensci.org/opencv
Other
137 stars 27 forks source link

"`pencilSketch` not declared in scope" error on install #14

Closed McClellandLegge closed 4 years ago

McClellandLegge commented 5 years ago

When installing a compilation error appears, which I can replicate when trying to compile directly:

$  /opt/rh/devtoolset-7/root/usr/bin/g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I/usr/include/opencv   -D_DATA_PREFIX=/usr -I"/usr/lib64/R/library/Rcpp/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c effects.cpp -o effects.o
effects.cpp: In function ‘XPtrMat cvmat_sketch(XPtrMat, bool)’:
effects.cpp:16:3: error: ‘pencilSketch’ was not declared in this scope
   pencilSketch(get_mat(ptr),out1, out2, 10 , 0.1f, 0.03f);
   ^~~~~~~~~~~~
effects.cpp: In function ‘XPtrMat cvmat_stylize(XPtrMat)’:
effects.cpp:23:3: error: ‘stylization’ was not declared in this scope
   stylization(get_mat(ptr), out);
   ^~~~~~~~~~~

Is there a specific version of opencv I should be using?

opencv version:

$  sudo yum list installed \| grep opencv
opencv.x86_64                      2.4.5-3.el7                         @base
opencv-core.x86_64                 2.4.5-3.el7                         @base
opencv-devel.x86_64                2.4.5-3.el7                         @base
opencv-python.x86_64               2.4.5-3.el7                         @base

R version:

$  sudo yum list installed | grep ^R
R.x86_64                           3.6.0-1.el7                         @epel
R-Rcpp.x86_64                      1.0.2-1.el7                         @epel
R-Rcpp-devel.x86_64                1.0.2-1.el7                         @epel
R-core.x86_64                      3.6.0-1.el7                         @epel
R-core-devel.x86_64                3.6.0-1.el7                         @epel
R-devel.x86_64                     3.6.0-1.el7                         @epel
R-java.x86_64                      3.6.0-1.el7                         @epel
R-java-devel.x86_64                3.6.0-1.el7                         @epel

g++ version:

$  /opt/rh/devtoolset-7/root/usr/bin/g++ --version
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
apford commented 4 years ago

Any progress on this ? Or is it a gcc version issue I have the same problem with gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)

jeroen commented 4 years ago

This package actually requires libopencv 3 or newer and RHEL/CENTOS 7 ships with libopencv 2. I highly recommend you try to upgrade to RHEL/CENTOS 8.

I'll try to add a workaround to disable some features that are not available on libopencv 2, such that you can still install the package there (but not everything will work).

jeroen commented 4 years ago

Can you try to install the version from git?