Undefined symbols compiling in Mac OS X with Boost, GMP, and OpenMP - macos
I'm having problems compiling a program called SDPB by following these instructions. To summarize, I'm installing a program that requires Boost, GMP, and OpenMP on Mac OS X Yosemite. All the individual pieces of code compile but when its time to link, I get Undefined symbols for architecture x86_64.
My question is basically identical to this question. However, I can't get the answers there to work for me. I still get the same error.
After more searching, I saw that people with similar questions were getting answers pointing to a conflict between clang and gcc. More specifically, there are issues with mixing the libraries libstdc++ and libc++.
Therefore, I made sure to recompile both Boost and GMP with gcc so that everything would be built using libstdc++. That didn't help. I then downloaded an implementation of clang that was compatible with OpenMP and tried to build everything using just libc++. That also didn't work. I then tried all sorts of permutations using clang with the -stdlib=libstdc++ flag and so on. Nothing seems to work. The details of the errors seemed to change a bit with the various permuations. I'll post a few snippets below. Of course, I always used the updated makefile to compile SDPB and I always configured GMP with the --enable-cxx flag as the answers linked above said to do.
Here, is a snippet of the error I received while compiling SDPB with gcc after I compiled GMP and Boost with gcc as well.
Undefined symbols for architecture x86_64:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const", referenced from:
boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::time_duration const&) const in SDPSolverIO.o
boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::ptime const&) const in main.o
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
std::_Rb_tree<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::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
std::_Rb_tree<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::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
std::_Rb_tree<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::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> const&) in SDPSolverIO.o
std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::timer::cpu_timer, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
std::_Rb_tree<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::program_options::variable_value>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> > >::find(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in main.o
std::_Rb_tree<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, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
std::_Rb_tree<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, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
...
Here, I compiled GMP and Boost using clang with the -stdlib=libstdc++ flag and I compiled SDPB with gcc.
Undefined symbols for architecture x86_64:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned long, unsigned long) const", referenced from:
boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::time_duration const&) const in SDPSolverIO.o
boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::ptime const&) const in main.o
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
std::_Rb_tree<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::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
std::_Rb_tree<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::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
std::_Rb_tree<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::timer::cpu_timer>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::_M_insert_unique_(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> const&) in SDPSolverIO.o
std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::timer::cpu_timer, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::timer::cpu_timer> > >::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in SDPSolverIO.o
std::_Rb_tree<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::program_options::variable_value>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::program_options::variable_value> > >::find(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in main.o
std::_Rb_tree<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, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
std::_Rb_tree<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, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in main.o
...
Here I compiled Boost, GMP, and SDPB using clang with the -stdlib=libstdc++ flag.
Undefined symbols for architecture x86_64:
"std::string::find(char const*, unsigned long, unsigned long) const", referenced from:
boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::time_duration const&) const in SDPSolverIO.o
boost::date_time::time_facet<boost::posix_time::ptime, char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, boost::posix_time::ptime const&) const in main.o
"std::logic_error::what() const", referenced from:
vtable for boost::gregorian::bad_day_of_year in main.o
vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_year> > in main.o
vtable for boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_year> in main.o
vtable for std::out_of_range in main.o
vtable for boost::gregorian::bad_day_of_month in main.o
vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> > in main.o
vtable for boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> in main.o
...
Here, I compiled everything using clang but only SDPB with the -stdlib=libstdc++ flag.
Undefined symbols for architecture x86_64:
"bootstrapSDP(std::vector<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, std::allocator<__gmp_expr<__mpf_struct [1], __mpf_struct [1]> > > const&, std::vector<PolynomialVectorMatrix, std::allocator<PolynomialVectorMatrix> > const&)", referenced from:
parseBootstrapSDP(tinyxml2::XMLElement*) in parse.o
"RpotrfStabilized(char const*, int, __gmp_expr<__mpf_struct [1], __mpf_struct [1]>*, int, int*, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, std::__1::allocator<__gmp_expr<__mpf_struct [1], __mpf_struct [1]> > >&, double)", referenced from:
choleskyDecompositionStabilized(Matrix&, Matrix&, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, std::__1::allocator<__gmp_expr<__mpf_struct [1], __mpf_struct [1]> > >&, double) in Matrix.o
"boost::program_options::to_internal(std::string const&)", referenced from:
std::vector<std::string, std::allocator<std::string> > boost::program_options::to_internal<std::string>(std::vector<std::string, std::allocator<std::string> > const&) in main.o
"boost::program_options::basic_parsed_options<char> boost::program_options::parse_config_file<char>(std::basic_istream<char, std::char_traits<char> >&, boost::program_options::options_description const&, bool)", referenced from:
_main in main.o
"boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)", referenced from:
_main in main.o
Whenever I tried to compile SDPB without the -stdlib=libstdc++ using the modified version of clang with OpenMP support, I kept running into many
error: 'value_type' is a private member of '__gmp_expr<mpf_t, mpf_t>'
__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
^
src/serialize.h:48:10: note: while substituting deduced template arguments into function template 'operator<<' [with _Expr = __gmp_expr<mpf_t, mpf_t>]
os << f;
If anyone can help it would be much appreciated.
The Mac OS X Installation instructions have been updated and everything works now if I just blindly follow them to the letter.
Related
How to display the memory maximum limit allowed for clickhouse server
I run a clickhouse server on a container having 30Gb Memory: top KiB Mem : 31746192 total, 958808 free, 11474896 used, 19312488 buff/cache KiB Swap: 0 total, 0 free, 0 used. 19581348 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 clickho+ 20 0 12.8g 837508 357148 S 6.7 2.6 20:35.39 clickhouse-serv I had some errors with background merges because it was reaching the 853Mb limit. Therefore, I changed the configuration like adding thinking that the default conf does not automatically know the available memory amount. <clickhouse> <max_server_memory_usage_to_ram_ratio>30</max_server_memory_usage_to_ram_ratio> </clickhouse> I would like to know how to display the current memory limit for background merges and if there is a way to set this limit. SELECT metric, ':', formatReadableSize(value) FROM system.metrics WHERE metric LIKE 'MemoryTracking' ┌─metric─────────┬─':'─┬─formatReadableSize(value)─┐ │ MemoryTracking │ : │ 815.71 MiB │ └────────────────┴─────┴───────────────────────────┘ The Memory error I originaly had was: 2022.05.06 07:29:53.203566 [ 323 ] {} <Error> void DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::routine(DB::TaskRuntimeDataPtr) [Queue = DB::MergeMutateRuntimeQueue]: Code: 241. DB::Exception: Memory limit (total) exceeded: would use 860.17 MiB (attempt to allocate chunk of 4219892 bytes), maximum: 858.30 MiB. (MEMORY_LIMIT_EXCEEDED), Stack trace (when copying this message, always include the lines below): 0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) # 0xaebee1a in /usr/bin/clickhouse 1. DB::Exception::Exception<char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, long&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*&&, char const*&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, long&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) # 0xaed6e0c in /usr/bin/clickhouse 2. MemoryTracker::allocImpl(long, bool, MemoryTracker*) # 0xaed6a04 in /usr/bin/clickhouse 3. MemoryTracker::allocImpl(long, bool, MemoryTracker*) # 0xaed6429 in /usr/bin/clickhouse 4. MemoryTracker::allocImpl(long, bool, MemoryTracker*) # 0xaed6429 in /usr/bin/clickhouse 5. DB::Memory<Allocator<false, false> >::alloc() # 0xaf099ad in /usr/bin/clickhouse 6. DB::MergeTreeDataPartWriterOnDisk::Stream::Stream(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::IDisk>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::ICompressionCodec> const&, unsigned long) # 0x154face5 in /usr/bin/clickhouse 7. ? # 0x15504ded in /usr/bin/clickhouse 8. DB::ISerialization::enumerateStreams(DB::ISerialization::SubstreamPath&, std::__1::function<void (DB::ISerialization::SubstreamPath const&)> const&, DB::ISerialization::SubstreamData const&) const # 0x14424ef1 in /usr/bin/clickhouse 9. DB::SerializationNullable::enumerateStreams(DB::ISerialization::SubstreamPath&, std::__1::function<void (DB::ISerialization::SubstreamPath const&)> const&, DB::ISerialization::SubstreamData const&) const # 0x144500a7 in /usr/bin/clickhouse 10. DB::ISerialization::enumerateStreams(DB::ISerialization::SubstreamPath&, std::__1::function<void (DB::ISerialization::SubstreamPath const&)> const&, std::__1::shared_ptr<DB::IDataType const> const&) const # 0x14425455 in /usr/bin/clickhouse 11. DB::MergeTreeDataPartWriterWide::addStreams(DB::NameAndTypePair const&, std::__1::shared_ptr<DB::IAST> const&) # 0x154fe5a1 in /usr/bin/clickhouse 12. DB::MergeTreeDataPartWriterWide::MergeTreeDataPartWriterWide(std::__1::shared_ptr<DB::IMergeTreeDataPart const> const&, DB::NamesAndTypesList const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeIndex const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeIndex const> > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::ICompressionCodec> const&, DB::MergeTreeWriterSettings const&, DB::MergeTreeIndexGranularity const&) # 0x154fe42a in /usr/bin/clickhouse 13. DB::MergeTreeDataPartWide::getWriter(DB::NamesAndTypesList const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeIndex const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeIndex const> > > const&, std::__1::shared_ptr<DB::ICompressionCodec> const&, DB::MergeTreeWriterSettings const&, DB::MergeTreeIndexGranularity const&) const # 0x154ef5e2 in /usr/bin/clickhouse 14. DB::MergedBlockOutputStream::MergedBlockOutputStream(std::__1::shared_ptr<DB::IMergeTreeDataPart const> const&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, DB::NamesAndTypesList const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeIndex const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeIndex const> > > const&, std::__1::shared_ptr<DB::ICompressionCodec>, bool, bool) # 0x155d074c in /usr/bin/clickhouse 15. void std::__1::allocator_traits<std::__1::allocator<DB::MergedBlockOutputStream> >::__construct<DB::MergedBlockOutputStream, std::__1::shared_ptr<DB::IMergeTreeDataPart>&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const>&, DB::NamesAndTypesList&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeIndex const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeIndex const> > >, std::__1::shared_ptr<DB::ICompressionCodec>&, bool, bool&>(std::__1::integral_constant<bool, true>, std::__1::allocator<DB::MergedBlockOutputStream>&, DB::MergedBlockOutputStream*, std::__1::shared_ptr<DB::IMergeTreeDataPart>&, std::__1::shared_ptr<DB::StorageInMemoryMetadata const>&, DB::NamesAndTypesList&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeIndex const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeIndex const> > >&&, std::__1::shared_ptr<DB::ICompressionCodec>&, bool&&, bool&) # 0x1544089e in /usr/bin/clickhouse 16. DB::MergeTask::ExecuteAndFinalizeHorizontalPart::prepare() # 0x15435bb8 in /usr/bin/clickhouse 17. bool std::__1::__function::__policy_invoker<bool ()>::__call_impl<std::__1::__function::__default_alloc_func<DB::MergeTask::ExecuteAndFinalizeHorizontalPart::subtasks::'lambda'(), bool ()> >(std::__1::__function::__policy_storage const*) # 0x15443d29 in /usr/bin/clickhouse 18. DB::MergeTask::ExecuteAndFinalizeHorizontalPart::execute() # 0x1543a56b in /usr/bin/clickhouse 19. DB::MergeTask::execute() # 0x1543f51a in /usr/bin/clickhouse 20. DB::MergePlainMergeTreeTask::executeStep() # 0x1543110c in /usr/bin/clickhouse 21. DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::routine(std::__1::shared_ptr<DB::TaskRuntimeData>) # 0xae960eb in /usr/bin/clickhouse 22. DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::threadFunction() # 0xae95d39 in /usr/bin/clickhouse 23. ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) # 0xaf6556a in /usr/bin/clickhouse 24. ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&, void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&&...)::'lambda'()::operator()() # 0xaf675a4 in /usr/bin/clickhouse 25. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) # 0xaf62937 in /usr/bin/clickhouse 26. ? # 0xaf663fd in /usr/bin/clickhouse 27. start_thread # 0x7ea5 in /usr/lib64/libpthread-2.17.so 28. __clone # 0xfeb0d in /usr/lib64/libc-2.17.so but also connecting to clickhouse-client I get Cannot load data for command line suggestions: Code: 241. DB::Exception: Received from localhost:9001. DB::Exception: Memory limit (total) exceeded: would use 935.91 MiB (attempt to allocate chunk of 4440942 bytes), maximum: 858.30 MiB. (MEMORY_LIMIT_EXCEEDED) (version 22.2.3.1)
Can't get to compile comparison of unodered_sets
I have a couple of unordered set defined as: std::unordered_set<std::reference_wrapper<const T>, MyHash<T>, MyEqual<T>> const &map1; std::unordered_set<std::reference_wrapper<const T>, MyHash<T>, MyEqual<T>> const &map2; With the functors defined as: Hash: template<typename T> struct MyHash { inline size_t operator()( std::reference_wrapper<const T> const &obj) const noexcept { return reinterpret_cast<size_t>(&obj.get()); } }; Equality: template<typename T> struct MyEqual { inline bool operator()( std::reference_wrapper<const T> const &lhs, std::reference_wrapper<const T> const &rhs) const { return (reinterpret_cast<size_t>(&lhs.get()) == reinterpret_cast<size_t>(&rhs.get())); } }; Basically using the memory address of the referenced object as a hash and checking if two references are equal if they share the same memory address for their underlying object. This works fine, EXCEPT when I try to compare if two sets are identical: if(map1 == map2) It doesn't compile, and instead, returns: GCC: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/hashtable_policy.h: In instantiation of ‘bool std::__detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::_M_equal(const __hashtable&) const [with _Key = std::reference_wrapper<const std::basic_string<char> >; _Value = std::reference_wrapper<const std::basic_string<char> >; _Alloc = std::allocator<std::reference_wrapper<const std::basic_string<char> > >; _ExtractKey = std::__detail::_Identity; _Equal = MyEqual<std::basic_string<char> >; _H1 = MyHash<std::basic_string<char> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, true, true>; std::__detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::__hashtable = std::_Hashtable<std::reference_wrapper<const std::basic_string<char> >, std::reference_wrapper<const std::basic_string<char> >, std::allocator<std::reference_wrapper<const std::basic_string<char> > >, std::__detail::_Identity, MyEqual<std::basic_string<char> >, MyHash<std::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >]’: /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/unordered_set.h:1671:40: required from ‘bool std::operator==(const std::unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&, const std::unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&) [with _Value1 = std::reference_wrapper<const std::basic_string<char> >; _Hash1 = MyHash<std::basic_string<char> >; _Pred1 = MyEqual<std::basic_string<char> >; _Alloc1 = std::allocator<std::reference_wrapper<const std::basic_string<char> > >; _Value = int; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<int>]’ /home/my_test.cpp:526:28: required from here /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/hashtable_policy.h:1957:47: error: no match for ‘operator==’ (operand types are ‘const std::reference_wrapper<const std::basic_string<char> >’ and ‘const std::reference_wrapper<const std::basic_string<char> >’) if (__ity == __other.end() || !bool(*__ity == *__itx)) ~~~~~~~^~~~~~~~~ CLang: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/hashtable_policy.h:1957:47: fatal error: invalid operands to binary expression ('const std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >' and 'const std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >') if (__ity == __other.end() || !bool(*__ity == *__itx)) ~~~~~~ ^ ~~~~~~ /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/unordered_set.h:1671:23: note: in instantiation of member function 'std::__detail::_Equality<std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::__detail::_Identity, MyEqual<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, MyHash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true>, true>::_M_equal' requested here { return __x._M_h._M_equal(__y._M_h); } ^ /home/my_test.cpp:526:25: note: in instantiation of function template specialization 'std::operator==<std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, MyHash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, MyEqual<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::reference_wrapper<const std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >' requested here if(map1 == map2) I can't figure out why, since I'm already providing a comparator for the equality when defining the set. I can certaily do the comparison explicitly, but since the STL already does that for me, I'd rather avoid writing redundant code. Any ideas what I'm doing wrong? They'd be greatly appreciated.
I am getting issues, when compiling my code in codeblocks C++
I am trying to do my assignment for data structures class. The question is 1) Compile with UNIT_TEST defined and then run with -d yes to see the time it takes in seconds. Report that time in submission box along with the time you found when testing Selection Sort. Which is faster? i am having trouble with understanding, what i am doing wrong. I am getting this error : g++ -o bin/Debug/algAnalysis obj/Debug/main.o Undefined symbols for architecture x86_64: "Catch::NameAndTags::NameAndTags(Catch::StringRef const&, Catch::StringRef const&)", referenced from: ___cxx_global_var_init in main.o "Catch::StringMaker<int, void>::convert(int)", referenced from: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::stringify<int>(int const&) in main.o "Catch::makeTestInvoker(void (*)())", referenced from: ___cxx_global_var_init in main.o "Catch::AssertionHandler::handleExpr(Catch::ITransientExpression const&)", referenced from: ____C_A_T_C_H____T_E_S_T____0() in main.o "Catch::AssertionHandler::handleUnexpectedInflightException()", referenced from: ____C_A_T_C_H____T_E_S_T____0() in main.o "Catch::AssertionHandler::complete()", referenced from: ____C_A_T_C_H____T_E_S_T____0() in main.o "Catch::AssertionHandler::AssertionHandler(Catch::StringRef, Catch::SourceLineInfo const&, Catch::StringRef, Catch::ResultDisposition::Flags)", referenced from: ____C_A_T_C_H____T_E_S_T____0() in main.o "Catch::ITransientExpression::~ITransientExpression()", referenced from: Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > >::MatchExpr(std::__1::vector<int, std::__1::allocator<int> > const&, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > const&, Catch::StringRef) in main.o Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > >::~MatchExpr() in main.o Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Vector::EqualsMatcher<int> >::MatchExpr(std::__1::vector<int, std::__1::allocator<int> > const&, Catch::Matchers::Vector::EqualsMatcher<int> const&, Catch::StringRef) in main.o Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Vector::EqualsMatcher<int> >::~MatchExpr() in main.o "Catch::ReusableStringStream::ReusableStringStream()", referenced from: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::rangeToString<std::__1::__wrap_iter<int const*> >(std::__1::__wrap_iter<int const*>, std::__1::__wrap_iter<int const*>) in main.o "Catch::ReusableStringStream::~ReusableStringStream()", referenced from: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::rangeToString<std::__1::__wrap_iter<int const*> >(std::__1::__wrap_iter<int const*>, std::__1::__wrap_iter<int const*>) in main.o "Catch::Detail::unprintableString", referenced from: Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > >::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.o Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Vector::EqualsMatcher<int> >::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.o "Catch::AutoReg::AutoReg(Catch::ITestInvoker*, Catch::SourceLineInfo const&, Catch::StringRef const&, Catch::NameAndTags const&)", referenced from: ___cxx_global_var_init in main.o "Catch::AutoReg::~AutoReg()", referenced from: ___cxx_global_var_init in main.o "Catch::Matchers::Impl::MatcherUntypedBase::~MatcherUntypedBase()", referenced from: Catch::Matchers::Impl::MatcherBase<std::__1::vector<int, std::__1::allocator<int> > >::~MatcherBase() in main.o "Catch::StringRef::StringRef(char const*)", referenced from: ____C_A_T_C_H____T_E_S_T____0() in main.o ___cxx_global_var_init in main.o (maybe you meant: __ZN5Catch9StringRefC1EPKcm) "Catch::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, Catch::StringRef const&)", referenced from: Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > >::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.o Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Vector::EqualsMatcher<int> >::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.o "Stack::pop(int&)", referenced from: SortClass<int>::sort(int*, int, int) in main.o "Stack::push(int)", referenced from: SortClass<int>::sort(int*, int, int) in main.o "Stack::Stack(int)", referenced from: SortClass<int>::sort(int*, int, int) in main.o "Stack::~Stack()", referenced from: SortClass<int>::sort(int*, int, int) in main.o "Catch::ReusableStringStream::str() const", referenced from: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Catch::Detail::rangeToString<std::__1::__wrap_iter<int const*> >(std::__1::__wrap_iter<int const*>, std::__1::__wrap_iter<int const*>) in main.o "Catch::Matchers::Impl::MatcherUntypedBase::toString() const", referenced from: Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > >::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.o Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > >::describe() const in main.o Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Vector::EqualsMatcher<int> >::streamReconstructedExpression(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const in main.o "typeinfo for Catch::ITransientExpression", referenced from: typeinfo for Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Impl::MatchNotOf<std::__1::vector<int, std::__1::allocator<int> > > > in main.o typeinfo for Catch::MatchExpr<std::__1::vector<int, std::__1::allocator<int> >, Catch::Matchers::Vector::EqualsMatcher<int> > in main.o "typeinfo for Catch::Matchers::Impl::MatcherUntypedBase", referenced from: typeinfo for Catch::Matchers::Impl::MatcherBase<std::__1::vector<int, std::__1::allocator<int> > > in main.o "vtable for Catch::ITransientExpression", referenced from: Catch::ITransientExpression::ITransientExpression(bool, bool) in main.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for Catch::Matchers::Impl::MatcherUntypedBase", referenced from: Catch::Matchers::Impl::MatcherUntypedBase::MatcherUntypedBase(Catch::Matchers::Impl::MatcherUntypedBase const&) in main.o Catch::Matchers::Impl::MatcherUntypedBase::MatcherUntypedBase() in main.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Process terminated with status 1 (0 minute(s), 0 second(s)) Here is my code so far: #define CATCH_CONFIG_MAI #define UNIT_TEST #include <iostream> #include <fstream> #include <vector> #ifdef UNIT_TEST #include "catch.hpp" #endif // UNIT_TEST #include "stack.h" using namespace std; template <class T> class SortClass { private: void swap(T &a, T&b); int split(T a[], int first, int last); public: void sort(T a[], int first, int last); }; template <typename T> int SortClass <T>::split (T arr[], int first, int last) { T x= arr[last]; int i= (first-1); for (int j=first; j <= last-1; j++) { if (arr[j]<= x) { i++; swap (arr[i], arr[j]); } } swap (arr[i+1], arr[last]); return (i+1); } template <class T> void SortClass <T>::sort(T a[], int first, int last) { Stack stack; stack.push (first); stack.push (last); while (not stack.isEmpty()) { stack.pop(last); stack.pop(first); int s= split (a, first, last); if (s-1>first ) { stack.push(first); stack.push(s-1); } if (s+1<last) { stack.push(s+1); stack.push(last); } } } template <class T> void SortClass <T>:: swap(T &a, T &b) { T temp=a; a=b; b=temp; } #ifndef UNIT_TEST int main () { const int N=10; int x1[N]={1,3,5,6,4,2,8,9,7}; for (auto e: x1) std:: cout << e << " "; std:: cout << std:: endl; SortClass <int> s; s.sort(x1,0,N-1); for (auto e: x1) std:: cout << e << " "; std:: cout << std:: endl; } #endif #ifdef UNIT_TEST using Catch::Matchers::Equals; TEST_CASE("A fast sort") { const int N = 6; int x1[N] = { 1, 3, 5, 6, 4, 2 }; int x2[N] = { 1, 2, 3, 4, 5, 6 }; vector<int> v1(x1, x1 + N); vector<int> v2(x2, x2 + N); REQUIRE_THAT(v1, not Equals(v2)); SortClass<int> s; s.sort(x1, 0, N - 1); vector<int> v0(x1, x1 + N); REQUIRE_THAT(v0, Equals(v2)); const int M = 100000; int x3[M]; int x4[M]; ifstream ifs1("numbers"); for (auto &e : x3) ifs1 >> e; ifstream ifs2("sorted"); for (auto &e : x4) ifs2 >> e; s.sort(x3, 0, M - 1); vector<int> v3(x3, x3 + M); vector<int> v4(x4, x4 + M); REQUIRE_THAT(v3, Equals(v4)); } #endif
#define CATCH_CONFIG_MAIN Must be defined before #include "catch.hpp". You have #define CATCH_CONFIG_MAI.
OpenCV Framework: symbol(s) not found for architecture armv7
I've got the precompiled opencv2.framework from OpenCV, and I've added it to my project. However trying to compile the project gives errors like: Undefined symbols for architecture armv7: "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from: std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >::__append(unsigned long) in opencv2(matrix.o) std::__1::vector<cv::Vec<int, 128>, std::__1::allocator<cv::Vec<int, 128> > >::__append(unsigned long) in opencv2(matrix.o) std::__1::vector<cv::Vec<int, 64>, std::__1::allocator<cv::Vec<int, 64> > >::__append(unsigned long) in opencv2(matrix.o) std::__1::vector<cv::Vec<int, 32>, std::__1::allocator<cv::Vec<int, 32> > >::__append(unsigned long) in opencv2(matrix.o) std::__1::vector<cv::Vec<int, 16>, std::__1::allocator<cv::Vec<int, 16> > >::__append(unsigned long) in opencv2(matrix.o) std::__1::vector<cv::Vec<int, 12>, std::__1::allocator<cv::Vec<int, 12> > >::__append(unsigned long) in opencv2(matrix.o) std::__1::vector<cv::Vec<int, 9>, std::__1::allocator<cv::Vec<int, 9> > >::__append(unsigned long) in opencv2(matrix.o) ... "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from: cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o) cv::error(cv::Exception const&) in opencv2(system.o) _cvRegisterModule in opencv2(system.o) "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from: cv::Exception::formatMessage() in opencv2(system.o) "_OBJC_CLASS_$_ALAssetsLibrary", referenced from: objc-class-ref in opencv2(cap_ios_video_camera.o) "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from: cv::sum(cv::_InputArray const&) in opencv2(stat.o) cv::countNonZero(cv::_InputArray const&) in opencv2(stat.o) cv::mean(cv::_InputArray const&, cv::_InputArray const&) in opencv2(stat.o) cv::meanStdDev(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputArray const&) in opencv2(stat.o) cv::minMaxIdx(cv::_InputArray const&, double*, double*, int*, int*, cv::_InputArray const&) in opencv2(stat.o) cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&) in opencv2(stat.o) cv::norm(cv::_InputArray const&, int, cv::_InputArray const&) in opencv2(stat.o) ... "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from: cv::sum(cv::_InputArray const&) in opencv2(stat.o) cv::countNonZero(cv::_InputArray const&) in opencv2(stat.o) cv::mean(cv::_InputArray const&, cv::_InputArray const&) in opencv2(stat.o) cv::meanStdDev(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputArray const&) in opencv2(stat.o) cv::minMaxIdx(cv::_InputArray const&, double*, double*, int*, int*, cv::_InputArray const&) in opencv2(stat.o) cv::minMaxLoc(cv::_InputArray const&, double*, double*, cv::Point_<int>*, cv::Point_<int>*, cv::_InputArray const&) in opencv2(stat.o) cv::norm(cv::_InputArray const&, int, cv::_InputArray const&) in opencv2(stat.o) ... ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) I've set Build Active Architectures Only to No in my build settings, but it still happens. What do I need to do to get OpenCV working? I'm using XCode 5, targeting iOS7. I've already added -lstdc++ to linker flags and switch the C++ compiler to libstdc++, as-per this answer. I have tried compiling OpenCV from source too but that yields the same error. It's the same regardless of whether I have iOS6 or 7 as the deployment target.
Two things you should check: You're attempting to use the C++ portions of OpenCV but Xcode/clang are very literal. If the file you're linking with is a .m it'll treat it as an Objective-C. Instead we want to treat it as an Objective-C++ file by either renaming the extension to .mm or by bringing up the file's properties in the right side bar and selecting Objective-C++ Source for the Type. ALAssetsLibrary is defined in AssetsLibrary.framework, please add it to your Link Binary With Libraries step for your project.
Compiling player/stage on Mac os x
Not sure if any had this problem or similar but if you have some help would be appreciated. I have setup postgresql in the following location and set the link path to /usr/local/pgsql-9.0. Also setup the libpqxx in the /usr/local/lib But I am guessing the error says that it cant find the postgresql anywhere. Is that correct ? Linking CXX shared library libplayerdrivers.dylib Undefined symbols: "_PQntuples", referenced from: Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::GetLayerData(char const*)in dbconn.o "_PQresultErrorMessage", referenced from: Postlog::rollback() constin postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o "_PQgetvalue", referenced from: Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerInfo(char const*)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o "_PQexecParams", referenced from: Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o "_PQresultStatus", referenced from: Postlog::rollback() constin postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerInfo(char const*)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o "_PQexec", referenced from: Postlog::rollback() constin postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerInfo(char const*)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o "_PQgetlength", referenced from: PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerInfo(char const*)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o "_PQbinaryTuples", referenced from: Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o "_PQclear", referenced from: Postlog::rollback() constin postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o Postlog::storeData(int, char const*, void const*, double, unsigned short, unsigned short, unsigned char, unsigned char)in postlog.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::WriteLayerData(LayerDataHolder&) in dbconn.o PostgresConn::GetLayerData(char const*)in dbconn.o PostgresConn::GetLayerInfo(char const*)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o PostgresConn::GetVectorMapInfo(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> > > >)in dbconn.o "_PQsetdbLogin", referenced from: Postlog::Setup() in postlog.o PostgresConn::Connect(char const*, char const*, char const*, char const*, char const*)in dbconn.o "_PQstatus", referenced from: Postlog::Setup() in postlog.o Postlog::isConnected() const in postlog.o PostgresConn::Connected() in postgis.o PostgresConn::Connect(char const*, char const*, char const*, char const*, char const*)in dbconn.o "_PQfinish", referenced from: Postlog::Shutdown() in postlog.o Postlog::~Postlog()in postlog.o Postlog::~Postlog()in postlog.o Postlog::~Postlog()in postlog.o PostgresConn::Disconnect() in dbconn.o ld: symbol(s) not found
Thanks to "mu is too short" its indeed the missing -lpq Looks like there is a bug with the player/stage build for Mac Os X