Closed Isarm closed 2 years ago
Glad you figured out the source of the issue at least! One suggestion that might be a simpler fix if it works: instead of
find_package(gflags REQUIRED)
give it a hint, like:
find_package(gflags REQUIRED PATHS /usr/lib/x86_64-linux-gnu/cmake/gflags)
or some variation of the paths there. No idea if this will fix it/work but worth trying and a little bit less invasive if it does!
Thanks, that works! Definitely a lot nicer that way!
When trying to build using
make
I get the following error:It seems that gflags made a switch in namespace from google to gflags in version 2.1. On my system I was building in a terminal that had a catkin workspace sourced in which I will be using this library, and a different library seems to be using an older version of gflags there, which clashes with my system install. Building in a terminal that does not source this works fine.
Caffe for example also uses gflags and this issue with build failing on older versions of gflags is known there too:
https://github.com/BVLC/caffe/issues/2597
They get around it by doing this:
See here
A similar suggestion is made on stackoverflow here
The Caffe fix actually does not work for me, as they use GFLAGS_GFLAGSH to detect which version of gflags is installed, but because I also have the new gflags installed, it incorrectly determines the version as it sees the system GFLAGS_GFLAGS_H, but still uses the older version gflags.h header file defined in the catkin workspace include folder. (I think at least, it really is quite the mess.)
The fix from the stackoverflow link does work for me (also for the non-catkin-sourced environment).
If someone else happens to run into this highly specific issue of things clashing, here is a branch with the fix applied.