Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2016 09:30:40 +0200
From:      Matthias Andree <matthias.andree@gmx.de>
To:        freebsd-ports@freebsd.org
Cc:        yuri@rawbw.com, jbeich@freebsd.org
Subject:   Re: Why clang++37 behaves differently on 9.3 and 10.3?
Message-ID:  <573C1A20.8070307@gmx.de>
In-Reply-To: <C77175B8-972A-4320-AD85-3F82EEC13539@FreeBSD.org>
References:  <57346A14.6010402@rawbw.com> <C77175B8-972A-4320-AD85-3F82EEC13539@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 12.05.2016 um 19:59 schrieb Dimitry Andric:
> On 12 May 2016, at 13:33, Yuri wrote:
>>
>> clang++37 compiles this simple program fine on 10.3, but fails on 9.3.
>>
>> Why does it behave differently on different OS versions?
>>
>> It looks like it ignores -std=3Dc++11 on 9.3.
>=20
> You cannot compile for C++11 on a 9.x installation, because clang will
> use libstdc++ by default there, and the version of libstdc++ in the
> 9.x base system is not C++11 compatible.
>=20
> To be able to use C++11, you must install libc++ first, using for
> example:

[...]

> On FreeBSD 10.x, clang and libc++ are the defaults, and C++11 can be
> used out of the box.

[...]

(Not meaning to pollute bugzilla yet, hence by mail -- feel free to
upload whichever portions of this to the PR that you feel like, unless
you contort the context. Everyone be aware of Jan's CPPFLAGS hints in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209467#c5 that
rawtherapee does not currently set explicitly.)

I was wondering... for the rawtherapee build in the ports framework I'm
doing this (shown below), namely, force the port to use *libc++ with
GCC* (I need(ed) to force GCC because clang used to lack OpenMP support,
and I needed to match the C++ standard library to what the base system
provides by default, that's why it is under the COMPILER_FEATURES check).
I think the original idea was from Baptiste Daroussin.

I was wondering if it would work for Yuri as well on 9.3 (where
graphics/rawtherapee would not normally use it because libc++ isn't part
of COMPILER_FEATURES there).  The key will certainly be -nostdinc++ to
get GNU libstdc++ out of the way and the flags to pull the ports libc++ i=
n.

The additional difficulty will be that the third-party requisite C++
libraries, if any,  would likely have to be recompiled the same way.

Mixing and matching GNU libstdc++ and libc++ in the same executable
won't work (because these two libraries only agree on the API more or
less, but neither the ABI nor the internal structure layouts).

<https://svnweb.freebsd.org/ports/head/graphics/rawtherapee/Makefile?view=
=3Dmarkup&pathrev=3D395090#l62>

62 	.if ${COMPILER_FEATURES:Mlibc++}
63 	LDFLAGS+=3D       -L/usr/local/lib/c++
64 	CXXFLAGS+=3D      -nostdinc++ -isystem /usr/local/include/c++/v1
65 	CFLAGS+=3D        -isystem /usr/local/include/c++/v1
66 	BUILD_DEPENDS+=3D
${LOCALBASE}/lib/c++/libstdc++.so:${PORTSDIR}/devel/libc++
67 	.endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?573C1A20.8070307>