I'm getting valgrind errors from 2 contexts. This is the 1st. It claims I have uninitialised values but I don't see any. Please help me understand where it's telling me the problem lies:
valgrind --leak-check=yes --track-origins=yes ./Lab4 in62.txt actual.txt
==4041== Memcheck, a memory error detector
==4041== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==4041== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==4041== Command: ./Lab4 in62.txt actual.txt
==4041==
==4041== Conditional jump or move depends on uninitialised value(s)
==4041== at 0x409F2C: __gnu_cxx::__enable_if<std::__is_char<char>::__value, bool>::__type std::operator==<char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (basic_string.h:4913)
==4041== by 0x40AE3F: bool std::operator!=<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (basic_string.h:4950)
==4041== by 0x407FFD: Relation::join_createMap(std::deque<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >&, std::vector<Relation, std::allocator<Relation> >&, Rule&, int&, bool&, bool&, Tuple const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, std::vector<int, std::allocator<int> >&, std::vector<int, std::allocator<int> >&) (relation.cpp:317)
==4041== by 0x408F87: Relation::join(std::vector<Relation, std::allocator<Relation> >&, Rule&, std::vector<Rule, std::allocator<Rule> >&) (relation.cpp:438)
==4041== by 0x42069C: Database::ruleEvaluation(std::vector<Rule, std::allocator<Rule> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::basic_ofstream<char, std::char_traits<char> >&) (database.cpp:77)
==4041== by 0x41FA97: Database::evaluate(std::vector<Predicate, std::allocator<Predicate> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::vector<Rule, std::allocator<Rule> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::basic_ofstream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (database.cpp:12)
==4041== by 0x42822C: main (main.cpp:27)
==4041== Uninitialised value was created by a heap allocation
==4041== at 0x4C2C12F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4041== by 0x41642A: __gnu_cxx::new_allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >::allocate(unsigned long, void const*) (new_allocator.h:104)
==4041== by 0x414A62: std::allocator_traits<std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >::allocate(std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >&, unsigned long) (alloc_traits.h:360)
==4041== by 0x411C7F: std::_Deque_base<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >::_M_allocate_node() (stl_deque.h:601)
==4041== by 0x41553C: std::_Deque_base<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >::_M_create_nodes(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >**, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >**) (stl_deque.h:726)
==4041== by 0x4129DE: std::_Deque_base<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >::_M_initialize_map(unsigned long) (stl_deque.h:700)
==4041== by 0x40EB1F: std::_Deque_base<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >::_Deque_base() (stl_deque.h:490)
==4041== by 0x40B337: std::deque<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, std::allocator<std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > > >::deque() (stl_deque.h:883)
==4041== by 0x408DC3: Relation::join(std::vector<Relation, std::allocator<Relation> >&, Rule&, std::vector<Rule, std::allocator<Rule> >&) (relation.cpp:425)
==4041== by 0x42069C: Database::ruleEvaluation(std::vector<Rule, std::allocator<Rule> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::basic_ofstream<char, std::char_traits<char> >&) (database.cpp:77)
==4041== by 0x41FA97: Database::evaluate(std::vector<Predicate, std::allocator<Predicate> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::vector<Rule, std::allocator<Rule> >&, std::vector<Predicate, std::allocator<Predicate> >&, std::basic_ofstream<char, std::char_traits<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (database.cpp:12)
==4041== by 0x42822C: main (main.cpp:27)
[more errors]
==5323==
==5323==
==5323== HEAP SUMMARY:
==5323== in use at exit: 72,704 bytes in 1 blocks
==5323== total heap usage: 29,328 allocs, 29,327 frees, 3,430,706 bytes allocated
==5323==
==5323== LEAK SUMMARY:
==5323== definitely lost: 0 bytes in 0 blocks
==5323== indirectly lost: 0 bytes in 0 blocks
==5323== possibly lost: 0 bytes in 0 blocks
==5323== still reachable: 72,704 bytes in 1 blocks
==5323== suppressed: 0 bytes in 0 blocks
==5323== Reachable blocks (those to which a pointer was found) are not shown.
==5323== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==5323==
==5323== For counts of detected and suppressed errors, rerun with: -v
==5323== ERROR SUMMARY: 309 errors from 2 contexts (suppressed: 0 from 0)
main.cpp:25-27
std::ofstream out;
std::string arg = std::string(argv[2]);
myDatabase.evaluate(myDatalogProgram.getFactsVector(),myDatalogProgram.getQueriesVector(),myDatalogProgram.getRulesVector(),myDatalogProgram.getSchemesVector(), out, arg);
join:
(relation.cpp:425 is line 6, std::deque<strPairMap> working_tuples_deque; from the following function)
Relation Relation::join(std::vector<Relation> &cur_relation_vector, Rule &cur_rule, std::vector<Rule> &rules_vector){
bool dup_scheme_params = false;
strIntMap new_scheme_map;
Scheme new_scheme;
join_MakeScheme(cur_relation_vector, dup_scheme_params, new_scheme_map, new_scheme);
std::deque<strPairMap> working_tuples_deque; //relation.cpp:425
std::deque<strPairMap> working_tuples_deque_final;
std::vector<int> grand_copy_vector;
for (int j = 0; j < cur_relation_vector.size(); j++){
for (auto &x: cur_relation_vector.at(j).tuple_set){
bool diff_id_found = false;
strPairMap temp_map;
std::vector<int> map_indeces_to_copy;
int added_to_vector = 0;
if (working_tuples_deque.size() == 0){
join_createFirstMap(grand_copy_vector, working_tuples_deque, temp_map, cur_relation_vector, added_to_vector, j, x);
}
else{
join_createMap(working_tuples_deque, cur_relation_vector, cur_rule, j, dup_scheme_params, diff_id_found, x, temp_map, map_indeces_to_copy, grand_copy_vector);
join_combinePrevMapsToCurMap(diff_id_found, map_indeces_to_copy, temp_map, grand_copy_vector, cur_relation_vector, working_tuples_deque,j);
}
}
}
join_removeUnworthyMaps(working_tuples_deque, working_tuples_deque_final, grand_copy_vector, new_scheme);
/* Create new relation with new properties */
Relation combo_relation(cur_rule.primary_predicate.getID(),new_scheme,{});
std::set<Tuple> temp_tuple_set;
for (auto& o: working_tuples_deque_final){
Tuple temp_tuple;
for (auto& z: o){
temp_tuple.push_back(z.second.first);
}
temp_tuple_set.insert(temp_tuple);
}
combo_relation.tuple_set = temp_tuple_set;
return combo_relation;
}
join_createMap:
void Relation::join_createMap(std::deque<strPairMap> &working_tuples_deque, std::vector<Relation> &cur_relation_vector, Rule &cur_rule, int &j, bool &dup_scheme_params, bool &diff_id_found, const Tuple &x, strPairMap &temp_map, std::vector<int> &map_indeces_to_copy, std::vector<int> &grand_copy_vector){
for (int l = 0; l < working_tuples_deque.size(); l++){
bool add_index_to_vector = true;
for (int k = 0; k < cur_relation_vector.at(j).scheme.size(); k++){
/* If curent scheme param k is found in map l in working deque */
if (working_tuples_deque.at(l).find(cur_relation_vector.at(j).scheme.at(k))->second.second != cur_relation_vector.at(j).name){ //relation.cpp:317
diff_id_found = true;
if (working_tuples_deque.at(l).find(cur_relation_vector.at(j).scheme.at(k)) != working_tuples_deque.at(l).end()){
std::string param_to_match = working_tuples_deque.at(l).find(cur_rule.predicate_vector.at(j).parameter_vector.at(k).toString())->second.first;
/* but if the values with the matching scheme params don't match.. */
if (param_to_match != x.at(k)){
add_index_to_vector = false;
}
}
}
std::pair<std::string, std::string> temp_pair("","");
temp_pair.first = x.at(k);
temp_pair.second = cur_relation_vector.at(j).name;
temp_map.emplace(cur_relation_vector.at(j).scheme.at(k), temp_pair);
}
if (add_index_to_vector == true || dup_scheme_params == false){
map_indeces_to_copy.push_back(l);
grand_copy_vector.push_back(l);
}
}
}
What type of variable isn't being initialized? How do we pinpoint it with the provided information?
Update:
I now realize that the problem lies in relation.cpp:317, within join_createMap:
if (working_tuples_deque.at(l).find(cur_relation_vector.at(j).scheme.at(k))->second.second != cur_relation_vector.at(j).name){...}
When I break things down:
for (int k = 0; k < cur_relation_vector.at(j).scheme.size(); k++){
/* If curent scheme param k is found in map l in working deque */
strPairMap::iterator compare_it = working_tuples_deque.at(l).find(cur_relation_vector.at(j).scheme.at(k));
std::pair<std::string,std::string> compare_pair = compare_it->second; // offending line
std::string compare_string = compare_pair.second;
if (compare_string != cur_relation_vector.at(j).name){...}
...
}
Valgrind targets this line:
std::pair<std::string,std::string> compare_pair = compare_it->second;
with all of the following errors:
Source and destination overlap in memcpy(0x5ea3040, 0x5b2c450, 95601552)
Invalid read of size 8
Conditional jump or move depends on uninitialised value(s)
Uninitialised value was created by a heap allocation
Conditional jump or move depends on uninitialised value(s)
Uninitialised value was created by a heap allocation
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Process terminating with default action of signal 6 (SIGABRT)
The offending line # was relation.cpp:317, not main.cpp:27. (Valgrind traces from the source of the problem up to the broadest scope.) The find function sometimes returned working_tuples_deque.at(l).end(). The code then went on to access .end()'s second element, which is invalid. That is where the Valgrind error originates.
As for the solution, I first initialized a separate std::string (compare_string). I then used an if statement to only reassign compare_string if the find did not return an .end() iterator (i.e. if the find function actually found something).
Result:
std::string compare_string = "";
strPairMap::iterator compare_it = working_tuples_deque.at(l).find(cur_relation_vector.at(j).scheme.at(k));
if (compare_it != working_tuples_deque.at(l).end()){
std::pair<std::string,std::string> compare_pair = compare_it->second;
compare_string = compare_pair.second;
}
cred: all commentators
I am trying to compile tokumx (mongodb fork with transactions) on mavericks. It compiles for some time and then errors out with this message:
Linking build/darwin/64/release/mongo/mongodump
Undefined symbols for architecture x86_64:
"std::tr1::hash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >::operator()(std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const", referenced from:
std::tr1::_Hashtable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, std::equal_to<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::hash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::find(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in configuration_variable_manager.o
std::tr1::_Hashtable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, std::equal_to<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::hash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::_M_rehash(unsigned long) in configuration_variable_manager.o
std::tr1::__detail::_Map_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, true, std::tr1::_Hashtable<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::function<mongo::Status (std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> > >, std::equal_to<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::hash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true> >::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in configuration_variable_manager.o
mongo::InitializerDependencyGraph::addInitializer(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<mongo::Status (mongo::InitializerContext*)> const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) in initializer_dependency_graph.o
"std::__detail::_List_node_base::_M_unhook()", referenced from:
mongo::DistributedLockPinger::_distLockPingThread(mongo::ConnectionString, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long long) in distlock.o
std::list<mongo::FieldRangeSetPair, std::allocator<mongo::FieldRangeSetPair> >::_M_erase(std::_List_iterator<mongo::FieldRangeSetPair>) [clone .isra.535] in queryutil.o
mongo::OrRangeGenerator::_popOrClause(mongo::FieldRangeSet const*, mongo::Collection*, int, mongo::BSONObj const&) in queryutil.o
mongo::OrRangeGenerator::popOrClauseSingleKey() in queryutil.o
mongo::threadpool::ThreadPool::task_done(mongo::threadpool::Worker*) in thread_pool.o
mongo::threadpool::ThreadPool::~ThreadPool() in thread_pool.o
mongo::threadpool::ThreadPool::~ThreadPool() in thread_pool.o
...
ld: symbol(s) not found for architecture x86_64
Anyone knows exactly whats going on there?
This is caused by a mismatch between the standard library headers and library version, it's similar to this report http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43882.
OSX compilation isn't strictly supported for TokuMX yet, but I've been working on it recently. Make sure you have the latest Xcode and command line tools installed, and try compiling again with --cc=cc --cxx="c++ -std=c++11 -stdlib=libc++" as arguments to scons.
If that doesn't work, please also provide the command you used to try to build, and all of the preceding output, this would be a question better suited to the mailing list I think.
I'm a newbie about boost. I compiled boost libraries with success (under mac os x). Now, I tried to build the very first example mentioned at boost website (including boost/ as include directory and boost/stage/lib as library directory, with netbeans) and got the following error
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/boost_ex1
mkdir -p build/Debug/GNU-MacOSX
rm -f build/Debug/GNU-MacOSX/main.o.d
g++ -c -g -I../../boost_1_44_0 -MMD -MP -MF build/Debug/GNU-MacOSX/main.o.d -o build/Debug/GNU-MacOSX/main.o main.cpp
mkdir -p dist/Debug/GNU-MacOSX
g++ -o dist/Debug/GNU-MacOSX/boost_ex1 build/Debug/GNU-MacOSX/main.o -L../../boost_1_44_0/stage/lib
Undefined symbols:
"boost::re_detail::get_mem_block()", referenced from:
boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::extend_stack()in main.o
"boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)", referenced from:
boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_match()in main.o
"boost::re_detail::get_default_error_string(boost::regex_constants::error_type)", referenced from:
boost::re_detail::cpp_regex_traits_implementation<char>::error_string(boost::regex_constants::error_type) constin main.o
boost::re_detail::cpp_regex_traits_implementation<char>::error_string(boost::regex_constants::error_type) constin main.o
"boost::re_detail::put_mem_block(void*)", referenced from:
boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_extra_block(bool)in main.o
"boost::re_detail::raise_runtime_error(std::runtime_error const&)", referenced from:
void boost::re_detail::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > >(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)in main.o
"boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()", referenced from:
bool boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)in main.o
"boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)", referenced from:
boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >)in main.o
"boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const", referenced from:
boost::cpp_regex_traits<char>::transform_primary(char const*, char const*) constin main.o
"boost::re_detail::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const", referenced from:
boost::cpp_regex_traits<char>::transform(char const*, char const*) constin main.o
"boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)", referenced from:
boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::assign(char const*, char const*, unsigned int)in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-MacOSX/boost_ex1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)
am I missing something?
Thanks!
Most Boost libraries are header-only:
they consist entirely of header files
containing templates and inline
functions, and require no
separately-compiled library binaries
or special treatment when linking.
However, the Boost.Regex library has a library you have to link with if you are using its code. For more details on this see Getting Started guide.
So the problem in your case is that you are not linking with Boost.Regex library, called libboost_regex.so. In order to do that, modify your project settings (or make file) so that it invokes gcc with -lboost_regex option. This option should come right after -L../../boost_1_44_0/stage/lib option that you already have, like this
g++ -o dist/Debug/GNU-MacOSX/boost_ex1 build/Debug/GNU-MacOSX/main.o -L../../boost_1_44_0/stage/lib -lboost_regex
Good luck!