basiliscos / cpp-bredis

Boost::ASIO low-level redis client (connector)
MIT License
147 stars 36 forks source link

Build instructions for linux #9

Open dcolley opened 6 years ago

dcolley commented 6 years ago

I'm trying to build the examples, are there any build instructions for linux?

I tried ccmake . make

but I get

$ make
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.5)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/derek/Downloads/cpp-bredis/examples
Scanning dependencies of target stream-parse
[ 16%] Building CXX object CMakeFiles/stream-parse.dir/stream-parse.o
/home/derek/Downloads/cpp-bredis/examples/stream-parse.cpp:30:33: fatal error: bredis/Connection.hpp: No such file or directory
compilation terminated.
CMakeFiles/stream-parse.dir/build.make:62: recipe for target 'CMakeFiles/stream-parse.dir/stream-parse.o' failed
make[2]: *** [CMakeFiles/stream-parse.dir/stream-parse.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/stream-parse.dir/all' failed
make[1]: *** [CMakeFiles/stream-parse.dir/all] Error 2
Makefile:85: recipe for target 'all' failed
make: *** [all] Error 2

I can find the include files, but I don't know how to config the make process to see them...

basiliscos commented 6 years ago

Derek,

bredis is header-only library. That means it usually should not build, but just copied the "include" dir right into your project.

The build in the sources exists only for building examples and tests.

Here is working process:

pwd
/home/basiliscos/development/cpp/cpp-bredis
mkdir build && cd build
cmake -DBOOST_ROOT=/home/basiliscos/development/cpp/boost/boost_1_64_0 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is Clang 3.9.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.64.0
-- Found the following Boost libraries:
--   chrono
--   coroutine
--   context
--   filesystem
--   regex
--   system
--   thread
--   date_time
--   atomic
-- boost inc: /home/basiliscos/development/cpp/boost/boost_1_64_0
-- boost libs: /home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_chrono.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_coroutine.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_context.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_filesystem.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_regex.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_system.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_thread.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_date_time.so/home/basiliscos/development/cpp/boost/boost_1_64_0/stage/lib/libboost_atomic.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/basiliscos/development/cpp/cpp-bredis/build
make -j8
...

Please note, that tests depends strictly on boost 1.64, while the library itself has no such a strict requirements.

cmake_minimum_required(VERSION 3.5)

It seems there is a problem with your cmake. Which version do you have? Try to patch CMakeFiles.txt to lower version and may be it will work. Then submit PR :)

if it will not, try to upgrade your cmake.