XCode 5 and c++ libs

Craig Treleaven ctreleaven at cogeco.ca
Thu Nov 28 06:44:45 PST 2013


Hi:

Yet again, I'm well out of my depth and I wonder if those more 
experienced with C++ could further my education.  This is in 
reference to MythTV 0.27 failing to build on Mavericks due to (I 
believe) the switch in standard C++ libraries in XCode 5.

http://trac.macports.org/ticket/41371

Initially, the failure was in one of Myth's internal libs.  Some web 
searching suggested that perhaps adding '-stdlib=libstdc++' to the 
linker flags might help.  Doing that, however, leads to the build 
failing while linking Myth's version of the qjson library, as follows:

>/usr/bin/clang++ -headerpad_max_install_names -stdlib=libstdc++ 
>-Wl,-dynamic,-search_paths_first -arch x86_64 -single_module 
>-dynamiclib -compatibility_version	0.7 -current_version	0.7.1 
>-install_name	/opt/local/lib/libmythqjson.0.dylib -Xarch_x86_64 
>-mmacosx-version-min=10.9 -o libmythqjson.0.7.1.dylib json_parser.o 
>json_scanner.o parser.o parserrunnable.o qobjecthelper.o 
>serializer.o serializerrunnable.o moc_parserrunnable.o 
>moc_serializerrunnable.o  -F/opt/local/Library/Frameworks 
>-F/opt/local/lib  -L/opt/local/lib -F/opt/local/Library/Frameworks 
>-F/opt/local/lib -framework QtCore 
>Undefined symbols for architecture x86_64:
>   "std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
>       std::__1::basic_ostream<char, std::__1::char_traits<char> >& 
>std::__1::operator<<<std::__1::char_traits<char> >(std::__1::basic_ostream<char, 
>std::__1::char_traits<char> >&, char const*) in json_parser.o
<couple dozen similar lines of errors omitted>

I vaguely understand the issue based on a posting by Ryan the other day:

At 6:42 PM -0600 11/26/13, Ryan Schmidt wrote:
>What version of OSX? If Mavericks, you may be having the problem 
>that you cannot mix software compiled with libc++ (i.e. anything 
>compiled with clang) with software compiled with libstdc++ (i.e. 
>anything compiled with FSF GCC).

Myth links with 13 libraries provided by MacPorts[1] and includes its 
own copies of 7 other libraries[2].  The error message above relates 
to Myth's copy of qjson which only links with qt4-mac (AFAIK).

Does this mean that if there is a mismatch in the standard C++ libs 
anywhere in the chain of recursive dependencies, it is going to go 
boom?!?  If so, that is an enormous problem for any sizable project, 
no?

Please help me understand this issue better.  Bonus points if you can 
point me towards a solution for Myth!

Craig

[1] Dependencies provided by MacPorts:
  bzip2
  faac
  freetype
  lame
  libass
  libcdio
  libiconv
  libxml2
  openssl
  qt4-mac
  taglib
  x264
  zlib

[2] Dependencies provided with Myth
FFmpeg
libhdhomerun
libmythbluray
libsamplerate
nzmqt
qjson
zeromq


More information about the macports-dev mailing list