Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bI0cT-00064h-Iz for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Jun 2016 21:32:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bI0cT-0004EK-1Q for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Jun 2016 21:32:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bI07C-0005hd-No for pgsql-bugs@postgresql.org; Tue, 28 Jun 2016 21:00:14 +0000 Received: from mail.aegee.org ([144.76.142.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bI074-0006UD-R2 for pgsql-bugs@postgresql.org; Tue, 28 Jun 2016 21:00:14 +0000 Authentication-Results: aegeeserv.aegee.org; auth=pass (PLAIN) smtp.auth=didopalauzov DKIM-Filter: OpenDKIM Filter v2.10.3 mail.aegee.org u5SL0CsX011263 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aegee.org; s=k4096; t=1467147613; i=dkim+MSA-tls@aegee.org; bh=R8XQhECl7jMPeZIQz7OA5VCzrzhMD4EQ7rlWBwI4QSg=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=Boc5I0FMCcNiBmxGR8uklXLc4W6DnmkoKALfyC9T8+dCYdwmhWzf6QPK8zlU4jqHH Roc+FHl3SMXQsa2XuX3yjE4rW2qo1nC3c1d+o18ZIpYBpl7JICOGttfXcRTBVtMuNQ MrIxhMvzftDOrDf+C993nkoYW2NgYO4IuOOttkF2X91kWntT75K5VHNQPKTQFH+lc8 Tj60+x/PY931GHU0TwGAFSp02pEgj4CmCArwX9UwJ04wdFxk26+y0FT3c56vvvCC7O mgHQm7JNsjTqpRs6gp1ehubxNnTfdrEQesyxaQ3+uNQ5c486MGG8ezetdjK/HlwmvR WKRtx3qJmXJ4ToHMbQlISpcWCxj4SUX+7TmCPNpnUv542sVrVJbCbF8MhYNaIHcRmz iI5qyrWKftVASiHmTGth379Pc17OtFpHWRSQh06u/7z5nhaxAHQK0tADrq6fINf4hl Wm98srBtHa41SNvICv8PUw6qgaJjHFXz7j0AQLe4+/a8MWM0hevqJWDQoYLH0zyBnS IMg8DSGY25mEdpnZixFkUVsRfAdNQvR0vKxfMMp8Jy2zrrosumL3MMiINChWA42jmg DGPefzjK6l3biw1O4FnT4VcGXhbbXiV81QtfoK8NZL4yyPVNG6Jc8HyAxHboHe7mBU Ca23tG++VhORJXLwSweDXODo= Authentication-Results: mail.aegee.org; dkim=none Received: from [192.168.178.20] (x5f74e688.dyn.telefonica.de [95.116.230.136]) (authenticated bits=0) by mail.aegee.org (8.15.2/8.15.1) with ESMTPSA id u5SL0CsX011263 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 28 Jun 2016 21:00:13 GMT Subject: Re: BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site To: Tom Lane , Alvaro Herrera References: <20160628153309.GA23675@alvherre.pgsql> <21138.1467129943@sss.pgh.pa.us> Cc: Peter Eisentraut , pgsql-bugs@postgresql.org From: =?UTF-8?B?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?= Message-ID: <6d7e8113-ee42-6f45-2c90-ca9bf831ee7e@aegee.org> Date: Tue, 28 Jun 2016 23:04:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: <21138.1467129943@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99.2 at mail.aegee.org X-Virus-Status: Clean X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hello, if no CFLAGS are specified, autoconf's configure uses "-O2 -g" by default. This is what is meant in the cited text at https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Site-Defaults.html . In my config.site I have GCC=yes CFLAGS="-pipe -O3 -fno-fat-lto-objects -flto" CXXFLAGS="-pipe -O3 -fno-fat-lto-objects -flto" LDFLAGS="-Wl,-O1,-s -flto=8" enable_static=no enable_shared=yes enable_silent_rules=yes When building postgresql I noticed, that it doesn't use LTO. What is the way to enable LTO builds with the current build system, except calling CFLAGS="-flto -O3" ./configure? In my opinion, ./configure shall not deal explicitly with --enable-debug, as ./configure inserts by default -g to CFLAGS, if the latter is unset and the compiler supports it. In all other projects, when you just do ./configure, don't have CFLAGS in the enviroment, in config.site nor have it passed on the command line, and compiling with GCC, -g is put into CFLAGS. With other words, when I compile other project when and don't want debug symbols, I have to be explicit. The assumption is that the one who touches config.site best knows how to compile software on the system: in this case with -flto, and the variables from there have precedence over the templates. An option is to put all settings determined during configure time in another variable PG_CFLAGS, and when compiling to use both CFLAGS and PG_CFLAGS. This is the approach of Automake: whenever it changes the compiler flags, it amends to AM_CFLAGS and when compiling, AM_CFLAGS and CFLAGS are both passed to the compiler. In all cases, doing unset CFLAGS is wrong, as it discards CFLAGS set in config.site, which it shall not. That the cache file breaks, if the configuration process is not reproducible as a build is tried with different CFLAGS, is known. Maybe this is intended. Let's assume autoconf know what do to, when CFLAGS is provided on the command line with ./configure, on the command line with make, in the environment and in config.site. Greetings Dilian On 06/28/2016 06:05 PM, Tom Lane wrote: > Alvaro Herrera writes: >> dpa-postgres@aegee.org wrote: >>> configure generated by Autoconf loads the file $prefix/etc/config.site and >>> if CFLAGS is defined there, its value is used when building the project. >>> Because in postgresql configure.in contains on line 400 "unset CFLAGS" the >>> value of $CFLAGS from config.site is discarded when building postgresql, >>> contrary to $LDFLAGS from config.site. > >> The way it works today completely ignores settings in config.site, which is >> clearly bogus per the above manual, but I doubt that blanket removal of the >> "unset" is the right solution. > > I think the thing we'd have to work out is what's the proper interaction > between the template files and the config.site file. It's worth noting > that most of the cases where template files set CFLAGS are when we've > detected a non-default compiler. In such cases, it's not exactly clear > to me that honoring CFLAGS from config.site would be helpful, as such a > setting probably is meant for the default compiler. > > Another point here is that any setting coming from config.site is > presumably not going to vary in response to --enable-debug, which > could be problematic, especially so for non-gcc compilers. > > Also, it looks to me like the autoconf script will fail outright if > config.site specifies CFLAGS and the user has tried to specify a > different CFLAGS in the environment or command line --- see the > logic that checks for cache file corruption. > > In short, I'm pretty dubious about the utility of this feature, which > may explain why nobody has complained about our current behavior > for over a dozen years. Still, it *is* inconsistent that we are > only discarding CFLAGS and not other variables that might come from > such a file. > > regards, tom lane > -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs