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.94.2) (envelope-from ) id 1sLriG-00GzMg-2z for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jun 2024 21:59:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sLriD-00CHRO-4n for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jun 2024 21:58:57 +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.94.2) (envelope-from ) id 1sLriC-00CHRG-R3 for pgsql-hackers@lists.postgresql.org; Mon, 24 Jun 2024 21:58:57 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sLriA-002xBg-F1 for pgsql-hackers@lists.postgresql.org; Mon, 24 Jun 2024 21:58:55 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1f65a3abd01so39260805ad.3 for ; Mon, 24 Jun 2024 14:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719266333; x=1719871133; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Vk1jJZLEN+QjTPgJRy/ufSsZyGfWr8cFQWGYj9d+VWk=; b=C8hjAaKCbqB9Rj6o0zDwBg1VjumGPSn8L/+mo2N/R1sgIRS85CsmxxMqcKaQh+C/x3 zkXrdMccKkXRkJQ80MWpoPW/flmrWEWx35zqsTBldZZtjJvKKME8DQIodTEVQ8PokpBf tgGfMHIHY2e6TBj7Bid2iWvWjiJLHuP68zc5C8vrta3NkF0U5yYEgtt5fTRp9qjrq8iL MsDRIakHJNKBEVcccqOs6y3tyveVGi37aLeYHHDxa1tf9qLBrKsTA9LNv8+sgdGWHS6k 5x3Dg67CfhsZ/9e4txu/wKPDfN6mdPL0+cB7rbbPQz7XO8UrsW3s5f3wQ2SO8ugVvAx8 EdLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719266333; x=1719871133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vk1jJZLEN+QjTPgJRy/ufSsZyGfWr8cFQWGYj9d+VWk=; b=G1tfgt2d/UvxpTRnafDq2fKSQxKrsbuHybPQGqPsRZzPgZRlv/UylgWxdLds6rsfpS XpLBkZTcOdsFt/AZWOzpA10b76zSnsAMYaE31pcAOHz/2Yra/QDmWAKaGCRhRW2BHUFt tkcyTTkcOSQbkkYipqEi5vJG1kkK5fK3Mq4CyYfnqwufqDAaPyVnq97EFvydaPqZxFvX ewCgYQHemLfQaRetPyXCwbn1X5orZgKhhdTqhGWG70FsBVNW2a4lEPe9L+6HoMZYAHR+ hPvcRjZMWHjQPFhECX06gLVdJ6qb8byU+dSfeBV1dVaFy0isw34oiEpf0ErnRTk1nSdc SXZg== X-Gm-Message-State: AOJu0Yz1rddOp5fYGY5VD12kcAy23PyRwYmkY8XKMDELAxG+utBeuiMA QnXnl5RfffYLIrRj+QuJHJ3+ZZK/vMV5Yk/cLh3FZFRjiSx5CUbW2XvLng== X-Google-Smtp-Source: AGHT+IGh85Yu43eM56EXn6Ip6nheY6yRVfE2OP2VajRPMRy3vxmVWZ7BUbmh9JBlVd4vmzchGUGcsA== X-Received: by 2002:a17:902:ce90:b0:1f7:1706:2596 with SMTP id d9443c01a7336-1fa23f4a1d7mr80914795ad.67.1719266333076; Mon, 24 Jun 2024 14:58:53 -0700 (PDT) Received: from localhost.localdomain (192-184-144-144.fiber.dynamic.sonic.net. [192.184.144.144]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3c5ef4sm67604865ad.163.2024.06.24.14.58.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 24 Jun 2024 14:58:52 -0700 (PDT) From: Stan Hu To: pgsql-hackers@lists.postgresql.org Cc: Stan Hu Subject: [PATCH] Fix type redefinition build errors with macOS SDK 15.0 Date: Mon, 24 Jun 2024 14:58:47 -0700 Message-ID: <1470622002597be2c0990b69f9427dbf8425aaf2.1719266312.git.stanhu@gmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <4edd2d3c30429c4445cc805ae9a788c489856eb7.1719265762.git.stanhu@gmail.com> References: <4edd2d3c30429c4445cc805ae9a788c489856eb7.1719265762.git.stanhu@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Prior to macOS SDK 15, there were include guards in $SDK_ROOT/usr/include/xlocale/_regex.h: #ifndef _REGEX_H_ #include <_regex.h> #endif // _REGEX_H_ #include <_xlocale.h> In macOS SDK 15, these include guards are gone: #include <_regex.h> #include <_xlocale.h> Because _REGEX_H_ was defined locally in PostgreSQL's version of src/include/regex/regex.h, these include guards prevented duplicate definitions from $SDK_ROOT/usr/include/_regex.h (not to be confused with $SDK_ROOT/usr/include/xlocale/_regex.h). As a result, attempting to compile PostgreSQL with macOS SDK 15 fails with "previous definition is here" errors for regoff_t, regex_t, and regmatch_t structures. To fix this build issue, define __REGEX_H_ to prevent macOS from including the header that contain redefinitions of the local regex structures. Discussion: https://www.postgresql.org/message-id/CAMBWrQ%3DF9SSPfsFtCv%3DJT51WGK2VcgLA%2BiiJJOmjN0zbbufOEA%40mail.gmail.com --- src/include/regex/regex.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h index d08113724f..045ac626cc 100644 --- a/src/include/regex/regex.h +++ b/src/include/regex/regex.h @@ -32,6 +32,20 @@ * src/include/regex/regex.h */ +#if defined(__darwin__) +/* + * mmacOS SDK 15.0 removed the _REGEX_H_ include guards in + * $SDK_ROOT/usr/include/xlocale/_regex.h, so now + * $SDK_ROOT/usr/include/_regex.h is always included. That file defines + * the same types as below. To guard against type redefinition errors, + * define __REGEX_H_. + */ +#ifndef __REGEX_H_ +#define __REGEX_H_ + +#endif /* __REGEX_H_ */ +#endif + /* * Add your own defines, if needed, here. */ -- 2.45.0