About different ABI between gcc and clang

Odhiambo Washington odhiambo at gmail.com
Sat Apr 23 13:59:58 UTC 2016


On 23 April 2016 at 16:20, Matthew Seaman <matthew at freebsd.org> wrote:

> 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.
>
>         Cheers,
>
>         Matthew
>
>
Hello Matthew,

Thank you for taking time off your weekend to answer this.
I however need to 'do something' as suggested in the page, but which one is
it?

On my box, I have:

root at gw:/usr/home/wash # `which clang` --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd9.3
Thread model: posix
root at gw:/usr/home/wash # clang --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd9.3
Thread model: posix

root at gw:/usr/home/wash # gcc --version
gcc (GCC) 4.2.1 20070831 patched [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root at gw:/usr/home/wash # which gcc
/usr/bin/gcc
root at gw:/usr/home/wash # /usr/bin/gcc --version
gcc (GCC) 4.2.1 20070831 patched [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Any suggestion on what I should do?

I am trying to compile squid-4.0.9 which isn't in the ports.


-- 
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254 7 3200 0004/+254 7 2274 3223
"Oh, the cruft."


More information about the freebsd-questions mailing list