Error compiling caffe. leveldb/db.h missing

6,880 views
Skip to first unread message

Jonathan Laserson

unread,
Aug 3, 2015, 1:00:20 PM8/3/15
to Caffe Users
Trying to install caffe here, and get this compilation error.  Help?

@:~/caffe$ make all
CXX src/caffe/util/db.cpp
In file included from src/caffe/util/db.cpp:2:0:
./include/caffe/util/db_leveldb.hpp:6:24: fatal error: leveldb/db.h: No such file or directory
 #include "leveldb/db.h"
                        ^
compilation terminated.
make: *** [.build_release/src/caffe/util/db.o] Error 1

Yi Liu

unread,
Aug 3, 2015, 7:39:12 PM8/3/15
to Caffe Users
Joni! Nice to see you here...

Try this command below:
sudo apt-get install libleveldb-dev

Best,
Yi

Jonathan Laserson

unread,
Aug 4, 2015, 5:05:46 AM8/4/15
to Caffe Users
Nice to see you too!!
Thanks for the help, it worked.

wri...@ohsu.edu

unread,
Aug 10, 2015, 4:30:18 PM8/10/15
to Caffe Users
I am having a very similar error to this; unfortunately, I cannot use apt-get in the environment I am in (both not a root/sudoer and also in CentOS). I have installed and apparently successfully compiled the necessary libraries for caffe in my user home directory, but make stubbornly fails to find db.h for LevelDB. Specific error is:

In file included from /mnt/lustre1/users/wrighth/caffe-rc2/src/caffe/util/db.cpp:1:
/mnt/lustre1/users/wrighth/caffe-rc2/include/caffe/util/db.hpp:6:24: error: leveldb/db.h: No such file or directory

I have tried to change INCLUDE leveldb/db.h and INCLUDE leveldb/write_batch.h to just INCLUDE db.h and INCLUDE write_batch.h in the .hpp file and then altered the path in the CMakeCache.txt to /mnt/lustre1/users/wrighth/leveldb-1.18/include/leveldb/, which seems to solve the db.h issue but results in a failure for write_batch.h:

In file included from /mnt/lustre1/users/wrighth/caffe-rc2/src/caffe/util/db.cpp:1:
/mnt/lustre1/users/wrighth/caffe-rc2/include/caffe/util/db.hpp:7:25: error: write_batch.h: No such file or directory

Both the files are present in include/leveldb, so I am at a bit of a loss as to what the issue is here.

Hollis Wright, PhD
Ojeda Lab, Division of Neuroscience
Oregon Health and Science University

mscs...@itu.edu.pk

unread,
Feb 25, 2019, 5:55:59 AM2/25/19
to Caffe Users
sudo apt-get install libleveldb-dev
run above command
then rerun make all

Javier Fernandez

unread,
Feb 25, 2019, 5:11:40 PM2/25/19
to Caffe Users

I am having the following problem when prompting this command line: pip3 install libleveldb-dev  


Collecting libleveldb-dev

  Could not find a version that satisfies the requirement libleveldb-dev (from versions: )

No matching distribution found for libleveldb-dev

Reply all
Reply to author
Forward
0 new messages