Unfortunately I don't understand most of what's going on here.
I thought maybe I could at least reproduce these errors on Linux by switching to clang++
, but on Ubuntu 20.04 with clang++
10.0 it works just as well as with g++
.
On macOS I have clang++
13.0, with g++
being basically an alias for clang++
from what I understand.
I'm also running an arm64 installation of R for whatever that's worth - point being I can't tell how to fix these issues or how to help debug/narrow it down :/
★ devtools::install()
✓ checking for file ‘/Users/Lukas/repos/github/PlantedML/randomPlantedForest/DESCRIPTION’ ...
─ preparing ‘randomPlantedForest’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Removed empty directory ‘randomPlantedForest/tests/testthat’
Removed empty directory ‘randomPlantedForest/tests’
─ building ‘randomPlantedForest_0.0.0.9000.tar.gz’
Running /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL \
/var/folders/n1/p1hxy7856nndrd0njv0lxzgw0000gn/T//RtmpvJDgra/randomPlantedForest_0.0.0.9000.tar.gz --install-tests
* installing to library ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library’
* installing *source* package ‘randomPlantedForest’ ...
** using staged installation
** libs
ccache clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppParallel/include' -I/opt/homebrew/include -Xclang -fopenmp -fPIC -falign-functions=64 -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
ccache clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/RcppParallel/include' -I/opt/homebrew/include -Xclang -fopenmp -fPIC -falign-functions=64 -Wall -g -O2 -c randomPlantedForest.cpp -o randomPlantedForest.o
randomPlantedForest.cpp:1529:24: warning: loop variable 'interval' creates a copy from type 'const std::pair<double, double>' [-Wrange-loop-construct]
for(const auto interval: leaf.intervals){
^
randomPlantedForest.cpp:1529:13: note: use reference type 'const std::pair<double, double> &' to prevent copying
for(const auto interval: leaf.intervals){
^~~~~~~~~~~~~~~~~~~~
&
randomPlantedForest.cpp:1526:22: warning: loop variable 'leaf' creates a copy from type 'const Leaf' [-Wrange-loop-construct]
for(const auto leaf: tree.second->leaves){
^
randomPlantedForest.cpp:1526:11: note: use reference type 'const Leaf &' to prevent copying
for(const auto leaf: tree.second->leaves){
^~~~~~~~~~~~~~~~
&
randomPlantedForest.cpp:1522:20: warning: loop variable 'tree' creates a copy from type 'const std::pair<const std::set<int>, std::shared_ptr<DecisionTree>>' [-Wrange-loop-construct]
for(const auto tree: family){
^
randomPlantedForest.cpp:1522:9: note: use reference type 'const std::pair<const std::set<int>, std::shared_ptr<DecisionTree>> &' to prevent copying
for(const auto tree: family){
^~~~~~~~~~~~~~~~
&
randomPlantedForest.cpp:1520:18: warning: loop variable 'family' creates a copy from type 'const std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>' [-Wrange-loop-construct]
for(const auto family: tree_families){
^
randomPlantedForest.cpp:1520:7: note: use reference type 'const std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp> &' to prevent copying
for(const auto family: tree_families){
^~~~~~~~~~~~~~~~~~
&
In file included from randomPlantedForest.cpp:7:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:518:17: error: no matching function for call to object of type 'const setComp'
{return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2537:14: note: in instantiation of member function 'std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>::operator()' requested here
if (!value_comp()(__root->__value_, __v))
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2466:20: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__lower_bound<std::set<int>>' requested here
iterator __p = __lower_bound(__v, __root(), __end_node());
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1380:68: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::find<std::set<int>>' requested here
iterator find(const key_type& __k) {return __tree_.find(__k);}
^
randomPlantedForest.cpp:314:20: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::find' requested here
if(tree_family.find(split_dims) != tree_family.end()) return tree_family[split_dims];
^
randomPlantedForest.cpp:102:8: note: candidate function not viable: 'this' argument has type 'const setComp', but method is not marked const
bool operator()(const std::set<int> &a, const std::set<int> &b){
^
In file included from randomPlantedForest.cpp:7:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:521:17: error: no matching function for call to object of type 'const setComp'
{return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2467:26: note: in instantiation of member function 'std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>::operator()' requested here
if (__p != end() && !value_comp()(__v, *__p))
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1380:68: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::find<std::set<int>>' requested here
iterator find(const key_type& __k) {return __tree_.find(__k);}
^
randomPlantedForest.cpp:314:20: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::find' requested here
if(tree_family.find(split_dims) != tree_family.end()) return tree_family[split_dims];
^
randomPlantedForest.cpp:102:8: note: candidate function not viable: 'this' argument has type 'const setComp', but method is not marked const
bool operator()(const std::set<int> &a, const std::set<int> &b){
^
In file included from randomPlantedForest.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/set:429:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:1975:17: error: no matching function for call to object of type 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::value_compare' (aka 'std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>')
if (value_comp()(__v, __nd->__value_))
^~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2091:36: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__find_equal<std::set<int>>' requested here
__node_base_pointer& __child = __find_equal(__parent, __k);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1521:20: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__emplace_unique_key_args<std::set<int>, const std::piecewise_construct_t &, std::tuple<const std::set<int> &>, std::tuple<>>' requested here
return __tree_.__emplace_unique_key_args(__k,
^
randomPlantedForest.cpp:314:77: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::operator[]' requested here
if(tree_family.find(split_dims) != tree_family.end()) return tree_family[split_dims];
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:514:10: note: candidate function not viable: no known conversion from 'const std::set<int>' to 'const std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>' for 1st argument
bool operator()(const _CP& __x, const _CP& __y) const
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1091:30: warning: the specified comparator type does not provide a viable const call operator [-Wuser-defined-warnings]
static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), "");
^
randomPlantedForest.cpp:396:16: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::~map' requested here
TreeFamily m;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:970:5: note: from 'diagnose_if' attribute on '__diagnose_non_const_comparator<std::set<int>, setComp>':
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:1385:21: note: expanded from macro '_LIBCPP_DIAGNOSE_WARNING'
__attribute__((diagnose_if(__VA_ARGS__, "warning")))
^ ~~~~~~~~~~~
In file included from randomPlantedForest.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/set:429:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2021:28: error: no matching function for call to object of type 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::value_compare' (aka 'std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>')
if (__hint == end() || value_comp()(__v, *__hint)) // check before
^~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2112:36: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__find_equal<std::set<int>>' requested here
__node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:1255:16: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__emplace_hint_unique_key_args<std::set<int>, const std::pair<const std::set<int>, std::shared_ptr<DecisionTree>> &>' requested here
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1180:29: note: in instantiation of member function 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__insert_unique' requested here
{return __tree_.__insert_unique(__p.__i_, __v);}
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1201:17: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::insert' requested here
insert(__e.__i_, *__f);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1009:13: note: in instantiation of function template specialization 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::insert<std::__map_const_iterator<std::__tree_const_iterator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__tree_node<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, void *> *, long>>>' requested here
insert(__m.begin(), __m.end());
^
randomPlantedForest.cpp:403:13: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::map' requested here
getKeys(m);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:514:10: note: candidate function not viable: no known conversion from 'const std::set<int>' to 'const std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>' for 1st argument
bool operator()(const _CP& __x, const _CP& __y) const
^
In file included from randomPlantedForest.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/set:429:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:1896:17: error: no matching function for call to object of type 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::value_compare' (aka 'std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>')
if (value_comp()(__v, __nd->__value_))
^~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:2226:36: note: in instantiation of member function 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__find_leaf_high' requested here
__node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__nd->__value_));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:1661:13: note: in instantiation of member function 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__node_insert_multi' requested here
__node_insert_multi(__cache.__get());
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tree:1617:9: note: in instantiation of function template specialization 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::__assign_multi<std::__tree_const_iterator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__tree_node<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, void *> *, long>>' requested here
__assign_multi(__t.begin(), __t.end());
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:1016:21: note: in instantiation of member function 'std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::operator=' requested here
__tree_ = __m.__tree_;
^
randomPlantedForest.cpp:912:20: note: in instantiation of member function 'std::map<std::set<int>, std::shared_ptr<DecisionTree>, setComp>::operator=' requested here
tree_families[n] = curr_family;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/map:514:10: note: candidate function not viable: no known conversion from 'const std::__tree<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, std::__map_value_compare<std::set<int>, std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>, setComp, true>, std::allocator<std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>>>::key_type' (aka 'const std::set<int>') to 'const std::__value_type<std::set<int>, std::shared_ptr<DecisionTree>>' for 1st argument
bool operator()(const _CP& __x, const _CP& __y) const
^
In file included from randomPlantedForest.cpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp.h:46:
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/XPtr.h:31:5: warning: delete called on non-final 'RandomPlantedForest' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
delete obj;
^
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/XPtr.h:54:26: note: in instantiation of function template specialization 'Rcpp::standard_delete_finalizer<RandomPlantedForest>' requested here
void Finalizer(T*) = standard_delete_finalizer<T>,
^
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/XPtr.h:31:5: warning: delete called on non-final 'ClassificationRPF' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
delete obj;
^
/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/XPtr.h:54:26: note: in instantiation of function template specialization 'Rcpp::standard_delete_finalizer<ClassificationRPF>' requested here
void Finalizer(T*) = standard_delete_finalizer<T>,
^
7 warnings and 5 errors generated.
make: *** [randomPlantedForest.o] Error 1
ERROR: compilation failed for package ‘randomPlantedForest’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/randomPlantedForest’