rocksdb related build error
diff mbox

Message ID 1462318107.23609.3.camel@gmail.com
State New
Headers show

Commit Message

Ming Lin May 3, 2016, 11:28 p.m. UTC
On Tue, 2016-05-03 at 18:58 -0400, Marcus Watts wrote:
> On Tue, May 03, 2016 at 02:15:49PM -0700, Ming Lin wrote:
> > On Tue, May 3, 2016 at 5:26 AM, Sage Weil <sage@newdream.net>
> > wrote:
> > > On Tue, 3 May 2016, Ming Lin wrote:
> > > > Hi John,
> > > > 
> > > > I got rocksdb related build error (commit bb7d9c15).
> > > > Any hint to fix it?
> > > > 
> > > > It's OK if I build in the ceph source tree.
> > > 
> > > Out of tree builds don't work currently with autotools.
> > 
> > I just learned a bit about autotools.
> > https://en.wikipedia.org/wiki/GNU_Build_System
> > 
> > Could you share what the problem is here to support out-of-tree
> > build?
> > I'll try to write a patch to fix it.
> 
> I looked at this fairly recently.
> 
> rocksdb comes with a cmake (only used for windows), and makefile
> build.
> The makefile build doesn't use autotools, it's just a gnu makefile.
> gnu make does support out of tree builds, but the rocksdb file
> doesn't
> do that.  So, it wants to find all its source wherever it's
> installed,
> and it puts all the .o's in the same place - So: no separate build
> possible.
> This is a problem for both automake & cmake.
> 
> You could change the makefile to work "out of tree", but it won't
> be pretty.  Probably you would be adding some "VPATH" statements,
> add -I as necessary, and you'd have to work within the structure
> of the file which I think seemed a bit more complicated than
> necessary.

Here is my quick hack. Just add ${srcdir}
It's not real "out of tree" because rocksdb is still build in the tree
actually.

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/src/kv/Makefile.am b/src/kv/Makefile.am
index b876171..0dd754c 100644
--- a/src/kv/Makefile.am
+++ b/src/kv/Makefile.am
@@ -21,8 +21,8 @@  if FREEBSD
         NPROC = sysctl -n hw.ncpu
 endif
 rocksdb/librocksdb.a:
-	cd rocksdb && CC="${CC}" CXX="${CXX}" EXTRA_CXXFLAGS=-fPIC PORTABLE=1 $(MAKE) -j$(shell ${NPROC}) static_lib
-libkv_a_CXXFLAGS += -I rocksdb/include -fPIC
+	cd ${srcdir}/rocksdb && CC="${CC}" CXX="${CXX}" EXTRA_CXXFLAGS=-fPIC PORTABLE=1 $(MAKE) -j$(shell ${NPROC}) static_lib
+libkv_a_CXXFLAGS += -I ${srcdir}/rocksdb/include -fPIC
 libkv_a_SOURCES += kv/RocksDBStore.cc
 libkv_a_LIBADD += rocksdb/librocksdb.a
 noinst_HEADERS += kv/RocksDBStore.h
diff --git a/src/os/Makefile.am b/src/os/Makefile.am
index 6d22778..4305fe2 100644
--- a/src/os/Makefile.am
+++ b/src/os/Makefile.am
@@ -61,7 +61,7 @@  if WITH_LIBZFS
 libos_a_SOURCES += os/filestore/ZFSFileStoreBackend.cc
 endif
 
-libos_a_CXXFLAGS = ${AM_CXXFLAGS} -I rocksdb/include -fPIC
+libos_a_CXXFLAGS = ${AM_CXXFLAGS} -I ${srcdir}/rocksdb/include -fPIC
 libos_a_LIBADD = libos_types.a libkv.a
 noinst_LIBRARIES += libos.a
 
diff --git a/src/test/Makefile-server.am b/src/test/Makefile-server.am
index fbb42e4..2aaa635 100644
--- a/src/test/Makefile-server.am
+++ b/src/test/Makefile-server.am
@@ -227,7 +227,7 @@  endif # WITH_OSD
 if WITH_SLIBROCKSDB
 unittest_rocksdb_option_static_SOURCES = test/objectstore/TestRocksdbOptionParse.cc
 unittest_rocksdb_option_static_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL)
-unittest_rocksdb_option_static_CXXFLAGS = $(UNITTEST_CXXFLAGS) ${AM_CXXFLAGS} ${LIBROCKSDB_CFLAGS} -I rocksdb/include
+unittest_rocksdb_option_static_CXXFLAGS = $(UNITTEST_CXXFLAGS) ${AM_CXXFLAGS} ${LIBROCKSDB_CFLAGS} -I ${srcdir}/rocksdb/include
 check_TESTPROGRAMS += unittest_rocksdb_option_static
 endif