Trying to build, with this command:
cmake -DCMAKE_CXX_COMPILER=clang -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE="Release" ..
make
Get this linking error:
[ 22%] Linking CXX shared library ../bin/libeasy_profiler.dylib
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>::compare(unsigned long, unsigned long, char const*, unsigned long) const", referenced from:
bool std::__1::operator==<char, std::__1::char_traits, std::__1::allocator>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, char const*) in profile_manager.cpp.o
"std::__1::__vector_base_common::__throw_length_error() const", referenced from:
std::__1::vector<BlockDescriptor*, std::__1::allocator<BlockDescriptor*>>::__recommend(unsigned long) const in profile_manager.cpp.o
std::__1::vector<std::__1::reference_wrapperprofiler::Block, std::__1::allocator<std::__1::reference_wrapperprofiler::Block>>::__recommend(unsigned long) const in profile_manager.cpp.o
std::__1::vector<CSwitchBlock, std::__1::allocator<CSwitchBlock>>::__recommend(unsigned long) const in profile_manager.cpp.o
std::__1::vector<std::__1::thread, std::__1::allocatorstd::__1::thread>::__recommend(unsigned long) const in reader.cpp.o
std::__1::vector<profiler::SerializedBlockDescriptor*, std::__1::allocatorprofiler::SerializedBlockDescriptor*>::__recommend(unsigned long) const in reader.cpp.o
std::__1::vector<char, std::__1::allocator>::__recommend(unsigned long) const in reader.cpp.o
std::__1::vector<profiler::BlocksTree, std::__1::allocatorprofiler::BlocksTree>::__recommend(unsigned long) const in reader.cpp.o
...
"std::__1::__basic_string_common::__throw_length_error() const", referenced from:
std::__1::_MetaBase<__is_cpp17_forward_iterator<char*>::value>::_EnableIfImpl std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>::__init<char*>(char*, char*) in profile_manager.cpp.o
"std::__1::locale::has_facet(std::__1::locale::id&) const", referenced from:
bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t>>(std::__1::locale const&) in profile_manager.cpp.o
bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t>>(std::__1::locale const&) in reader.cpp.o
bool std::__1::has_facet<std::__1::codecvt<char, char, __mbstate_t>>(std::__1::locale const&) in writer.cpp.o
etc,etc.
Seems to be missing linking to standard library. Anyone know how to fix this?
Hi!
Thank you for your feedback.
Try adding the following option to your CMake command:
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
Let me know if this helps!
Feb 28
'25 18:02
yse