I tried to build the latest Geany version from master on OS X and get errors in Scintilla sources because it started using C++11. The problem on OS X is that there are two C++ standard libraries - libstdc++ (legacy without C++11 support) and libc++ (supported one with C++11). When llvm is invoked as gcc in the gcc compatibility mode (which happens when building Geany), libstdc++ is used by default which leads to the compilation errors because of missing C++11 support.
For this reason I'd need to add -stdlib=libc++ flag on the Mac build. Any idea (@b4n) how to best do it?
@techee isn't it a bug on the clang wrapper if it doesn't switch to a working stdlib when invoked with `-std=c++11` (or otherwise advertises C++11 features)?
Anyway, there are a few options: * use a custom `CXXFLAGS` on your build or build scripts. This is a good workaround, but not a solution if it's a real problem. * add a configure check like I did on the keybidings PR, and possibly checking also whether GCC likes the flag (similar to what we have in GP for checking `CFLAGS`). I might try writing the test if it's useful (and you could try it as I don't have an OSX to build on ^^)
isn't it a bug on the clang wrapper if it doesn't switch to a working stdlib when invoked with -std=c++11
@b4n, no, the libc++ and libstdc++ are not compatible, when invoked as `gcc` clang needs to use the same STL as gcc would so you can link to things compiled with actual gcc.
@techee did you try with `-std=c++0x`? IIRC that works fine for me on Mac.
@b4n it sounds like a bug to me since the compiler must pass the configure tests by saying it's a g++ which supports c++11 (I think the autoconf tests try `c++0x` too though, see above), but then fails to function.
Anyway, there are a few options:
Another option: set `CXX` to `clang++` and everything should just work, and it will work into the future as Scintilla uses more modern features. Also I believe Neil uses clang for OSX.
OK, after some playing with the command-line parameters I realized that it was the deployment target which was causing the problems. libc++ is used by default only when the deployment target is OS X 10.9 or newer and it ignores flags like -std=c++11 or launching it as clang++ when the deployment target is lower. The only thing that works is adding the -stdlib=libc++ flag.
So the easiest way would be to change the deployment target of the Geany mac binaries to OS X 10.9 which means the binary wouldn't run on older systems. But it might not be such a big problem as 10.9 isn't already supported by Apple with security patches so most users are probably on some newer system. Thoughts?
Thoughts?
Support old versions if it takes no effort, but if its a problem, and especially if the old version is not itself supported, then don't bother.
At the end I decided to add the -stdlib=libc++ -std=c++11 flags to make when building which means the deployment target doesn't have to be bumped to drastically but just to 10.7 where libc++ was introduced.
This has been committed to the geany-osx project so this one can be closed.
Closed #1618.
github-comments@lists.geany.org