Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda-forge-ci: Use tomlplusplus conda package #381

Merged
merged 1 commit into from
Aug 11, 2021

Conversation

traversaro
Copy link
Collaborator

See conda-forge/staged-recipes#14921 for the PR that added the tomlplusplus package to conda-forge.

@traversaro
Copy link
Collaborator Author

@GiulioRomualdi I think there is little benefit to have a changelog entry for this, let me know if you think otherwise.

@traversaro
Copy link
Collaborator Author

Now the macos build fails with:

2021-07-27T20:13:51.5810350Z [159/180] Building CXX object src/ParametersHandler/TomlImplementation/CMakeFiles/ParametersHandlerTomlImplementation.dir/src/TomlImplementation.cpp.o
2021-07-27T20:13:51.5873200Z FAILED: src/ParametersHandler/TomlImplementation/CMakeFiles/ParametersHandlerTomlImplementation.dir/src/TomlImplementation.cpp.o 
2021-07-27T20:13:51.5889930Z /usr/local/miniconda/envs/test/bin/x86_64-apple-darwin13.4.0-clang++ -DFMT_SHARED -DParametersHandlerTomlImplementation_EXPORTS -DSPDLOG_COMPILED_LIB -DSPDLOG_SHARED_LIB -D_USE_MATH_DEFINES -I/Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/include -I/Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/include -I/Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/GenericContainer/include -I/Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/TextLogging/include -isystem /usr/local/miniconda/envs/test/include/eigen3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -isystem /usr/local/miniconda/envs/test/include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC -std=gnu++17 -MD -MT src/ParametersHandler/TomlImplementation/CMakeFiles/ParametersHandlerTomlImplementation.dir/src/TomlImplementation.cpp.o -MF src/ParametersHandler/TomlImplementation/CMakeFiles/ParametersHandlerTomlImplementation.dir/src/TomlImplementation.cpp.o.d -o src/ParametersHandler/TomlImplementation/CMakeFiles/ParametersHandlerTomlImplementation.dir/src/TomlImplementation.cpp.o -c /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/src/TomlImplementation.cpp
2021-07-27T20:13:51.5914030Z In file included from /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/src/TomlImplementation.cpp:10:
2021-07-27T20:13:51.5919650Z In file included from /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/include/BipedalLocomotion/ParametersHandler/TomlImplementation.h:17:
2021-07-27T20:13:51.6000690Z In file included from /usr/local/miniconda/envs/test/include/toml++/toml.h:23:
2021-07-27T20:13:51.6022370Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:204:4: error: static_assert failed due to requirement 'is_native<std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>> || is_losslessly_convertible_to_native<std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>>>' "Value initializers must be (or be promotable to) one of the TOML value types"
2021-07-27T20:13:51.6101990Z                         static_assert(
2021-07-27T20:13:51.6119220Z                         ^
2021-07-27T20:13:51.6126730Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:242:11: note: in instantiation of function template specialization 'toml::v2::impl::make_node_specialized<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.6203600Z                         return make_node_specialized(static_cast<T&&>(val));
2021-07-27T20:13:51.6220560Z                                ^
2021-07-27T20:13:51.6231760Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:333:33: note: in instantiation of function template specialization 'toml::v2::impl::make_node<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.6305370Z                                 elements.emplace_back(impl::make_node(std::forward<T>(val)));
2021-07-27T20:13:51.6324770Z                                                             ^
2021-07-27T20:13:51.6365270Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:854:5: note: in instantiation of function template specialization 'toml::v2::array::emplace_back_if_not_empty_view<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.6407520Z                                 emplace_back_if_not_empty_view(std::forward<ElemType>(val));
2021-07-27T20:13:51.6425800Z                                 ^
2021-07-27T20:13:51.6479410Z /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/include/BipedalLocomotion/ParametersHandler/TomlImplementation.tpp:145:52: note: in instantiation of function template specialization 'toml::v2::array::push_back<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.6509640Z             m_container[parameterName].as_array()->push_back(element);
2021-07-27T20:13:51.6526850Z                                                    ^
2021-07-27T20:13:51.6585650Z /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/src/TomlImplementation.cpp:106:12: note: in instantiation of function template specialization 'BipedalLocomotion::ParametersHandler::TomlImplementation::setParameterPrivate<std::__1::vector<bool, std::__1::allocator<bool>>>' requested here
2021-07-27T20:13:51.6611140Z     return setParameterPrivate(parameterName, parameter);
2021-07-27T20:13:51.6627900Z            ^
2021-07-27T20:13:51.6691220Z In file included from /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/src/TomlImplementation.cpp:10:
2021-07-27T20:13:51.6714210Z In file included from /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/include/BipedalLocomotion/ParametersHandler/TomlImplementation.h:17:
2021-07-27T20:13:51.6729130Z In file included from /usr/local/miniconda/envs/test/include/toml++/toml.h:22:
2021-07-27T20:13:51.6797090Z /usr/local/miniconda/envs/test/include/toml++/toml_value.h:183:3: error: static_assert failed due to requirement 'impl::is_native<void>' "A toml::value<> must model one of the native TOML value types: (std::string, int64_t, double, bool, toml::date, toml::time, toml::date_time)"
2021-07-27T20:13:51.6816920Z                 static_assert(
2021-07-27T20:13:51.6830650Z                 ^
2021-07-27T20:13:51.6901290Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:219:16: note: in instantiation of template class 'toml::v2::value<void>' requested here
2021-07-27T20:13:51.6918050Z                                 return new value<value_type>{ static_cast<T&&>(val) };
2021-07-27T20:13:51.6931630Z                                            ^
2021-07-27T20:13:51.7004910Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:242:11: note: in instantiation of function template specialization 'toml::v2::impl::make_node_specialized<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.7019350Z                         return make_node_specialized(static_cast<T&&>(val));
2021-07-27T20:13:51.7048180Z                                ^
2021-07-27T20:13:51.7076150Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:333:33: note: in instantiation of function template specialization 'toml::v2::impl::make_node<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.7156130Z                                 elements.emplace_back(impl::make_node(std::forward<T>(val)));
2021-07-27T20:13:51.7163720Z                                                             ^
2021-07-27T20:13:51.7194040Z /usr/local/miniconda/envs/test/include/toml++/toml_array.h:854:5: note: in instantiation of function template specialization 'toml::v2::array::emplace_back_if_not_empty_view<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.7270970Z                                 emplace_back_if_not_empty_view(std::forward<ElemType>(val));
2021-07-27T20:13:51.7293340Z                                 ^
2021-07-27T20:13:51.7328080Z /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/include/BipedalLocomotion/ParametersHandler/TomlImplementation.tpp:145:52: note: in instantiation of function template specialization 'toml::v2::array::push_back<const std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>> &>' requested here
2021-07-27T20:13:51.7371790Z             m_container[parameterName].as_array()->push_back(element);
2021-07-27T20:13:51.7395270Z                                                    ^
2021-07-27T20:13:51.7433870Z /Users/runner/work/bipedal-locomotion-framework/bipedal-locomotion-framework/src/ParametersHandler/TomlImplementation/src/TomlImplementation.cpp:106:12: note: in instantiation of function template specialization 'BipedalLocomotion::ParametersHandler::TomlImplementation::setParameterPrivate<std::__1::vector<bool, std::__1::allocator<bool>>>' requested here
2021-07-27T20:13:51.7474990Z     return setParameterPrivate(parameterName, parameter);
2021-07-27T20:13:51.7496260Z            ^
2021-07-27T20:13:51.7537340Z 2 errors generated.

@traversaro
Copy link
Collaborator Author

I don't think this is a regression due to conda, it just seems that before in the conda-ci the tomlplusplus package even if installed from source, it was ignored, as from the CMake log you can see that the ParametersHandlerTomlImplementation target was not compiled.

@traversaro
Copy link
Collaborator Author

Yes, indeed also in other CIs systems tomlplusplus seems to be ignored.

@GiulioRomualdi
Copy link
Member

There is a bug in the TomlImplementation of the ParametersHandler when an std::vector<bool> is passed to the setParameter method.
Indeed a std::vector<bool> is (usually) specialized explicitly to store each bool in a single bit. For this reason the following code fails

std::vector<bool> boolVector(10);
for(const auto& element : boolVector)
    m_container[parameterName].as_array()->push_back(element);

notice that here element is not a const reference to bool but a const std::vector<bool>::reference and in the specific case of macos a std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool>>

The following modification should be enough to fix the problem:

std::vector<bool> boolVector(10);
for(bool element : boolVector)
    m_container[parameterName].as_array()->push_back(element);

Interesting ridings:

  1. https://stackoverflow.com/questions/34079390/range-for-loops-and-stdvectorbool
  2. https://opensource.apple.com/source/libcpp/libcpp-19/include/__bit_reference.auto.html

Yes, indeed also in other CIs systems tomlplusplus seems to be ignored.

Regarding this I don't know why

@GiulioRomualdi
Copy link
Member

@traversaro

Yes, indeed also in other CIs systems tomlplusplus seems to be ignored.

Regarding this I don't know why

This is the problem: marzer/tomlplusplus#110

@GiulioRomualdi GiulioRomualdi merged commit ca4eb92 into master Aug 11, 2021
@GiulioRomualdi GiulioRomualdi deleted the traversaro-patch-1 branch August 11, 2021 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants