cruppstahl / upscaledb

A very fast lightweight embedded database engine with a built-in query language.
https://upscaledb.com
Apache License 2.0
569 stars 71 forks source link

Error building upscaledb 2.2.0 #90

Closed bmgandre closed 7 years ago

bmgandre commented 7 years ago

I'm trying to build the latest upscaledb release but the build stops with errors.

Environment: Linux 4.4.38 x86_64

Libraries:

boost-1.59.0
gperftools-2.5
protobuf3-3.1.0
snappy-1.1.3

Build settings:

CFLAGS="-O2 -fPIC" \
CXXFLAGS="-O2 -fPIC" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib64 \
  --build=x86_64-slackware-linux

Error:

make[3]: Entering directory '/tmp/SBo/upscaledb-2.2.0/src'
  CXX      1base/error.lo
  CXX      1base/util.lo
  CXX      1errorinducer/errorinducer.lo
  CXX      1globals/callbacks.lo
  CXX      1globals/globals.lo
  CXX      1mem/mem.lo
  CXX      1os/os.lo
  CXX      1os/os_posix.lo
  CXX      2compressor/compressor_factory.lo
  CXX      2page/page.lo
In file included from /usr/include/boost/assert.hpp:54:0,
                 from /usr/include/boost/thread/pthread/shared_mutex.hpp:23,
                 from /usr/include/boost/thread/shared_mutex.hpp:22,
                 from /usr/include/boost/thread/detail/thread_group.hpp:9,
                 from /usr/include/boost/thread/thread.hpp:13,
                 from ./1base/mutex.h:31,
                 from ./1base/spinlock.h:37,
                 from ./2page/page.h:30,
                 from 2page/page.cc:25:
./1base/spinlock.h: In member function 'void upscaledb::Spinlock::unlock()':
./1base/spinlock.h:108:14: error: 'm_owner' was not declared in this scope
       assert(m_owner == boost::this_thread::get_id());
bmgandre commented 7 years ago

If I install libuv, I get even more errors:

Environment: Linux 4.4.38 x86_64

Libraries:

boost-1.59.0
gperftools-2.5
protobuf3-3.1.0
snappy-1.1.3
libuv-1.9.1

Build settings:

CFLAGS="-O2 -fPIC" \
CXXFLAGS="-O2 -fPIC" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib64 \
  --build=x86_64-slackware-linux

Error:

make[3]: Entering directory '/tmp/SBo/upscaledb-2.2.0/src/5server'
  CXX      upsserver.lo
In file included from /usr/include/boost/assert.hpp:54:0,
                 from /usr/include/boost/atomic/detail/atomic_template.hpp:21,
                 from /usr/include/boost/atomic/atomic.hpp:22,
                 from /usr/include/boost/atomic.hpp:12,
                 from ../1base/spinlock.h:33,
                 from ../2page/page.h:30,
                 from ../3btree/btree_node.h:24,
                 from ../3btree/btree_index.h:32,
                 from ../4db/db_local.h:36,
                 from upsserver.cc:36:
../1base/spinlock.h: In member function 'void upscaledb::Spinlock::unlock()':
../1base/spinlock.h:108:14: error: 'm_owner' was not declared in this scope
       assert(m_owner == boost::this_thread::get_id());
              ^
In file included from /usr/include/google/protobuf/stubs/port.h:62:0,
                 from /usr/include/google/protobuf/stubs/common.h:40,
                 from ../2protobuf/messages.pb.h:9,
                 from ../2protobuf/protocol.h:34,
                 from upsserver.cc:33:
../3btree/btree_node.h: In member function 'bool upscaledb::PBtreeNode::is_leaf() const':
../3btree/btree_node.h:133:14: error: invalid types 'const uint32_t {aka const unsigned int}[int]' for array subscript
       return isset(flags_, kLeafNode);
              ^
upsserver.cc: In function 'void upscaledb::on_new_connection(uv_stream_t*, int)':
upsserver.cc:2046:71: error: invalid conversion from 'uv_buf_t (*)(uv_handle_t*, size_t) {aka uv_buf_t (*)(uv_handle_s*, long unsigned int)}' to 'uv_alloc_cb {aka void (*)(uv_handle_s*, long unsigned int, uv_buf_t*)}' [-fpermissive]
     uv_read_start((uv_stream_t *)client, on_alloc_buffer, on_read_data);
                                                                       ^
In file included from upsserver.cc:26:0:
/usr/include/uv.h:466:15: note:   initializing argument 2 of 'int uv_read_start(uv_stream_t*, uv_alloc_cb, uv_read_cb)'
 UV_EXTERN int uv_read_start(uv_stream_t*,
               ^
upsserver.cc:2046:71: error: invalid conversion from 'void (*)(uv_stream_t*, ssize_t, uv_buf_t) {aka void (*)(uv_stream_s*, long int, uv_buf_t)}' to 'uv_read_cb {aka void (*)(uv_stream_s*, long int, const uv_buf_t*)}' [-fpermissive]
     uv_read_start((uv_stream_t *)client, on_alloc_buffer, on_read_data);
                                                                       ^
In file included from upsserver.cc:26:0:
/usr/include/uv.h:466:15: note:   initializing argument 3 of 'int uv_read_start(uv_stream_t*, uv_alloc_cb, uv_read_cb)'
 UV_EXTERN int uv_read_start(uv_stream_t*,
               ^
upsserver.cc: In function 'ups_status_t ups_srv_init(ups_srv_config_t*, ups_srv_t**)':
upsserver.cc:2093:50: error: too few arguments to function 'int uv_ip4_addr(const char*, int, sockaddr_in*)'
   bind_addr = uv_ip4_addr("0.0.0.0", config->port);
                                                  ^
In file included from upsserver.cc:26:0:
/usr/include/uv.h:1371:15: note: declared here
 UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr);
               ^
upsserver.cc:2094:38: error: cannot convert 'sockaddr_in' to 'const sockaddr*' for argument '2' to 'int uv_tcp_bind(uv_tcp_t*, const sockaddr*, unsigned int)'
   uv_tcp_bind(&srv->server, bind_addr);
                                      ^
upsserver.cc:2110:52: error: invalid conversion from 'void (*)(uv_async_t*, int) {aka void (*)(uv_async_s*, int)}' to 'uv_async_cb {aka void (*)(uv_async_s*)}' [-fpermissive]
   uv_async_init(srv->loop, &srv->async, on_async_cb);
                                                    ^
In file included from upsserver.cc:26:0:
/usr/include/uv.h:765:15: note:   initializing argument 3 of 'int uv_async_init(uv_loop_t*, uv_async_t*, uv_async_cb)'
 UV_EXTERN int uv_async_init(uv_loop_t*,
               ^
Makefile:465: recipe for target 'upsserver.lo' failed
make[3]: *** [upsserver.lo] Error 1
cruppstahl commented 7 years ago

The first issue is caused by a bug in the configure script. If you overwrite CFLAGS then the configure script does not set -DNDEBUG. Here is a workaround:

CFLAGS="-O2 -fPIC -DNDEBUG" \
CXXFLAGS="-O2 -fPIC -DNDEBUG" \
./configure ...

The libuv issue is caused by API changes in libuv. I use their branch v0.11.22 ("git checkout v0.11.22").

Both issues are fixed in 2.2.1 (I removed the libuv dependency and replaced it with boost::asio). 2.2.1 will be released in 1-2 weeks.

bmgandre commented 7 years ago

Ok. It worked for now.