Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7Buy-0053Fb-1z for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 12:40:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7Btx-003GmV-0d for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 12:39:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7Btw-003GmN-0o for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 12:39:29 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w7Btu-00000001nrC-2dGp for pgsql-hackers@postgresql.org; Mon, 30 Mar 2026 12:39:27 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 310E1EC01F5; Mon, 30 Mar 2026 08:39:25 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 30 Mar 2026 08:39:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1774874365; x=1774960765; bh=7gWHevI1jL UHtb5NVKMemfu95iuDX4ne981H399Z/rI=; b=r5RxSBuw6EDoqfweBiB2qR1ca/ ZlIIChSeUghqPexjavpcOS+Uv6fnOOky8X/8xWgKNJUU9SarzajCsufWYggNpIl7 iJ6lznC4pqPbyAcQksbkH+gOtxAXoJztlBFWy/yPzq4x+cuEtFkaR5NF3ZUWr4ug +c9gMCQJFSyV5FCVQobZ85gfJb8jZ0gCv1WEENtgT4gJTzYK2Xto8Roniu2opoL7 JnqT83VfgrkyhjsWzORaJfP8PjplSx6zPa9ZZi8YI1BgfNu9brk56X52BkzvVjg1 KH8lKNPd7Utr4Lg8wCFTPSSyn6bxKBDpyJEy4uMUr6r/GwBwYVqGSvxhn0Og== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1774874365; x=1774960765; bh=7gWHevI1jLUHtb5NVKMemfu95iuDX4ne981 H399Z/rI=; b=Od6/W8bpdi82yx+TCI2iVKtHibCicryKnNes6AQh8TYEsHAbo8n tl+8yU7J+rkysfqmMyXNWDg3V7enHKnXsGrBjlHXiGt/UuhozOaZs/7c4oE165ah D3LTC9usewqOdWipuJ1MxfmyIFOpyLcvLsTh5dz1eNSY3ObuKvq76dy+ZH9tDVLJ gBCk1Yz3nTLxyQ+YiXrAwquKJpLEh6NeDTrrfm701aqVmvZsRd7oKFzt/j8Yzljs mHr6IYZJ+l4HgEoyHcBUIUwKmfEIhQp+ri1sGdpWjURi0lWuIlfyiDLvGACGYYtV gzkBDsg/HnDwibAALy9yOH3rJEOBIxZDPSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeffeeltddtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtsfdttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepfeffgfelvdffgedtveelgfdtgefghfdvkefggeetieevjeekteduleevjefh ueegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopedvpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopegrrdhmvghlnhhikhhovhesphhoshhtghhrvghsph hrohdrrhhupdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghs qhhlrdhorhhg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Mar 2026 08:39:24 -0400 (EDT) Date: Mon, 30 Mar 2026 08:39:23 -0400 From: Andres Freund To: "Anton A. Melnikov" Cc: pgsql-hackers Subject: Re: .bc files build dependency issues. Message-ID: <7ihq6kmoruqicq5qqns3wicb4yydrqgy4iqvke3wafa5f2h6i4@5y4pwfuogh2y> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-03-30 10:28:30 +0300, Anton A. Melnikov wrote: > While the original discussion was about a specific commit > ecaf7c5df and related fix in 16492df7 for 16+ > and its effects [1], i would like to point out that > a similar behavior can be observed > on earlier stable branches (REL_14/15_STABLE) as well. > Using a pre-built source tree and the following reproduction > that is slightly modified version from [2] which suggests > that this is a known pattern for exposing the issue: > > cd src/backend/parser > rm -rf .deps/ gram.c scan.c *.o *.bc gram.h > make parser.bc IOW, if you do something that intentionally breaks things, things break. > result in: > > $ make parser.bc > /usr/lib/llvm-16/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Xclang > -no-opaque-pointers -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-deprecated-non-prototype > -O2 -I. -I. -I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/local/include -flto=thin -emit-llvm > -c -o parser.bc parser.c > In file included from parser.c:25: > ../../../src/include/parser/gramparse.h:29:10: fatal error: 'parser/gram.h' file not found > #include "parser/gram.h" > ^~~~~~~~~~~~~~~ > 1 error generated. > make: *** [../../../src/Makefile.global:1084: parser.bc] Error 1 > > Since this can be reproduced reliably on REL_14/15, it seems worth asking > whether fix for .bc files (or something equivalent) should also be > backpatched to lower branches, instead of only applying to newer ones. This seems like a complete non-issue to me. What is the actual problem here? You intentionally removed dependency information. You intentionally removed part of the generated files, but not all of them. > Also as a possible improvement perhaps make the fix less strictly? > I.e. replace each .bc file's dependency on all .o files > with a more weak dependency just on all source .c files. > Namely use: > > $(patsubst %.o,%.bc, $(OBJS)): $(patsubst %.o,%.c, $(OBJS)) > > instead of: > > $(patsubst %.o,%.bc, $(OBJS)): $(OBJS) > > This might still preserve correct build ordering while reducing > unnecessary coupling between targets. It'd also be broken if one of the source files is built from c++, for example. > As a result make will run faster during parallel builds since it won't wait > for absolutely all the object files to be created. > > For example, rebuilding parser.bc would then require only > a single compiler call in src/backend/parser instead of many. The other file also needs to be built. The .bc->.o dependency will actually often prevent redundant error messages. Greetings, Andres Freund