Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ardb does not compile in OSX (mavericks, Xcode 5.0.2) #25

Closed
sscarduzio opened this issue Feb 16, 2014 · 14 comments
Closed

Ardb does not compile in OSX (mavericks, Xcode 5.0.2) #25

sscarduzio opened this issue Feb 16, 2014 · 14 comments

Comments

@sscarduzio
Copy link

Hi, I'm trying to compile master branch from source, but I cannot get this error passed:

$ make
cd src && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
g++ -c -Wall -g  -O2  -fPIC -D__STDC_FORMAT_MACROS -DARDB_VERSION='"0.6.0"'  -I./ -I/tmp/ardb/src/../deps/cpp-btree -I/tmp/ardb/src/../deps/lua/src -I/tmp/ardb/src/../deps/snappy-1.1.1 -I/tmp/ardb/src/../deps/zookeeper-3.4.5/include -I/tmp/ardb/src/../deps/zookeeper-3.4.5/generated -I/tmp/ardb/src/../deps/leveldb-1.16.0/include ardb.cpp -o ardb.o
In file included from ardb.cpp:30:
In file included from ./ardb.hpp:38:
In file included from ./common.hpp:171:
In file included from /tmp/ardb/src/../deps/cpp-btree/btree_set.h:27:
/tmp/ardb/src/../deps/cpp-btree/btree.h:114:10: fatal error: 'tr1/type_traits' file not found
#include CPP_BTREE_TYPE_TRAITS_HEADER
         ^
/tmp/ardb/src/../deps/cpp-btree/btree_config.h:32:40: note: expanded from macro 'CPP_BTREE_TYPE_TRAITS_HEADER'
  #define CPP_BTREE_TYPE_TRAITS_HEADER <tr1/type_traits>
                                       ^
1 error generated.
make[1]: *** [ardb.o] Error 1
make: *** [all] Error 2

I got stuck, could you please help or provide documentation for the procedure under OSX?

@yinqiwen
Copy link
Owner

Just commit a fix for this in 'develop' branch f58b41d

@sscarduzio
Copy link
Author

Thank you. It goes forward now. However I still have warnings and errors and compilation fails. Please see output: http://pastebin.com/XMkVUWWT

@yinqiwen
Copy link
Owner

The compiler complains about a struct like below at "std::deque" which T is the nested struct name. What is the version of the g++? I remember that it's valid for g++ 4.2 at OSX 10.7.

    struct RedisReply
     {
            int type;
            std::string str;
            int64_t integer;
            double double_value;
            std::deque<RedisReply> elements;
              }

@sscarduzio
Copy link
Author

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

@yinqiwen
Copy link
Owner

There is an article talking about it tens of years ago , it seems that different stl library has different behavior.
http://www.drdobbs.com/the-standard-librarian-containers-of-inc/184403814

I do not have a mac to test now. Is there any compile flags for clang c++ to compile the source contains code snippet below?

  struct RedisReply
 {
        int type;
        std::string str;
        int64_t integer;
        double double_value;
        std::deque<RedisReply> elements;
          }

@hit9
Copy link

hit9 commented Jul 24, 2014

I meet the similar error

@yinqiwen
Copy link
Owner

It seems ardb could be compiled in OSX now. Travis-CI status shows the build passed in OSX

@sscarduzio
Copy link
Author

it builds with leveldb, lmdb, but not with rocksdb. Here's the log.

$ make
cd src && /Applications/Xcode.app/Contents/Developer/usr/bin/make all
g++ -o ardb-test engine/rocksdb_engine.o         ../test/test_suite.o ardb.o codec.o comparator.o config.o cron.o logger.o iterator.o network.o options.o statistics.o cache/cache.o  common/util/config_helper.o  common/util/datagram_packet.o  common/util/file_helper.o  common/util/math_helper.o  common/util/mmap.o  common/util/network_helper.o  common/util/redis_helper.o  common/util/socket_address.o  common/util/string_helper.o  common/util/system_helper.o  common/util/time_helper.o  common/util/exception/api_exception.o  common/thread/event_condition.o  common/thread/thread.o  common/buffer/buffer.o  common/buffer/buffer_helper.o  common/geo/geohash_helper.o  common/util/rand.o  common/util/sds.o  common/util/sha1.o  common/redis/crc64.o  common/redis/endianconv.o  common/redis/intset.o  common/redis/lzf_c.o  common/redis/lzf_d.o  common/redis/ziplist.o  common/redis/zipmap.o  common/geo/geohash.o  common/channel/channel.o  common/channel/channel_handler_context.o  common/channel/channel_helper.o  common/channel/channel_pipeline.o  common/channel/channel_service.o  common/channel/socket/clientsocket_channel.o  common/channel/socket/datagram_channel.o  common/channel/socket/serversocket_channel.o  common/channel/socket/socket_channel.o  common/channel/fifo/fifo_channel.o  common/channel/codec/delimiter_frame_decoder.o  common/channel/codec/int_header_frame_decoder.o  common/channel/codec/redis_command_codec.o  common/channel/codec/redis_reply.o  common/channel/codec/redis_reply_codec.o  common/channel/timer/timer.o  common/channel/timer/timer_channel.o  common/channel/timer/timer_task_queue.o  common/channel/signal/signal_channel.o  common/channel/signal/soft_signal_channel.o  common/channel/redis/ae.o  common/channel/redis/zmalloc.o  command/connection.o  command/geo.o  command/hyperloglog.o  command/keys.o  command/lua_scripting.o  command/pubsub.o  command/server.o  command/slowlog.o  command/sort.o  command/t_bitset.o  command/t_hash.o  command/t_list.o  command/t_set.o  command/t_string.o  command/t_zset.o  command/transaction.o  replication/backup.o  replication/master.o  replication/rdb.o  replication/repl_backlog.o  replication/slave.o  /tmp/ardb/src/../deps/rocksdb-rocksdb-3.4/librocksdb.a /tmp/ardb/src/../deps/snappy-1.1.2/.libs/libsnappy.a /tmp/ardb/src/../deps/lua/src/liblua.a  /tmp/ardb/src/../deps/snappy-1.1.2/.libs/libsnappy.a -lpthread -lz -lbz2 -lrt
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [test] Error 1
make: *** [all] Error 2

@yinqiwen
Copy link
Owner

You can remove '-lrt' in Makefile at line 173 for MacOS, it's a link options for linux.
https://github.com/yinqiwen/ardb/blob/master/src/Makefile#L173

@sscarduzio
Copy link
Author

Yep that made it compile. Tests pass too. However I can't get ardb conclude a redis-benchmark. It systematically gets stuck in LPOP. Not sure if this is related to the platform or it's a generic bug (I'm downloading a virtual machine to test this on Linux).
screenshot 2014-08-31 09 53 57

@yinqiwen
Copy link
Owner

The reply type is not set if the key is not exist for 'lpop', just commit a fix for it.

@sscarduzio
Copy link
Author

Yep, that's fixed now. I tested on OSX.
Back to the original issue, now ARDB build and works, but I wanted to share with you the stderr of the make process which includes a number of warnings.

http://privatepaste.com/download/7312998b60

@yinqiwen
Copy link
Owner

Most warnings are from 'cpp-btree', it's OK since it's a mature lib from google. The others are also could be ignored.

@sscarduzio
Copy link
Author

ok @yinqiwen I'm closing this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants