ofxCv compiling issues on Raspberry Pi (Raspbian stretch)

I’ve been trying to compile ofxCv on a Raspberry Pi running stretch. I have tried both with the master and stable branches. I get various errors and warnings during compilation.

At the moment I’m just trying to compile one of the examples.

My openFrameworks set up is based on brcm from bakercp post

I copy the obj file from the empty example project:
cp -R /home/pi/openFrameworks/examples/templates/emptyExample/obj/ /home/pi/openFrameworks/addons/ofxCv/example-flow

I also copy the Makefile into the project:
cp /home/pi/openFrameworks/scripts/templates/linuxarmv6l/Makefile /home/pi/openFrameworks/addons/ofxCv/example-flow

These are the last few lines before the compile fails:

/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function ‘std::vector<cv::Point_<float> > ofxCv::toCv(const ofPolyline&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < polyline.size(); i++) {
                  ~~^~~~~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function ‘std::vector<cv::Point_<float> > ofxCv::toCv(const std::vector<glm::tvec2<float, (glm::precision)0u> >&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:52:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < points.size(); i++) {
                  ~~^~~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function ‘std::vector<cv::Point3_<float> > ofxCv::toCv(const std::vector<glm::tvec3<float, (glm::precision)0u> >&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:61:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < points.size(); i++) {
                  ~~^~~~~~~~~~~~~~~
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Helpers.o' failed
make[1]: *** [/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Helpers.o] Error 1
make[1]: *** Waiting for unfinished jobs....
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Utilities.o' failed
make[1]: *** [/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Utilities.o] Error 1
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:124: recipe for target 'Release' failed
make: *** [Release] Error 2

Not sure if I’m missing something. Anyone else been able to get it working?

Just a wild guess here, but sometimes when I get errors with .o files, if I do sudo make instead of just make it works for me. Worth a try. Never tried to run ofxCv myself, though.

I get the same issue with sudo make and sudo make -j2 -s. Good to know though!

Still having trouble with compiling ofxCv on stretch. I’m wondering if I can compile with -fpermissive and see if that works. Guess that’s more of a workaround as the errors are just suppressed. But I’m not sure how that can be achieved. I’ve just seen -fpermissive come up in the errors.

Thought maybe I should also share the whole compile issue incase anyone else has seen it.

Compiling example-flow for Release
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libcurl glfw3 rtaudio gtk+-3.0 libmpg123 
with PKG_CONFIG_LIBDIR=
Compiling /home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp
Compiling /home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp
In file included from /home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:1:0:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/include/ofxCv/Helpers.h: In function ‘float ofxCv::autorotate(const S&, T&, D&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/include/ofxCv/Helpers.h:219:64:error: there are no arguments to ‘ofRadToDeg’ that depend on a template parameter, so a declaration of ‘ofRadToDeg’ must be available [-fpermissive]
   float rotationAmount = ofRadToDeg(weightedAverageAngle(lines));
                                                                ^
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/include/ofxCv/Helpers.h:219:64:note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp: In function ‘float ofxCv::weightedAverageAngle(const std::vector<cv::Vec<int, 4> >&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:78:20: warning:comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < lines.size(); i++) {
                  ~~^~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp: In function ‘std::vector<cv::Point_<float> > ofxCv::getConvexPolygon(const std::vector<cv::Point_<float> >&, int)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:101:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(result.size() > targetPoints) {
      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:102:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < maxIterations; i++) {
                   ~~^~~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:104:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(result.size() == targetPoints) {
        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:107:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(result.size() > targetPoints) {
        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Helpers.cpp:115:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(result.size() < targetPoints) {
        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function cv::Mat ofxCv::toCv(ofMesh&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:36:37: error:invalid use of incomplete type ‘using ofMesh = class ofMesh_<glm::tvec3<float, (glm::precision)0u>, glm::tvec3<float, (glm::precision)0u>, ofColor_<float>, glm::tvec2<float, (glm::precision)0u> > {aka class ofMesh_<glm::tvec3<float, (glm::precision)0u>, glm::tvec3<float, (glm::precision)0u>, ofColor_<float>, glm::tvec2<float, (glm::precision)0u> >}’
   vector<glm::vec3>& vertices = mesh.getVertices();
                                     ^
In file included from /home/pi/openFrameworks/libs/openFrameworks/gl/ofTexture.h:5:0,
                 from /home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/include/ofxCv/Utilities.h:14,
                 from /home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:1:
/home/pi/openFrameworks/libs/openFrameworks/graphics/ofGraphicsBaseTypes.h:45:7 note: declaration of ‘using ofMesh = class ofMesh_<glm::tvec3<float, (glm::precision)0u>, glm::tvec3<float, (glm::precision)0u>, ofColor_<float>, glm::tvec2<float, (glm::precision)0u> > {aka class ofMesh_<glm::tvec3<float, (glm::precision)0u>, glm::tvec3<float, (glm::precision)0u>, ofColor_<float>, glm::tvec2<float, (glm::precision)0u> >}’
 class ofMesh_;
       ^~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function std::vector<cv::Point_<float> > ofxCv::toCv(const ofPolyline&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:43:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < polyline.size(); i++) {
                  ~~^~~~~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function std::vector<cv::Point_<float> > ofxCv::toCv(const std::vector<glm::tvec2<float, (glm::precision)0u> >&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:52:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < points.size(); i++) {
                  ~~^~~~~~~~~~~~~~~
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp: In function std::vector<cv::Point3_<float> > ofxCv::toCv(const std::vector<glm::tvec3<float, (glm::precision)0u> >&)’:
/home/pi/openFrameworks/addons/ofxCv/libs/ofxCv/src/Utilities.cpp:61:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0; i < points.size(); i++) {
                  ~~^~~~~~~~~~~~~~~
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Helpers.o' failed
make[1]: *** [/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Helpers.o] Error 1
make[1]: *** Waiting for unfinished jobs....
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:358: recipe for target '/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Utilities.o' failed
make[1]: *** [/home/pi/openFrameworks/addons/obj/linuxarmv6l/Release/ofxCv/libs/ofxCv/src/Utilities.o] Error 1
/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:124: recipe for target 'Release' failed
make: *** [Release] Error 2

I think your versions of OF and ofxCV are out of sync. If you use the 0.9.8 release of OF you need to pull the stable branch from ofxCV, not the master.

Thanks. I had been using master of OF and ofxCV which should be in sync with each other as stated on ofxCv git hub. OF 0.9.8 can’t really be used on Stretch so that wasn’t working for me.

So I’ve gone back for an installation of Jessie instead of Stretch on the raspberry pi which works fine with 0.9.8 and the stable release of ofxCv. Looks like the workaround with Stretch on a Raspberry Pi isn’t working with ofxCv for now.