does not compile on MacOS with current MacOSX11.3.sdk
Closed this issue · 4 comments
djabi@x:~/github/inicpp/build$ cmake -GNinja ..
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/djabi/github/inicpp/build
djabi@x:~/github/inicpp/build$ ninja
[2/9] Building CXX object CMakeFiles/inicpp.dir/src/config.cpp.o
In file included from ../src/config.cpp:1:
In file included from ../include/inicpp/config.h:10:
../include/inicpp/option.h:52:28: warning: function 'convert_single_value' is not needed and will not be emitted [-Wunneeded-internal-declaration]
template <> string_ini_t convert_single_value(const option_value &value, const std::string &)
^
1 warning generated.
[3/9] Building CXX object CMakeFiles/inicpp.dir/src/section.cpp.o
In file included from ../src/section.cpp:1:
In file included from ../include/inicpp/section.h:12:
../include/inicpp/option.h:52:28: warning: function 'convert_single_value' is not needed and will not be emitted [-Wunneeded-internal-declaration]
template <> string_ini_t convert_single_value(const option_value &value, const std::string &)
^
1 warning generated.
[4/9] Building CXX object CMakeFiles/inicpp.dir/src/schema.cpp.o
In file included from ../src/schema.cpp:1:
In file included from ../include/inicpp/schema.h:7:
In file included from ../include/inicpp/config.h:10:
../include/inicpp/option.h:52:28: warning: function 'convert_single_value' is not needed and will not be emitted [-Wunneeded-internal-declaration]
template <> string_ini_t convert_single_value(const option_value &value, const std::string &)
^
1 warning generated.
[5/9] Building CXX object CMakeFiles/inicpp.dir/src/section_schema.cpp.o
In file included from ../src/section_schema.cpp:1:
In file included from ../include/inicpp/section_schema.h:9:
In file included from ../include/inicpp/option_schema.h:11:
../include/inicpp/option.h:52:28: warning: function 'convert_single_value' is not needed and will not be emitted [-Wunneeded-internal-declaration]
template <> string_ini_t convert_single_value(const option_value &value, const std::string &)
^
1 warning generated.
[6/9] Building CXX object CMakeFiles/inicpp.dir/src/option_schema.cpp.o
FAILED: CMakeFiles/inicpp.dir/src/option_schema.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -I../include/inicpp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -Wall -Wextra -Wdeprecated -Wconversion -Wold-style-cast -Wformat -std=gnu++17 -MD -MT CMakeFiles/inicpp.dir/src/option_schema.cpp.o -MF CMakeFiles/inicpp.dir/src/option_schema.cpp.o.d -o CMakeFiles/inicpp.dir/src/option_schema.cpp.o -c ../src/option_schema.cpp
In file included from ../src/option_schema.cpp:1:
In file included from ../include/inicpp/option_schema.h:11:
../include/inicpp/option.h:256:17: error: no viable conversion from 'std::__1::__bit_const_reference<std::__1::vector>' to 'inicpp::option_value' (aka 'variant<bool, long long, unsigned long long, double, inicpp::internal_enum_type, basic_string>')
option_value new_option_value = value;
^ ~~~~~
../include/inicpp/option.h:225:31: note: in instantiation of function template specialization 'inicpp::option::add_to_list<std::__1::__bit_const_reference<std::__1::vector>>' requested here
for (auto &&item : list) { add_to_list(item); }
^
../src/option_schema.cpp:67:10: note: in instantiation of function template specialization 'inicpp::option::set_list' requested here
opt.set_list(parse_typed_option_items(
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/variant:1204:3: note: candidate constructor not viable: no known conversion from 'std::__1::__bit_const_reference<std::__1::vector>' to 'const std::__1::variant<bool, long long, unsigned long long, double, inicpp::internal_enum_type, std::__1::basic_string> &' for 1st argument
variant(const variant&) = default;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/variant:1205:3: note: candidate constructor not viable: no known conversion from 'std::__1::__bit_const_reference<std::__1::vector>' to 'std::__1::variant<bool, long long, unsigned long long, double, inicpp::internal_enum_type, std::__1::basic_string> &&' for 1st argument
variant(variant&&) = default;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/variant:1217:13: note: candidate template ignored: substitution failure [with _Arg = std::__1::__bit_const_reference<std::__1::vector> &, $1 = 0, $2 = 0, $3 = 0]: no type named 'type' in 'std::__1::invoke_result<std::__1::__variant_detail::__all_overloads<std::__1::__variant_detail::__overload<bool, 0>, std::__1::__variant_detail::__overload<long long, 1>, std::__1::__variant_detail::__overload<unsigned long long, 2>, std::__1::__variant_detail::__overload<double, 3>, std::__1::__variant_detail::__overload<inicpp::internal_enum_type, 4>, std::__1::__variant_detail::__overload<std::__1::basic_string, 5>>, std::__1::__bit_const_reference<std::__1::vector> &, std::__1::__bit_const_reference<std::__1::vector> &>'
constexpr variant(_Arg&& __arg) noexcept(
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/variant:1226:22: note: explicit constructor is not a candidate
explicit constexpr variant(
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/variant:1254:22: note: explicit constructor is not a candidate
explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept(
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/__bit_reference:145:49: note: candidate function
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
^
In file included from ../src/option_schema.cpp:1:
In file included from ../include/inicpp/option_schema.h:4:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/functional:504:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/memory:677:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/tuple:1067:5: error: static_assert failed due to requirement 'value != __not_found' "type not found in type list"
static_assert(value != __not_found, "type not found in type list" );
^ ~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/tuple:1080:14: note: in instantiation of template class 'std::__1::__find_detail::__find_exactly_one_checked<std::__1::__bit_const_reference<std::__1::vector>, bool, long long, unsigned long long, double, inicpp::internal_enum_type, std::__1::basic_string>' requested here
: public __find_detail::__find_exactly_one_checked<_T1, _Args...> {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/c++/v1/variant:1381:30: note: in instantiation of template class 'std::__1::__find_exactly_one_t<std::__1::__bit_const_reference<std::__1::vector>, bool, long long, unsigned long long, double, inicpp::internal_enum_type, std::__1::basic_string>' requested here
return __holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
^
../include/inicpp/option.h:138:16: note: in instantiation of function template specialization 'std::__1::holds_alternative<std::__1::__bit_const_reference<std::__1::vector>, bool, long long, unsigned long long, double, inicpp::internal_enum_type, std::_1::basic_string>' requested here
return std::holds_alternative(values[0]);
^
../include/inicpp/option.h:255:9: note: in instantiation of function template specialization 'inicpp::option::holds_type<std::__1::__bit_const_reference<std::__1::vector>>' requested here
if (!holds_type()) { throw bad_cast_exception("Cannot cast to requested type"); }
^
../include/inicpp/option.h:225:31: note: in instantiation of function template specialization 'inicpp::option::add_to_list<std::__1::__bit_const_reference<std::__1::vector>>' requested here
for (auto &&item : list) { add_to_list(item); }
^
../src/option_schema.cpp:67:10: note: in instantiation of function template specialization 'inicpp::option::set_list' requested here
opt.set_list(parse_typed_option_items(
^
2 errors generated.
[8/9] Building CXX object CMakeFiles/inicpp.dir/src/parser.cpp.o
ninja: build stopped: subcommand failed.
Hi,
well, it seems as a common problem on Mac. std::vector<bool>
is implemented differently and thus elements are not bool
but pointer to a single bit. Right now I don't know how to easily fix that, I could really use some help from experienced Mac developer.
Thanks for the report,
-Petr
Experiencing the same issue when compiling on termux
It's not exactly a Mac-originated issue, it's stdlib's one
Fixed by #23