About different ABI between gcc and clang

Matthew Seaman matthew at FreeBSD.org
Sat Apr 23 13:20:32 UTC 2016

On 23/04/2016 13:04, Odhiambo Washington wrote:
> I am looking at this page:
> http://wiki.squid-cache.org/BuildFarm/FreeBsdInstall
> There is something that I don't quite understand and would appreciate the
> help of the experts, like Matthew:-)
> <quote>
> due to different ABI between gcc and clang, libcppunit needs to be
> installed twice, one with the g++ ABI and one with clang's. The default
> compiler for freebsd-9 is gcc; to setup the version for clang, configure it
> as  CC=clang35 CXX=clang++35 ./configure --prefix=/usr/local/clang-abi
> </quote>
> Can someone explain that portion to me? What is the writer suggesting I do?

Well, I claim no particular expertise with compiler toolchains.

However, yes, the page is right to state that the base system compiler
on 9.x cannot deal with the C++11 standard for C++ code.  You need to
use an external toolchain for that.  There are a number of C compilers
available from ports which would do the job but primarily the choice is
between one of the gcc versions or one of the llvm (ie. clang) versions.

You don't need to install both.  In fact, you're better off picking one
and sticking with it, because if you compile some of libraries squid
depends on with one, and some with the other, you can run into problems.
(Note: this only applies to C++ code: plain C code can mix use of either
compiler quite happily.)

The problem is that the runtime support for C++ programs is supplied as
a shared library, and the versions of that library that come with gcc
are incompatible with the ones that come with the llvm suite.  Plain C
uses a staticly linked library, so the whole question doesn't arise.

If this seems like a lot of faff to you, then just build squid from
ports, where people have made available to you the fruit of their
efforts in sorting out just these sort of questions.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20160423/88dc49f0/attachment.sig>

More information about the freebsd-questions mailing list