chaincodelabs / libmultiprocess

C++ library and code generator making it easy to call functions and reference objects in different processes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AppleClang 15.0.0.15000100 build failure

ryanofsky opened this issue · comments

Originally posted by @edilmedeiros in #91 (comment):

My build succeeded, but the tests failed.

Attached are some logs; not sure if this is a problem with my setup.

CMakeError.log
CMakeOutput.log

❯ cmake ..
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /opt/local/bin/pkg-config (found version "0.29.2")
-- Checking for module 'capnp'
--   Found capnp, version 1.0.1
-- Checking for module 'capnpc'
--   Found capnpc, version 1.0.1
-- Checking for module 'capnp-rpc'
--   Found capnp-rpc, version 1.0.1
-- Checking for module 'capnp-json'
--   Found capnp-json, version 1.0.1
-- Checking for module 'capnp-websocket'
--   Found capnp-websocket, version 1.0.1
-- Checking for module 'kj'
--   Found kj, version 1.0.1
-- Checking for module 'kj-async'
--   Found kj-async, version 1.0.1
-- Checking for module 'kj-http'
--   Found kj-http, version 1.0.1
-- Checking for module 'kj-gzip'
--   Found kj-gzip, version 1.0.1
-- Checking for module 'kj-tls'
--   Found kj-tls, version 1.0.1
-- Checking for module 'kj-test'
--   Found kj-test, version 1.0.1
-- 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 - Success
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP
-- Performing Test HAVE_PTHREAD_GETTHREADID_NP - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build


❯ make
[ 14%] Building CXX object CMakeFiles/util.dir/src/mp/util.cpp.o
[ 14%] Built target util
[ 28%] Compiling Cap'n Proto schema include/mp/proxy.capnp
[ 42%] Building CXX object CMakeFiles/multiprocess.dir/include/mp/proxy.capnp.c++.o
[ 57%] Building CXX object CMakeFiles/multiprocess.dir/src/mp/proxy.cpp.o
[ 71%] Linking CXX static library libmultiprocess.a
[ 71%] Built target multiprocess
[ 85%] Building CXX object CMakeFiles/mpgen.dir/src/mp/gen.cpp.o
[100%] Linking CXX executable mpgen
[100%] Built target mpgen


