OSX and Clang stdlibc++ warning

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
813
@Martin:
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9
Did you have a look into this?

I've been playing around to see if I can solve it with the stdcpp tool. I've managed to get rid of it by using
Code:
OPTS+=" -mmacosx-version-min=10.9 -std=gnu++0x -stdlib=libc++"
and change Execute "g++" to
Code:
If HostOS="macos"
    Execute "clang++"+OPTS+" -o "+out+" main.cpp"+LIBS
Else
    Execute "g++"+OPTS+" -o "+out+" main.cpp"+LIBS
Endif
but I had to add
Code:
#include <unistd.h>
#include <pthread.h>
to the bottom of the __APPLE__ define in the target stdcpp template, to avoid errors with chdir etc.

So far it's working OK for transcc, but would need more testing.
 

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
329
Awesome, thanks for that!
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
813
I've been doing a bit of reading up on libstdc++ and libc++ differences.
One of the main differences is with the use of templates and that Apple basically didn't bother to add C++11 support to libstdc++. As far as I'm aware it's still on version 4.2.

I do need to read up on LLVM when I get a chance. It's not something that your average Windows or Linux user would use.
 
Last edited:

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
329
Yep. Apple used quite an old g++ compiler, I think that was one of the reasons to move to clang.
 

Martin

Active member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Joined
Jun 19, 2017
Messages
329
Sorry for the late answer. It builds fine on MacOS, but have to try on my real Mac tonight as the VMWare stuff doesn't work with the GLFW target on MacOS.
 
Top Bottom