From owner-freebsd-ports@FreeBSD.ORG Sat Mar 29 13:22:09 2014 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38B0C91B for ; Sat, 29 Mar 2014 13:22:09 +0000 (UTC) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "tensor.andric.com", Issuer "CAcert Class 3 Root" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B50298D for ; Sat, 29 Mar 2014 13:22:08 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::8878:6384:3237:cf3b] (unknown [IPv6:2001:7b8:3a7:0:8878:6384:3237:cf3b]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 54A555C44; Sat, 29 Mar 2014 14:22:04 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_7F090F0E-9DDA-4BE2-A17C-EAEC49D058EC"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: HEAD clang failures due to unknown arguments From: Dimitry Andric In-Reply-To: <20140329124652.GH73879@hades.panopticon> Date: Sat, 29 Mar 2014 14:21:50 +0100 Message-Id: <14D047DD-EE2F-4512-BC18-518B693CCD6B@FreeBSD.org> References: <20140329044342.GG73879@hades.panopticon> <73F477CA-6AF4-4217-AC81-730A5DED11D5@FreeBSD.org> <20140329124652.GH73879@hades.panopticon> To: Dmitry Marakasov X-Mailer: Apple Mail (2.1874) Cc: freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Mar 2014 13:22:09 -0000 --Apple-Mail=_7F090F0E-9DDA-4BE2-A17C-EAEC49D058EC Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 29 Mar 2014, at 13:46, Dmitry Marakasov wrote: > * Dimitry Andric (dim@FreeBSD.org) wrote: > >>> Are we to fix new clang failures related to that clang now treats >>> unknown arguments as fatal errors: >>> >>> --- >>> c++: error: unknown argument: '-R/usr/local/lib' >>> --- >> >> Yes, just replace -R/usr/local/lib with -Wl,-rpath,/usr/local/lib. This >> is very easy to do with sed. > > I've just removed them and it worked. Or is there a reason for rpath to > system lib directory? It seems that -rpath is sometimes used gratuitously, indeed. Though it can sometimes be necessary, if shared libraries are installed into non-standard places, e.g. /usr/local/lib/myapp/libmyapp.so. Also, not all systems have had /usr/local/lib in their default dynamic linker path. And I'm also not sure what happens if you attempt to set $LOCALBASE to something other than /usr/local/lib. :-) I tried that once, and I was not really happy with the results... > What about other keys? I've also encountered -fwhole-program and > -malign-double The only correct way, of course, is for the configuration phase (e.g. CMake, autoconf, etc) to check if the used compiler supports the option. Just blindly using it is almost always wrong. That said, for old or mostly unmaintained software, it is probably fine to just mechanically remove any unsupported options. > What I plan to do is: > > --- > USES+= compiler:env > > .include > > post-patch: > .if ${COMPILER_TYPE} == "clang" > @${REINPLACE_CMD} -e 's|-fwhole-program||' ${WRKSRC}/CMakeLists.txt > .endif > --- > > but what if next version of clang learns of this key? In this particular case, it will probably never support it. There are many options which a very specific to gcc (mostly for its optimizer), which make no sense for clang. > I'd like to have > something like > > .if ! ${COMPILER_SUPPORTED_ARGUMENTS:M-fwhole-program} > @${REINPLACE_CMD} -e 's|-fwhole-program||' ${WRKSRC}/CMakeLists.txt > .endif > > .if ${COMPILER_SUPPORTED_ARGUMENTS:M-malign-double} > CXXFLAGS+= -malign-double > .endif Now you are encoding the work of CMake and autoconf into the ports infrastructure? I am not sure if that is the proper way. However, I seem to remember there was also an effort to provide "global" autoconf and CMake preconfiguration, maybe this type of compiler-specific knowledge thing could be folded into that? -Dimitry --Apple-Mail=_7F090F0E-9DDA-4BE2-A17C-EAEC49D058EC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iEYEARECAAYFAlM2yPoACgkQsF6jCi4glqNPEgCg5wbKtbxExmCaGQpTwUEugRmr ZuUAn1TlRHwXWNm976nshVSIwzJ+SOaq =ANTx -----END PGP SIGNATURE----- --Apple-Mail=_7F090F0E-9DDA-4BE2-A17C-EAEC49D058EC--