Glags/Glog errors during compilation

3,538 views
Skip to first unread message

Swami

unread,
Oct 16, 2014, 12:59:16 AM10/16/14
to caffe...@googlegroups.com
I am trying to build CAFFE in gpu mode in Ubuntu 12.04 using gcc 4.6.3. Its agonising to see that the compilation halts at the shown point. 

************************************************************************************************************************
Scanning dependencies of target caffe.bin
Scanning dependencies of target convert_imageset.bin
Scanning dependencies of target compute_image_mean.bin
Scanning dependencies of target device_query.bin
[ 84%] [ 88%] [ 88%] [ 88%] Building CXX object tools/CMakeFiles/convert_imageset.bin.dir/convert_imageset.cpp.o
/gleuclid/swamiviv/caffe/tools/convert_imageset.cpp:11:27: fatal error: gflags/gflags.h: No such file or directory
compilation terminated.
make[2]: *** [tools/CMakeFiles/convert_imageset.bin.dir/convert_imageset.cpp.o] Error 1
make[1]: *** [tools/CMakeFiles/convert_imageset.bin.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Building CXX object tools/CMakeFiles/device_query.bin.dir/device_query.cpp.o
Building CXX object tools/CMakeFiles/caffe.bin.dir/caffe.cpp.o
Building CXX object tools/CMakeFiles/compute_image_mean.bin.dir/compute_image_mean.cpp.o
/gleuclid/swamiviv/caffe/tools/compute_image_mean.cpp:1:26: fatal error: glog/logging.h: No such file or directory
compilation terminated.
/gleuclid/swamiviv/caffe/tools/caffe.cpp:1:26: fatal error: glog/logging.h: No such file or directory
compilation terminated.
make[2]: *** [tools/CMakeFiles/compute_image_mean.bin.dir/compute_image_mean.cpp.o] Error 1
make[1]: *** [tools/CMakeFiles/compute_image_mean.bin.dir/all] Error 2
In file included from /gleuclid/swamiviv/caffe/tools/device_query.cpp:1:0:
/gleuclid/swamiviv/caffe/include/caffe/common.hpp:5:27: fatal error: gflags/gflags.h: No such file or directory
compilation terminated.
make[2]: *** [tools/CMakeFiles/caffe.bin.dir/caffe.cpp.o] Error 1
make[1]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2
make[2]: *** [tools/CMakeFiles/device_query.bin.dir/device_query.cpp.o] Error 1
make[1]: *** [tools/CMakeFiles/device_query.bin.dir/all] Error 2
make: *** [all] Error 2
************************************************************************************************************************

Its especially annoying because I know that the the glog/gflags headers and libraries were already used before in the compilation, I found lines like these:

************************************************************************************************************************
/homes/swamiviv/packages_local/glog-0.3.3/src/glog/logging.h(348): warning: using-declaration ignored -- it refers to the current namespace

/homes/swamiviv/packages_local/glog-0.3.3/src/glog/logging.h(352): warning: using-declaration ignored -- it refers to the current namespace

/homes/swamiviv/packages_local/glog-0.3.3/src/glog/logging.h(348): warning: using-declaration ignored -- it refers to the current namespace
************************************************************************************************************************

I should say that I do not have root access in the machine and hence I have installed glogd and gflags to a local dir and I changed the cmake config. parameters to reflect that, using the GLOG_INCLUDE(LIB)_DIR  and GFLAGS_INCLUDE(LIB)_DIR flags.

Can anyone see what's going wrong here or has anyone experienced this problem in their compilation?

-Swami




Shikhar Sharma

unread,
Sep 8, 2015, 5:31:20 PM9/8/15
to Caffe Users
Did you find a solution to this?

X.T. Li

unread,
Sep 8, 2015, 9:49:50 PM9/8/15
to Caffe Users
Where did you install your glogs and gflags? You might need to use
export LD_LIBRARY_PATH=/path/to/libglog.so

to tell caffe where to find your gflags or glogs. For me, all these libs are in /usr/local/lib.

在 2014年10月16日星期四 UTC+8下午12:59:16,Swami写道:

Shikhar Sharma

unread,
Sep 8, 2015, 9:55:05 PM9/8/15
to Caffe Users
I solved it. In my case the LD_LIBRARY_PATH was set correctly but yet I was getting this error.

I set
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/pkgs/gflags/include:/pkgs/glog-0.3.3/include:/usr/include/python2.7
and the header files started getting included. This was a bit unexpected as the lib files should have done that automatically.

Thanks though

BlueRayONE

unread,
May 9, 2017, 7:44:34 AM5/9/17
to Caffe Users
Sorry for digging out this old topic.

I'm having a similar problem:
./include/caffe/common.hpp:6:26: Warning: glog/logging.h: file or directory not found 
In my system, glog is in /usr/local/ (so libglog.so is in /usr/local/glog/lib/).
Do I have to set in my .bash_profile 
export LD_LIBRARY_PATH=/usr/local
?

Or what do I have to add to avoid this warning/error?

BlueRayONE

unread,
May 19, 2017, 5:02:59 AM5/19/17
to Caffe Users
I could finally handle it:
In the Makefile.config I extended INCLUDE_DIRS to "/usr/local/glog/include/" and LIBRARY_DIRS to "/usr/local/glog/lib". 
Hope that helps others, too.
Reply all
Reply to author
Forward
0 new messages