I'm trying to debug a C++ OS X application in XCode 5.1 (5B130a) under OS X 10.9.2. The application is composed of various library projects that get compiled into libraries and used in a main application project.
I set a breakpoint in my code and when I run in lldb:
expr 2
this is what I get:
(lldb) expr 2
error: field '__f_' declared with incompatible types in different translation units ('__base *' (aka 'std::__1::__function::__base<void (std::__1::shared_ptr<const XXX>, const YYY &)> *') vs. '__base *' (aka 'std::__1::__function::__base<void> *'))
error: field '__f_' declared with incompatible types in different translation units ('__base *' (aka 'std::__1::__function::__base<void (std::__1::shared_ptr<const XXX>, const YYY &)> *') vs. '__base *' (aka 'std::__1::__function::__base<void> *'))
error: expected expression
note: declared here with type '__base *' (aka 'std::__1::__function::__base<void> *')
note: declared here with type '__base *' (aka 'std::__1::__function::__base<void> *')
error: 3 errors parsing expression
Please note that if I set the breakpoint somewhere else in the code, the same command might work (but not everywhere). This leads me to think that the specific library that I'm breaking in makes a difference.
I understand that somewhere there is a definition for std::function<void(std::shared_ptr<const XXX>, const YYY&)>
and that some other translation unit sees it with a different definition, (I believe the __f_
is an internal field of the std::function templated class), however it's not clear to me:
- why doesn't the linker complain about it? (in fact, the app is running perfectly)
- what code generation switch mismatch could cause this? I already checked
GCC_OPTIMIZATION_LEVEL
(all-O0
),COPY_PHASE_STRIP
, ...
Thanks!