Deprecated libstdc++

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
SpacedCowboy
In need of some credit
In need of some credit
Posts: 3
Joined: Tue Jul 18, 2017 4:43 pm

Deprecated libstdc++

Post by SpacedCowboy »

On MacOS 10.12.6, checking out the latest and greatest and compiling it, then setting up an Xcode project with minimal.cpp *almost* works out the box. With a bit of cajoling (copying wx.xcconfig into place, adding some include paths IIRC) I got it to compile.

However, whenever I compile an app, I get the warning message:

Code: Select all

 clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
Is it possible to move to libc++ ? I assume I'd need to recompile the entire wxWidgets Library to use that C++ library rather than just my application, or there'd be link errors.

This is with Xcode 8.3.3 (which I believe is the latest). "clang --version" returns

Code: Select all

[mbp] % clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
SpacedCowboy
In need of some credit
In need of some credit
Posts: 3
Joined: Tue Jul 18, 2017 4:43 pm

Re: Deprecated libstdc++

Post by SpacedCowboy »

Ok, it's bad form to reply to oneself, but I've got it working with libc++ instead of libstdc++ and this might be useful for others...

docs/osx/install.txt says to do:

Code: Select all

mkdir build-cocoa-debug
cd build-cocoa-debug
../configure --enable-debug
make
# Build the samples and demos
cd samples; make;cd ..
cd demos;   make;cd ..
I replaced the above 'configure' line with:

Code: Select all

../configure --enable-monolithic --prefix=/opt/wx --enable-debug --enable-cxx11 --disable-shared --enable-unicode --with-cocoa --with-macosx-version-min=10.9 CXXFLAGS="-std=c++0x -stdlib=libc++" CPPFLAGS="-stdlib=libc++" LIBS=-lc++
based on this post from back in 2013. I made the deployment target 10.9 not 10.7 because that's what the clang warning suggests, which means you have to set the 'macOS Deployment Target' variable to 10.9 in your Xcode project as well, but then everything compiles and links without warnings.

I prefer a static library (static apps are easier to give to others) and --enable-monolithic makes it easier to see which libraries to add to the Xcode build-phases->link libraries settings. In this case libwx_osx_cocoau-3.1a, libwxpng-3.1a and libiconv.tbd

Anyway, enjoy.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Deprecated libstdc++

Post by ONEEYEMAN »

Hi,
Keep in mind that monolithic configuration is not actively supported and is rarely checked by core wx team.
Therefore you are bound to problems/issues.

Thank you.
Post Reply