Is libc++ backward compatible with older versions? - clang

I'm running Ubuntu 20.04 and I have installed libc++-dev (and ABI) package which is libc++-6.0-2.
However, now I have to use CLang 11, which requires a newer version of libc++ for better support to C++17, so I need to install libc++-11-dev, which is a different package and will replace my older.
My question is, how do I know if libc++ is backward compatible? I have hundreds of projects built and I don't want to rebuild all again.
I can't find a clear information about it in libcxx-11 documentation.

Yes. Newer versions of the libc++ dylib have new features, but it is intended that the dylib is compatible going forward.

Related

Why Cygwin has old Clang (v8)?

Are there any special reasons why Cygwin Clang is so outdated (see here), version 8, while already version 13 exists?
For example Ubuntu (apt), MSYS2, MSVC all have version 12.
Also does anyone know (any links?) if there is any very simple way (like docker-based) to build recent Clang for Cygwin? Maybe Clang has no support for Cygwin anymore, that's why Cygwin has outdated version?
See:
https://cygwin.com/packages/summary/clang.html
The reason is very simple, there is no current maintainer.
The previous one has no more available time to dedicate to the project.

Macports on OSX 10.9 - compile opencv with libstdc++

My situation is very similar to what's discussed in this thread. The reason I want to do this is that I am using OpenCV with CUDA 6.0, but CUDA is currently linked against libstdc++. I followed the answer that suggested putting the flag -stdlib=libstdc++ as well as the other approach where we set CXX and CXXFLAGS but as it was being commented: Macports did not seem to acknowledge the flags and still built with libc++ instead of intended libstdc++.
I would like to comment on that thread to ask for a follow-up, but unfortunately I do not have enough reputation yet.
Does anyone know how to get Macports to install OpenCV with libstdc++?
Edited 1: I have not gone back to check whether or not one of the answers provided below works. Compiling OpenCV with libstdc++ will cause issues with a few other non-CUDA projects that use libc++ primarily, so it is unlikely I will try. I will, however, accept an answer if someone can try out an answer below and comment to me if it works.
Edited 2: This question no longer applies to my situation since CUDA 7.0 RC has libc++ support by default. I will still accept an answer per Edited 1.
In the case of boost, I was able to force MacPorts to link against libstdc++ like so:
sudo port -s install boost configure.cxx_stdlib="libstdc++" configure.compiler="macports-gcc-4.7"
And that was it! Apparently there's no need to pass "-stdlib=libstdc++" yourself. otool -L shows what I was hoping to see:
$ otool -L /opt/local/lib/libboost_date_time-mt.dylib
/opt/local/lib/libboost_date_time-mt.dylib:
/opt/local/lib/libboost_date_time-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.18.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
If CUDA is linked against /usr/lib/libsdtd++.6.dylib, then you cannot use the macports-gcc ports as indicated in the other answer as doing so would result in CUDA using a different C++ runtime than OpenCV which can result in issues.
If you have a fresh install of MacPorts, you can edit macports.conf and set up your install to use libstdc++ instead of libc++. Just edit /opt/local/etc/macports.conf to contain the line:
cxx_stdlib libstdc++
Note that doing so will mean that you won't have access to ports that require C++11 or newer functionality.
Also note, that libstdc++ is deprecated, and MacPorts does not support officially support its use in Mavericks and later.

clang-3.4 binary for mingw32

I was wondering if there is a pre-built clang-3.4 (stable-release) binary for mingw32 (www.mingw.org) for download? I do not want to use the VS version b/c I only use gcc and I don't want future compatibility issues (such as VS compiled opencv shared libraries crashing mingw/gcc compiled applications).
I checked http://llvm.org/releases/download.html. They had "Experimental Clang Binaries for Mingw32/x86" for 3.3 and 3.2, but not for the new 3.4 release.
Thanks,

Building Clang, libstdc++4.6 to libstdc++4.7

I am trying to build Clang following this: http://clang.llvm.org/get_started.html
At step 6 the command ../llvm/configure runs a series of checks and one tells me:
checking whether Clang will select a modern C++ standard library... no
configure: error:
We detected a missing feature in the standard C++ library that was known to be
missing in libstdc++4.6 and implemented in libstdc++4.7. There are numerous
C++11 problems with 4.6's library, and we don't support GCCs or libstdc++ older
than 4.7. You will need to update your system and ensure Clang uses the newer
standard library.
If this error is incorrect or you need to force things to work, you may pass
'--disable-compiler-version-checks' to configure to bypass this test.
I don't know how to resolve this and google searches for libstdc++4.7 did not produce anything useful to me or something I understand. How do I go about replacing / upgrading this? I am on a Mac (10.7.5)
I ran into the same problem. The easiest way to build Clang is to use libc++ instead of libstdc++. If you don't have libc++, you can obtain it by installing XCode 4.2 (or newer) or you can build it yourself by following the instructions here: http://libcxx.llvm.org/
After you have libc++ installed, you can use the --enable-libcpp=yes flag with the configure command.
Just this week, the LLVM & Clang project upped the minimal compiler version requirement to gcc 4.7, with its libstdc++. You'll need to install or build a newer gcc.
Here's a blog post I wrote earlier today about building gcc 4.8 on Ubuntu 12.04 and using that to compile trunk LLVM & Clang. Hope this helps!
i have the same error on mac 10.8.5 xcode 5.0
configure option --enable-libcpp resolve my problem
../llvm/configure --enable-cxx11 --enable-optimized --enable-libcpp
For me this happened because I had the old clang and clang++ that I'd previously built from source (the one I was attempting to build to replace) coming first in my PATH. These were too old. Removing those two files so that the build process would use the clang and clang++ that comes with XCode's Command Line Tools and then rebuilding worked fine.

What is need to build native extension for Gems on Windows? (RubyGems)

More and more gems I run into requires building "native extensive", such as RedCloth. Are there tools that are open-source or free that is sufficient to do that? I heard MS Visual Studio also has a free version. Will that be enough to build native extensions?
If you installed Ruby with the RubyInstaller (as you should), then the DevKit has everything you need.
If you use the obsolete MSVC6 builds, then you need to install Microsoft Visual C++ 6.0, because newer versions of MSVC are incompatible. Good luck finding that, though, MSVC6 isn't even from this millenium.

Resources