❯ make check
Consolidate compiler generated dependencies of target util
[  7%] Built target util
Consolidate compiler generated dependencies of target mpgen
[ 21%] Built target mpgen
Consolidate compiler generated dependencies of target multiprocess
[ 50%] Built target multiprocess
[ 57%] Generating mp/test/foo.capnp.h, mp/test/foo.capnp.c++, mp/test/foo.capnp.proxy.h, mp/test/foo.capnp.proxy-server.c++, mp/test/foo.capnp.proxy-client.c++, mp/test/foo.capnp.proxy-types.c++, mp/test/foo.capnp.proxy-types.h
[ 64%] Building CXX object test/CMakeFiles/mptest.dir/mp/test/foo.capnp.c++.o
[ 71%] Building CXX object test/CMakeFiles/mptest.dir/mp/test/foo.capnp.proxy-server.c++.o
In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-server.c++:3:
In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-types.h:7:
In file included from /Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/test/mp/test/foo-types.h:8:
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1003:16: error: no matching function for call to 'BuildPrimitive'
    output.set(BuildPrimitive(invoke_context, std::forward<Value>(value), TypeList<decltype(output.get())>()));
               ^~~~~~~~~~~~~~
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>' requested here
        CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:842:9: note: in instantiation of function template specialization 'mp::BuildField<bool, mp::InvokeContext, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>' requested here
        BuildField(TypeList<LocalType>(), invoke_context, ListOutput<typename decltype(list)::Builds>(list, i), *it);
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, const std::vector<bool> &, mp::StructField<mp::Accessor<mp::foo_fields::Vbool, 19>, mp::test::messages::FooStruct::Builder> &>' requested here
        CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1018:5: note: in instantiation of function template specialization 'mp::BuildField<std::vector<bool>, mp::InvokeContext, const std::vector<bool> &, mp::StructField<mp::Accessor<mp::foo_fields::Vbool, 19>, mp::test::messages::FooStruct::Builder> &>' requested here
    BuildField(TypeList<Decay<decltype(field_value)>>(), invoke_context, field_output, field_value);
    ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1019:5: note: in instantiation of function template specialization 'mp::BuildOne<2UL, mp::test::FooStruct, const mp::test::FooStruct &, mp::test::messages::FooStruct::Builder &>' requested here
    BuildOne<index + 1>(param, invoke_context, output, value);
    ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1019:5: note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:699:9: note: in instantiation of function template specialization 'mp::CustomBuildField<mp::test::FooStruct, const mp::test::FooStruct &, mp::StructField<mp::Accessor<mp::foo_fields::Error, 18>, mp::test::messages::FooInterface::RaiseResults::Builder>>' requested here
        CustomBuildField(TypeList<LocalTypes...>(), Priority<3>(), context, std::forward<Values>(values)...,
        ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1360:13: note: in instantiation of function template specialization 'mp::BuildField<mp::test::FooStruct, mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, const mp::test::FooStruct &, mp::StructField<mp::Accessor<mp::foo_fields::Error, 18>, mp::test::messages::FooInterface::RaiseResults::Builder>>' requested here
            BuildField(TypeList<Exception>(), server_context, Make<StructField, Accessor>(results), exception);
            ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1135:8: note: in instantiation of function template specialization 'mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall>::invoke<mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, mp::test::FooStruct>' requested here
    fn.invoke(server_context, std::forward<Args>(args)..., static_cast<LocalType&&>(*param));
       ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:1385:16: note: in instantiation of function template specialization 'mp::PassField<mp::Accessor<mp::foo_fields::Arg, 17>, mp::test::FooStruct, mp::ServerInvokeContext<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>>, const mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall> &, mp::TypeList<>>' requested here
        return PassField<Accessor>(Priority<2>(),
               ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/build/test/mp/test/foo.capnp.proxy-server.c++:17:12: note: in instantiation of function template specialization 'mp::serverInvoke<mp::ProxyServer<mp::test::messages::FooInterface>, capnp::CallContext<mp::test::messages::FooInterface::RaiseParams, mp::test::messages::FooInterface::RaiseResults>, mp::ServerField<1, mp::Accessor<mp::foo_fields::Arg, 17>, mp::ServerExcept<mp::test::FooStruct, mp::Accessor<mp::foo_fields::Error, 18>, mp::ServerCall>>>' requested here
    return serverInvoke(*this, call_context, MakeServerField<1, Accessor<foo_fields::Arg, FIELD_IN | FIELD_BOXED>>(Make<ServerExcept, mp::test::FooStruct, Accessor<foo_fields::Error, FIELD_OUT | FIELD_BOXED>>(ServerCall())));
           ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:879:15: note: candidate function template not viable: no known conversion from 'TypeList<decltype(output.get())>' to 'TypeList<::capnp::Void>' for 3rd argument
::capnp::Void BuildPrimitive(InvokeContext& invoke_context, Value&&, TypeList<::capnp::Void>)
              ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:884:20: note: candidate function not viable: no known conversion from 'std::__bit_const_reference<std::vector<bool>>' to 'std::vector<bool>::reference' (aka '__bit_reference<vector<bool, allocator<bool>>>') for 2nd argument
inline static bool BuildPrimitive(InvokeContext& invoke_context, std::vector<bool>::reference value, TypeList<bool>)
                   ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:890:11: note: candidate template ignored: requirement 'std::is_enum<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
LocalType BuildPrimitive(InvokeContext& invoke_context,
          ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:899:11: note: candidate template ignored: requirement 'std::is_integral<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
LocalType BuildPrimitive(InvokeContext& invoke_context,
          ^
/Users/jose.edil/2-development/bitcoin/libs/libmultiprocess/include/mp/proxy-types.h:912:11: note: candidate template ignored: requirement 'std::is_floating_point<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with LocalType = bool, Value = std::__bit_const_reference<std::vector<bool>>]
LocalType BuildPrimitive(InvokeContext& invoke_context,
          ^
1 error generated.
make[3]: *** [test/CMakeFiles/mptest.dir/mp/test/foo.capnp.proxy-server.c++.o] Error 1
make[2]: *** [test/CMakeFiles/mptest.dir/all] Error 2
make[1]: *** [test/CMakeFiles/check.dir/rule] Error 2
make: *** [check] Error 2

So far not able to reproduce this with clang 15 on linux, but this seems to have something to do with support for vector<bool> serialization added recently in #86, based on a part of the error message: note: in instantiation of function template specialization 'mp::CustomBuildField<bool, std::__bit_const_reference<std::vector<bool>>, mp::ListOutput<capnp::List<bool, capnp::Kind::PRIMITIVE>>>'

I suspect that reverting the changes in the test/ folder in 1c6fb04 from #86 would work around this problem and allow the build to succeed. But I need to look into this more to see if I can reproduce this and how it should be fixed.

I was finally able to reproduce the vector<bool> problem locally with the somewhat hacky shell.nix below. Problem seems to happen with libc++ but not libstdc++.

{ pkgs ? import <nixpkgs> {} }:

let
  llvm = pkgs.llvmPackages_15;
  stdenv = llvm.libcxxStdenv;
  mkShell = pkgs.mkShell.override { stdenv = stdenv; }; 
  capnproto = pkgs.capnproto.override { stdenv = stdenv; };
in
mkShell {
  buildInputs = [
    capnproto
    # keep this line if you use bash
    pkgs.bashInteractive
  ];

  nativeBuildInputs = [
    pkgs.cmake
    pkgs.cmakeCurses
    pkgs.pkg-config
  ];
}

I'll try to build the tests with the mentioned commit this weekend as well as using a VM which uses brew to get the dependencies.

Let me know if there are other cases you would like someone to check.

I think I have a fix for this issue now: #93. Will test more and merge. Thank you for the report!