Xcode: Two frameworks that needs two different c++ Standard Library - c++

I'm working on an app where I need to use two c++ based frameworks and I can't find how to configure build settings so they both build.
One of them works with C++ Standard Library libc++, the other one, with libstdc++.
Is there a way to specify a c++ library by framework? Or at least, a main c++ library and an exception for the other?
Thanks.

Ensure that C++ Standard Library is set to libstdc++ (GNU c++ standard library) in the Apple LLVM 5.0 Compiler Build Settings

Related

Different C++ compilers in one project? (MSVC and GNU C++ compatibility)

A very simple C++ question that is more aimed at the compilers:
Suppose I create a static library (.lib) or a dynamic linked library (.dll) with the latest Microsoft Visual C++ compiler.
Can I also use such a library directly in GNU C++ compiler projects (within the same operating system) if the header files are available?
That's not compatible with each other, is it? (I'm thinking first of a different ABI etc.)
Many Thanks.
PS: I have an unknown 3rd party library (lib) available. Can I find out here which compiler was used to generate it?

How do you use c++17 parallel standard library algorithms on mac?

I want to use parallel sort from c++17's standard library in my cmake project (it's cross platform and works great on Linux and MSYS2) but Apple Clang's libc++ has not implemented it yet, while gnu's libstdc++ has. How do you use gnu's implementation of c++17's libraries in a cmake project on mac?
The solution I found is to build gcc from source and use that compiler and the libraries that come with it. It also needs to be static linked with -static-libgcc -static-libstdc++. I also had trouble with the fmt library after switching to the gnu standard library, but resolved that by using the header-only version of fmt.
Here's the CMakeLists.txt file with the complete details.
Probably the best way to parallelise on a Mac is to follow the advice given by Apple - use dispatch calls.
I posted an example at C++11 app that uses dispatch_apply not working under Mac OS Sierra
This uses dispatch_apply - pretty much a drop-in for a for-to loop.

Which path for C++ in QNX7 should be included?

There are existing two include paths(5.4.0, v1) and two libraries(libstdc++, libc++) for C++ project in QNX7.
When using v1 path, it looks like libc++ should be used only.
I want to know the difference of them and features.
Actually QNX 7 supports both libstdc++ (GNU) and libc++ (LLVM). Both libraries implement c++ standards and are used widely. You can choose which library to link against on compiling time.
For more info see: http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.qnxsdp.migration/topic/cpp_apps.html
and http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.utilities/topic/q/qcc.html

How to use libstdc++ namespace when using libc++ as standard library? [duplicate]

I am having a difficult time configuring an iOS project which uses a static library linked against the old libstdc++ that gcc used. That library is 32 and 64-bit.
There are 6 libraries (libssl.a for example) that are 32-bit and must be updated. If I compile those libraries from source, they will be automatically linked with libc++, which will result in my linker complaining.
Therefore, here are my questions:
1) Is there any way to have a single static library inside the project use libstdc++, and have the others use libc++?
2) How can I compile libraries from source (like libcrypto and libssh) and force them use the old libstdc++ standard library?
3) Is there any other way out of this mess?
1) Yes, you can certainly mix and match which C++ runtimes your C++ code uses so long as those separate modules don't actually pass objects between each-other. For example, if you have two modules in your app which just expose C APIs but internally use C++, then each can use whichever C++ runtime they want. Problems occur when trying to share objects between the runtimes.
2) You can use the '--stdlib=libstdc++' or '--stdlib=libc++' command line argument when compiling and linking to specify which C++ library to use. If your final executable needs to link against both, you'll need to manually specify the other one (eg: --stdlib=libc++ -lstdc++).
3) Yep, but note that libstdc++ was deprecated years ago and isn't even available on watchOS nor tvOS, so your best bet is to just get everything over to libc++.
As long as you don't mix objects (like passing a string from one library into a function that expects a different kind of string), you can do it by including both libraries when you build the top-level app.
In my case, it worked by setting the standard C++ lib to the GNU version and then adding libc++ as I would any other system library.

C++11 and static library that is linked against libstdc++

I have a library which is a static library for C and C++.
The problem is that the library is linked against libstdc++.
In Xcode when I switch to libc++ (to use C++11 features and use the mentioned C++ library) it throws many compile errors.
The authors of the library say that the library is not ready for C++11.
Is there still a way to use both?
Your 3-rd party static library should be linked against the same version of the C++ library it was compiled against. This includes not only the type of library (libstdc++), but also major/minor version numbers to ensure ABI compatibility. Any different library version would get you either build breaks in best case, or weird crashes in worst case. Read more about ABI versioning in GCC manual.
If the interface for 3-rd party library only has POD types, you can make a shared library out of your static library, and then use it from your app linked with libc++.