From owner-freebsd-ports@FreeBSD.ORG Sat Jan 31 00:41:22 2015 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 93C12A4C; Sat, 31 Jan 2015 00:41:22 +0000 (UTC) Received: from gw.catspoiler.org (cl-1657.chi-02.us.sixxs.net [IPv6:2001:4978:f:678::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E798EC0; Sat, 31 Jan 2015 00:41:22 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id t0V0f6io017536; Fri, 30 Jan 2015 16:41:10 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201501310041.t0V0f6io017536@gw.catspoiler.org> Date: Fri, 30 Jan 2015 16:41:06 -0800 (PST) From: Don Lewis Subject: Re: testing the value of ${CXX} in ports Makefile To: tijl@FreeBSD.org In-Reply-To: <20150130094046.19e227e9@kalimero.tijl.coosemans.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: ports@FreeBSD.org, bsd-lists@bsdforge.com X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2015 00:41:22 -0000 On 30 Jan, Tijl Coosemans wrote: > On Thu, 29 Jan 2015 22:46:32 -0800 (PST) Don Lewis wrote: >> gcc46, gcc47, gcc48, and probably gcc5 (haven't tested that one yet) all >> work. gcc49 requires a source patch. > > Can't you make the patch work with all versions of gcc? Well, I could, but what's the fun in that? The port wants to use -Os when compiling some of it's code. It switches to -O0 if compiling for DEBUG. Unfortunately, with gcc 4.9, -Os seems to trigger a code generation bug. The alternatives that I've considered: Set USE_GCC=4.8, the downside being that when the default ports version of gcc is changed to 4.9, anyone using the port will need to install gcc 4.8 as well to get the correct version of the gcc runtime. Patch the port to always use -O0, the downside being that when using gcc 4.8, the code size gets larger. I haven't quantified by how much. Only patch the port when building with gcc 4.9. Patch the port configure script to detect the gcc version and adjust the optimization level accordingly. The third option is fairly easy to do, but has to be done with shell code instead of .if / .endif in the Makefile. If the port actually obeyed CFLAGS, I think adjusting the optimization level by changing CFLAGS is also possible, but would require me to study the make documentation since using .if / .endif still wouldn't work. I think it would require a bunch of make variable expansion magic that I don't fully understand. Upstream would probably prefer the fourth option, but that's more difficult and I don't want to put that much effort into it.