chaincodelabs / libmultiprocess

C++ library and code generator making it easy to call functions and reference objects in different processes
MIT License
29 stars 20 forks source link

macOS Catalina install fails #26

Closed Sjors closed 4 years ago

Sjors commented 4 years ago

On macOS 10.15.3 with cmake version 3.16.4

brew info capnp   
capnp: stable 0.7.0 (bottled), HEAD
Data interchange format and capability-based RPC system
https://capnproto.org/
/usr/local/Cellar/capnp/0.7.0 (110 files, 11.8MB) *
build % cmake ..
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found version "1.72.0")  
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test HAVE_PTHREAD_GETNAME_NP
-- Performing Test HAVE_PTHREAD_GETNAME_NP - Success
-- Performing Test HAVE_PTHREAD_THREADID_NP
-- Performing Test HAVE_PTHREAD_THREADID_NP - Failed
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sjors/dev/libmultiprocess/build
build % make
[ 14%] Compiling Cap'n Proto schema include/mp/proxy.capnp
Scanning dependencies of target multiprocess
[ 28%] Building CXX object CMakeFiles/multiprocess.dir/include/mp/proxy.capnp.c++.o
[ 42%] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
[ 57%] Building CXX object CMakeFiles/multiprocess.dir/src/mp/util.cpp.o
[ 71%] Linking CXX static library libmultiprocess.a
[ 71%] Built target multiprocess
Scanning dependencies of target mpgen
[ 85%] Building CXX object CMakeFiles/mpgen.dir/src/mp/gen.cpp.o
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:131:23: error: use of undeclared identifier 'capnp_PREFIX'
    args.emplace_back(capnp_PREFIX "/bin/capnp");
                      ^
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:139:35: error: expected ')'
    args.emplace_back("--output=" capnp_PREFIX "/bin/capnpc-c++");
                                  ^
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:139:22: note: to match this '('
    args.emplace_back("--output=" capnp_PREFIX "/bin/capnpc-c++");
                     ^
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:150:46: error: expected ')'
        throw std::runtime_error("Invoking " capnp_PREFIX "/bin/capnp failed");
                                             ^
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:150:33: note: to match this '('
        throw std::runtime_error("Invoking " capnp_PREFIX "/bin/capnp failed");
                                ^
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:154:31: warning: 'parseDiskFile' is deprecated: Use parseFromDirectory() instead. [-Wdeprecated-declarations]
    auto file_schema = parser.parseDiskFile(src_file, src_file, import_paths);
                              ^
/usr/local/include/capnp/schema-parser.h:105:7: note: 'parseDiskFile' has been explicitly marked deprecated here
      CAPNP_DEPRECATED("Use parseFromDirectory() instead.");
      ^
/usr/local/include/capnp/common.h:57:26: note: expanded from macro 'CAPNP_DEPRECATED'
#define CAPNP_DEPRECATED KJ_DEPRECATED
                         ^
/usr/local/include/kj/common.h:186:20: note: expanded from macro 'KJ_DEPRECATED'
    __attribute__((deprecated(reason)))
                   ^
/Users/sjors/dev/libmultiprocess/src/mp/gen.cpp:555:63: error: use of undeclared identifier 'capnp_PREFIX'
    for (const char* path : {CMAKE_INSTALL_PREFIX "/include", capnp_PREFIX "/include"}) {
                                                              ^
1 warning and 4 errors generated.
make[2]: *** [CMakeFiles/mpgen.dir/src/mp/gen.cpp.o] Error 1
make[1]: *** [CMakeFiles/mpgen.dir/all] Error 2
make: *** [all] Error 2

Shouldn't cmake .. have caught this?

ryanofsky commented 4 years ago

I've only used this recently on linux, but I think I can get access to a mac machine to debug today. It seems like cmake on mac (or maybe just the homebrew cmake version) is working a little differently. The capnp_PREFIX variable should be getting set by the find_package(CapnProto) step.

It's unexpected your "cmake .." output seems to not look for CapnProto at all. Mine looks more like:

$ cmake ..
-- The CXX compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.65.1
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'capnp'
--   Found capnp, version 0.7.0
-- Checking for module 'capnp-rpc'
--   Found capnp-rpc, version 0.7.0
-- Checking for module 'capnp-json'
--   Found capnp-json, version 0.7.0
-- Checking for module 'kj'
--   Found kj, version 0.7.0
-- Checking for module 'kj-async'
--   Found kj-async, version 0.7.0
-- Checking for module 'kj-http'
--   Found kj-http, version 0.7.0
-- Checking for module 'kj-test'
--   Found kj-test, version 0.7.0
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
...

There may be more clues in generated CMakeCache.txt or include/mp/config.h files. I will try to reproduce this here