bytecodealliance / wasmtime-cpp

Apache License 2.0
86 stars 18 forks source link

Compiler error on ubuntu 18.04 + stock gcc 7.5 #11

Closed dshiell15 closed 3 years ago

dshiell15 commented 3 years ago

Trying to compile on Ubuntu 18.04 with gcc 7.5 seems to be unhappy due to some kind of circular definition between ExternRef and Val? Looked briefly, but didn't see anything obvious...

I see this error when trying to compile (key message in bold):

derek@local-dev:~/projects/wasmtime-cpp/build$ make
[  0%] Built target wasmtime-cpp
[  3%] Building CXX object examples/CMakeFiles/interrupt.dir/interrupt.cc.o
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/nested_exception.h:40,
                 from /usr/include/c++/7/exception:143,
                 from /usr/include/c++/7/ios:39,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/fstream:38,
                 from /home/derek/projects/wasmtime-cpp/examples/interrupt.cc:21:
/usr/include/c++/7/type_traits: In instantiation of ‘struct std::__and_<std::is_copy_constructible<wasmtime::ExternRef>, std::is_constructible<wasmtime::ExternRef, const wasmtime::ExternRef&> >’:
/usr/include/c++/7/any:181:58:   required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous>, typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const wasmtime::ExternRef&; _Tp = wasmtime::ExternRef; _Mgr = std::any::_Manager_internal<wasmtime::ExternRef>; typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous> = <missing>; typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> = <missing>]’
/usr/include/c++/7/type_traits:973:18:   required by substitution of ‘template<class _Tp, class _Arg, class> static std::true_type std::__do_is_direct_constructible_impl::__test(int) [with _Tp = wasmtime::ExternRef; _Arg = const wasmtime::ExternRef&; <template-parameter-1-3> = <missing>]’
/usr/include/c++/7/type_traits:984:41:   required from ‘struct std::__is_direct_constructible_impl<wasmtime::ExternRef, const wasmtime::ExternRef&>’
/usr/include/c++/7/type_traits:143:12:   required from ‘struct std::__and_<std::is_destructible<wasmtime::ExternRef>, std::__is_direct_constructible_impl<wasmtime::ExternRef, const wasmtime::ExternRef&> >’
/usr/include/c++/7/type_traits:988:12:   required from ‘struct std::__is_direct_constructible_new_safe<wasmtime::ExternRef, const wasmtime::ExternRef&>’
/usr/include/c++/7/type_traits:1070:12:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/7/type_traits:1118:12:   required from ‘struct std::__is_constructible_impl<wasmtime::ExternRef, const wasmtime::ExternRef&>’
/usr/include/c++/7/type_traits:1129:12:   required from ‘struct std::is_constructible<wasmtime::ExternRef, const wasmtime::ExternRef&>’
/usr/include/c++/7/type_traits:1141:12:   required from ‘struct std::__is_copy_constructible_impl<wasmtime::ExternRef, true>’
/usr/include/c++/7/type_traits:1147:12:   required from ‘struct std::is_copy_constructible<wasmtime::ExternRef>’
/usr/include/c++/7/optional:453:11:   required from ‘class std::optional<wasmtime::ExternRef>’
/home/derek/projects/wasmtime-cpp/include/wasmtime.hh:1879:37:   required from here
**/usr/include/c++/7/type_traits:143:12: error: incomplete type ‘std::is_copy_constructible<wasmtime::ExternRef>’ used in nested name specifier
     struct __and_<_B1, _B2>**
            ^~~~~~~~~~~~~~~~
/usr/include/c++/7/type_traits: In instantiation of ‘struct std::__and_<std::is_copy_constructible<wasmtime::Val>, std::is_constructible<wasmtime::Val, const wasmtime::Val&> >’:
/usr/include/c++/7/any:181:58:   required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous>, typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const wasmtime::Val&; _Tp = wasmtime::Val; _Mgr = std::any::_Manager_external<wasmtime::Val>; typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous> = <missing>; typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> = <missing>]’
/usr/include/c++/7/type_traits:973:18:   required by substitution of ‘template<class _Tp, class _Arg, class> static std::true_type std::__do_is_direct_constructible_impl::__test(int) [with _Tp = wasmtime::ExternRef; _Arg = const wasmtime::Val&; <template-parameter-1-3> = <missing>]’
/usr/include/c++/7/type_traits:984:41:   required from ‘struct std::__is_direct_constructible_impl<wasmtime::ExternRef, const wasmtime::Val&>’
/usr/include/c++/7/type_traits:143:12:   required from ‘struct std::__and_<std::is_destructible<wasmtime::ExternRef>, std::__is_direct_constructible_impl<wasmtime::ExternRef, const wasmtime::Val&> >’
/usr/include/c++/7/type_traits:988:12:   required from ‘struct std::__is_direct_constructible_new_safe<wasmtime::ExternRef, const wasmtime::Val&>’
/usr/include/c++/7/type_traits:1070:12:   [ skipping 13 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/usr/include/c++/7/type_traits:1078:12:   required from ‘struct std::__is_direct_constructible<wasmtime::Val, const wasmtime::Val&>’
/usr/include/c++/7/type_traits:1118:12:   required from ‘struct std::__is_constructible_impl<wasmtime::Val, const wasmtime::Val&>’
/usr/include/c++/7/type_traits:1129:12:   required from ‘struct std::is_constructible<wasmtime::Val, const wasmtime::Val&>’
/usr/include/c++/7/type_traits:1141:12:   required from ‘struct std::__is_copy_constructible_impl<wasmtime::Val, true>’
/usr/include/c++/7/type_traits:1147:12:   required from ‘struct std::is_copy_constructible<wasmtime::Val>’
/usr/include/c++/7/optional:453:11:   required from ‘class std::optional<wasmtime::Val>’
**/home/derek/projects/wasmtime-cpp/include/wasmtime.hh:2300:65:   required from here
/usr/include/c++/7/type_traits:143:12: error: incomplete type ‘std::is_copy_constructible<wasmtime::Val>’ used in nested name specifier**
examples/CMakeFiles/interrupt.dir/build.make:75: recipe for target 'examples/CMakeFiles/interrupt.dir/interrupt.cc.o' failed
make[2]: *** [examples/CMakeFiles/interrupt.dir/interrupt.cc.o] Error 1
CMakeFiles/Makefile2:212: recipe for target 'examples/CMakeFiles/interrupt.dir/all' failed
make[1]: *** [examples/CMakeFiles/interrupt.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
alexcrichton commented 3 years ago

Thanks for the report! I'm not so hot on C++ errors myself unfortunately, but I'd be happy to take a PR to fix this!