thesamet / rpcz

RPC implementation for Protocol Buffers over ZeroMQ
http://code.google.com/p/rpcz/
Apache License 2.0
113 stars 40 forks source link

Installation on OS/X #13

Closed itamaro closed 9 years ago

itamaro commented 9 years ago

The README mentions that rpcz is tested on OS/X, but there are no installation instructions for OS/X.

I tried to improvise, but I didn't get very far...

I used Homebrew to install all dependencies (unfortunately I could not find a formula for installing rpcz using Homebrew - that would have been nice), and here's where I failed:

~/work/rpcz/build (master)>cmake .. -Drpcz_build_examples=0 -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
-- The C compiler identification is AppleClang 6.1.0.6020053
-- The CXX compiler identification is AppleClang 6.1.0.6020053
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type: Release
-- Found PROTOBUF: /usr/local/lib/libprotobuf.dylib
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   thread
--   program_options
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.28")
CMake Error at /usr/local/Cellar/cmake/3.3.1/share/cmake/Modules/FindPkgConfig.cmake:112 (elseif):
  given arguments:

    "VERSION_LESS" "3.1"

  Unknown arguments specified
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.3.1/share/cmake/Modules/FindPkgConfig.cmake:501 (_pkgconfig_parse_options)
  cmake_modules/LibFindMacros.cmake:27 (pkg_check_modules)
  cmake_modules/FindZeroMQ.cmake:12 (libfind_pkg_check_modules)
  CMakeLists.txt:14 (find_package)

-- Configuring incomplete, errors occurred!
See also "/Users/itamar/work/rpcz/build/CMakeFiles/CMakeOutput.log".
xdmiodz commented 9 years ago

Hi,

Looks like it's a cmake issue, I found something similar here https://github.com/ryanmelt/qtbindings/issues/106

itamaro commented 9 years ago

Thanks.

I tried cmake .. -Drpcz_build_examples=0 -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_MINIMUM_REQUIRED_VERSION=3.3 and got an error about ZeroMQ includes missing, so I specified the include path explicitly like this: cmake .. -Drpcz_build_examples=0 -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_MINIMUM_REQUIRED_VERSION=3.3 -DZeroMQ_INCLUDE_DIR=/usr/local/include/ seemed to finish OK, but then make fails:

~/work/rpcz/build (master)>make
[  4%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/application.cc.o
/Users/itamar/work/rpcz/src/rpcz/application.cc:18:10: fatal error: 'zmq.hpp' file not found
#include <zmq.hpp>
         ^
1 error generated.
make[2]: *** [src/rpcz/CMakeFiles/rpcz.dir/application.cc.o] Error 1
make[1]: *** [src/rpcz/CMakeFiles/rpcz.dir/all] Error 2
make: *** [all] Error 2

I have zmq.h in /usr/loca/include. I don't understand where zmq.hpp should be coming from...

xdmiodz commented 9 years ago

It's from this project https://github.com/zeromq/cppzmq

itamaro commented 9 years ago

Thanks again!

Moving forward:

~/work/rpcz/build (master)>make
[  4%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/application.cc.o
[  9%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/clock.cc.o
[ 13%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/connection_manager.cc.o
/Users/itamar/work/rpcz/src/rpcz/connection_manager.cc:338:9: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
    if (!iter.next().size() == 0) {
        ^                   ~~
/Users/itamar/work/rpcz/src/rpcz/connection_manager.cc:338:9: note: add parentheses after the '!' to evaluate the comparison first
    if (!iter.next().size() == 0) {
        ^
         (                      )
/Users/itamar/work/rpcz/src/rpcz/connection_manager.cc:338:9: note: add parentheses around left hand side expression to silence this warning
    if (!iter.next().size() == 0) {
        ^
        (                  )
/Users/itamar/work/rpcz/src/rpcz/connection_manager.cc:379:23: warning: private field 'connection_manager_' is not used [-Wunused-private-field]
  connection_manager* connection_manager_;
                      ^
2 warnings generated.
[ 18%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/reactor.cc.o
[ 22%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/rpc.cc.o
[ 27%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/rpc_channel_impl.cc.o
[ 31%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/server.cc.o
[ 36%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/sync_event.cc.o
[ 40%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/zmq_utils.cc.o
[ 45%] Building CXX object src/rpcz/CMakeFiles/rpcz.dir/rpcz.pb.cc.o
[ 50%] Linking CXX shared library librpcz.dylib
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      __GLOBAL__sub_I_application.cc in application.cc.o
      rpcz::connection_manager::~connection_manager() in connection_manager.cc.o
      boost::thread_group::join_all() in connection_manager.cc.o
      boost::thread::start_thread() in connection_manager.cc.o
      boost::condition_variable::condition_variable() in connection_manager.cc.o
      boost::mutex::mutex() in connection_manager.cc.o
      boost::unique_lock<boost::mutex>::unlock() in connection_manager.cc.o
      ...
  "boost::system::generic_category()", referenced from:
      __GLOBAL__sub_I_application.cc in application.cc.o
      __GLOBAL__sub_I_connection_manager.cc in connection_manager.cc.o
      __GLOBAL__sub_I_rpc.cc in rpc.cc.o
      __GLOBAL__sub_I_rpc_channel_impl.cc in rpc_channel_impl.cc.o
      __GLOBAL__sub_I_server.cc in server.cc.o
      __GLOBAL__sub_I_sync_event.cc in sync_event.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/rpcz/librpcz.dylib] Error 1
make[1]: *** [src/rpcz/CMakeFiles/rpcz.dir/all] Error 2
make: *** [all] Error 2
xdmiodz commented 9 years ago

Could you please show output of ls -l /usr/local/lib/libboost_system* and make VERBOSE=1

itamaro commented 9 years ago

sure:

>ls -l /usr/local/lib/libboost_system*
lrwxr-xr-x  1 itamar  admin  47 Sep  9 14:16 /usr/local/lib/libboost_system-mt.a -> ../Cellar/boost/1.58.0/lib/libboost_system-mt.a
lrwxr-xr-x  1 itamar  admin  51 Sep  9 14:16 /usr/local/lib/libboost_system-mt.dylib -> ../Cellar/boost/1.58.0/lib/libboost_system-mt.dylib
lrwxr-xr-x  1 itamar  admin  44 Sep  9 14:16 /usr/local/lib/libboost_system.a -> ../Cellar/boost/1.58.0/lib/libboost_system.a
lrwxr-xr-x  1 itamar  admin  48 Sep  9 14:16 /usr/local/lib/libboost_system.dylib -> ../Cellar/boost/1.58.0/lib/libboost_system.dylib

>make VERBOSE=1
/usr/local/Cellar/cmake/3.3.1/bin/cmake -H/Users/itamar/work/rpcz -B/Users/itamar/work/rpcz/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_progress_start /Users/itamar/work/rpcz/build/CMakeFiles /Users/itamar/work/rpcz/build/CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make -f src/rpcz/CMakeFiles/rpcz.dir/build.make src/rpcz/CMakeFiles/rpcz.dir/depend
cd /Users/itamar/work/rpcz/build && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_depends "Unix Makefiles" /Users/itamar/work/rpcz /Users/itamar/work/rpcz/src/rpcz /Users/itamar/work/rpcz/build /Users/itamar/work/rpcz/build/src/rpcz /Users/itamar/work/rpcz/build/src/rpcz/CMakeFiles/rpcz.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make -f src/rpcz/CMakeFiles/rpcz.dir/build.make src/rpcz/CMakeFiles/rpcz.dir/build
[  4%] Linking CXX shared library librpcz.dylib
cd /Users/itamar/work/rpcz/build/src/rpcz && /usr/local/Cellar/cmake/3.3.1/bin/cmake -E cmake_link_script CMakeFiles/rpcz.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++   -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -O3 -DNDEBUG -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names  -o librpcz.dylib -install_name /Users/itamar/work/rpcz/build/src/rpcz/librpcz.dylib CMakeFiles/rpcz.dir/application.cc.o CMakeFiles/rpcz.dir/clock.cc.o CMakeFiles/rpcz.dir/connection_manager.cc.o CMakeFiles/rpcz.dir/reactor.cc.o CMakeFiles/rpcz.dir/rpc.cc.o CMakeFiles/rpcz.dir/rpc_channel_impl.cc.o CMakeFiles/rpcz.dir/server.cc.o CMakeFiles/rpcz.dir/sync_event.cc.o CMakeFiles/rpcz.dir/zmq_utils.cc.o CMakeFiles/rpcz.dir/rpcz.pb.cc.o /usr/local/lib/libzmq.dylib /usr/local/lib/libzmq.dylib /usr/local/lib/libprotobuf.dylib /usr/local/lib/libboost_thread-mt.dylib
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      __GLOBAL__sub_I_application.cc in application.cc.o
      rpcz::connection_manager::~connection_manager() in connection_manager.cc.o
      boost::thread_group::join_all() in connection_manager.cc.o
      boost::thread::start_thread() in connection_manager.cc.o
      boost::condition_variable::condition_variable() in connection_manager.cc.o
      boost::mutex::mutex() in connection_manager.cc.o
      boost::unique_lock<boost::mutex>::unlock() in connection_manager.cc.o
      ...
  "boost::system::generic_category()", referenced from:
      __GLOBAL__sub_I_application.cc in application.cc.o
      __GLOBAL__sub_I_connection_manager.cc in connection_manager.cc.o
      __GLOBAL__sub_I_rpc.cc in rpc.cc.o
      __GLOBAL__sub_I_rpc_channel_impl.cc in rpc_channel_impl.cc.o
      __GLOBAL__sub_I_server.cc in server.cc.o
      __GLOBAL__sub_I_sync_event.cc in sync_event.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/rpcz/librpcz.dylib] Error 1
make[1]: *** [src/rpcz/CMakeFiles/rpcz.dir/all] Error 2
make: *** [all] Error 2
xdmiodz commented 9 years ago

Ok, could you please try this patch https://github.com/xdmiodz/rpcz/blob/patch-1/src/rpcz/CMakeLists.txt. You can replace only the CMakeLists.txt, or checkout the branch as a whole.

Just for info, rpcz builds well in my OS X environment, but I use cmake3.0/boost1.57

itamaro commented 9 years ago

I pulled your entire patch-1 branch and the build completed successfully. Thanks!

thesamet commented 9 years ago

Merged @xdmiodz 's #14. Thanks everyone.

itamaro commented 9 years ago

Thanks for the quick response! :-)

@thesamet:

  1. will you be interested in a patch for OS/X installation instructions for the README? (based on homebrew)
  2. are you aware of a homebrew formula for installing rpcz? if not, assuming I will be able to contribute something that works, will you be interested in maintaining it?
thesamet commented 9 years ago

Hi Itamar,

  1. Yes, thanks!
  2. I'll not be able to maintain rpcz for OS X on homebrew myself due to time constraints, but feel free to submit and maintain it if you're interested - absolutely fine by me!

-Nadav

On Wed, Sep 9, 2015 at 11:12 PM, Itamar Ostricher notifications@github.com wrote:

Thanks for the quick response! :-)

@thesamet https://github.com/thesamet:

  1. will you be interested in a patch for OS/X installation instructions for the README? (based on homebrew)
  2. are you aware of a homebrew formula for installing rpcz? if not, assuming I will be able to contribute something that works, will you be interested in maintaining it?

— Reply to this email directly or view it on GitHub https://github.com/thesamet/rpcz/issues/13#issuecomment-139127191.

-Nadav