From nobody Wed Jul 05 14:13:44 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qx1qD5ylLz4lm41; Wed, 5 Jul 2023 14:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qx1qD4rCyz3nct; Wed, 5 Jul 2023 14:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688566424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OpwuOY5RvJn2etgvQ+cjpBLEXrHJu/e5RI1JfaJX7UQ=; b=Un8bkbBwUwrk7bCIU1kLUbhDMSmAuvjTk33LmfHtGMTPU1elcsQwHHNh7cr3R4s3Z+XyF3 yv4svSb7dj9uCnZMoqT1X0AplJg89i8GaylDVpMSGblMoUGCopv3xItrdRIEjFTfmrQMT/ 78BYWWTVeduZ3WagZaMu/xa7KETotzfd4cm26Ro0g/3jtfh4nOR3wJSR/lojybMUl6q5bj rGrDxwQEpUEc4aYx3JCBkcdQczmSjMowZ0FcISQJONxXeoxRBJ8MEy9NYf/JMd6eB6uG0l Zysb9C7kdPxoKnn8ZSXhQ7qWtUrM6pyWsA7Z9jQ1ywa6fAst0LEzatDw1XFPHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688566424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OpwuOY5RvJn2etgvQ+cjpBLEXrHJu/e5RI1JfaJX7UQ=; b=nZONbJd2ZWYnFW98iGIUOwB3VNdYOzgaCGuGLgOEyK7cuvExZLw9ptFRE8i6LwvmNVg/TI lVcWtUNfEPtZw1kLh5/7OjDKOhFU4AxWPr15RG/yd76gaLfYpWUq5jhQShhfGsb+RZnZq1 OCTo43eTxAUW8FXbKUMLAauDtx4tRint/jS9/zLg5aTaxA3JukZkHoaK62pL0GmosOYuVV DK7/B6cWfqK6kCdEeVY/WQOgo9nKKh5J9LUOoC0cm4Fd03KUebv09AnEfyN+Wi46V/Atvf GTF6xHO8l9POwpgw1jDiuINZFY+z/JWdzR0hBqMpLnMHNzO3jCebTy5VuCX+7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688566424; a=rsa-sha256; cv=none; b=hN2VsArjxweTNxZHgHPPmYX5NHY9uvJhCc5lA0l/kj2INjO3aEBVXON7uLUcz925uY/xey UO1wHxIV/i5QG+w8QGG+PdDGh8fxEfh1e9gSsmb5D/inpOTNrxPnsTHG7kP84D91+bQEkY OaHTmxelNpy5nQYSVDQilILd+M9pLuYTHTyFTuSri047xLRMklUpcuf+prBSU5iUXavUzY fLUexO40wkIjSUBC3I2Dp3GbMc8haqDhQJFjhBAF9DgwDNpjRnxYU1UWM8L6hJrvPbM7AO Q1hKinO1vYO2wh+pVhVcNuLeKo9nBNVwYN+CKAcFNiLMa3/56x8d0YLOupIkPw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qx1qD3ZZkzJ6d; Wed, 5 Jul 2023 14:13:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 365EDiBu085583; Wed, 5 Jul 2023 14:13:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 365EDipo085582; Wed, 5 Jul 2023 14:13:44 GMT (envelope-from git) Date: Wed, 5 Jul 2023 14:13:44 GMT Message-Id: <202307051413.365EDipo085582@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Palle Girgensohn Subject: git: ab843ea1ee69 - main - databases/postgresql15-server: fix build with clang 16 (as system compiler) List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: girgen X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab843ea1ee69a9f541c5c92913a1efe5cc2ca7e6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by girgen: URL: https://cgit.FreeBSD.org/ports/commit/?id=ab843ea1ee69a9f541c5c92913a1efe5cc2ca7e6 commit ab843ea1ee69a9f541c5c92913a1efe5cc2ca7e6 Author: Palle Girgensohn AuthorDate: 2023-05-30 22:52:02 +0000 Commit: Palle Girgensohn CommitDate: 2023-07-05 14:12:20 +0000 databases/postgresql15-server: fix build with clang 16 (as system compiler) databases/postgresql??-server: use the default LLVM Always use the version of LLVM that is default for the ports tree, if PostgreSQL builds with it. This simplifies the build process. For i386, revert to using clang -msse2 instead of pulling in gcc. CPUs older than Pentium5 do not support SSE2 and the binary will not run there. We are not expected to support ancient hardware forever, so I've added a comment recommending users of ancient CPUs to build from ports using gcc. During an exp-run for llvm 16 (see bug 271047), it turned out that databases/postgresql15-server failed to build with clang 16 as the base system compiler: In file included from llvmjit.c:38: ../../../../src/include/jit/llvmjit_emit.h:112:23: warning: call to undeclared function 'LLVMBuildStructGEP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] LLVMValueRef v_ptr = LLVMBuildStructGEP(b, v, idx, ""); ^ ../../../../src/include/jit/llvmjit_emit.h:112:15: error: incompatible integer to pointer conversion initializing 'LLVMValueRef' (aka 'struct LLVMOpaqueValue *') with an expression of type 'int' [-Wint-conversion] LLVMValueRef v_ptr = LLVMBuildStructGEP(b, v, idx, ""); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../src/include/jit/llvmjit_emit.h:114:9: warning: call to undeclared function 'LLVMBuildLoad'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] return LLVMBuildLoad(b, v_ptr, name); ^ ../../../../src/include/jit/llvmjit_emit.h:114:9: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'LLVMValueRef' (aka 'struct LLVMOpaqueValue *') [-Wint-conversion] return LLVMBuildLoad(b, v_ptr, name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and many more similar errors. The same applies to the slave ports postgresql11-server, postgresql12-server, postgresql13-server, and postgresql14-server. This is because PostgreSQL's llvmjit support is not yet ready for LLVM 16's API changes. In LLVM 15 functions like LLVMBuildStructGEP were already declared deprecated, but in LLVM 16 these have been removed (and replaced with LLVMBuildStructGEP2, etc). Until PostgreSQL updates their llvmjit for the changed APIs, I would like to reintroduce the LLVM version restriction that was removed in , but slightly adjusted: there is no more need to check for LLVM ports below 10. Another thing that is required is to pass a CLANG variable to the configure script, pointing to the same version that is used for the LLVM bindings. Otherwise, the .bc files will get compiled by the base system compiler, and this can lead to a ThinLTO link error, if the base system compiler is a newer version of llvm. PR: 271498 Suggested by: dim@ --- databases/postgresql16-server/Makefile | 55 +++++----------------------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/databases/postgresql16-server/Makefile b/databases/postgresql16-server/Makefile index e3b783e7fa41..22f68ada81d9 100644 --- a/databases/postgresql16-server/Makefile +++ b/databases/postgresql16-server/Makefile @@ -105,13 +105,15 @@ ZSTD_CONFIGURE_WITH= zstd ZSTD_LIB_DEPENDS+= libzstd.so:archivers/zstd . endif -. if ${DISTVERSION:C/([0-9][0-9]).*/\1/g} >= 11 OPTIONS_DEFINE+= LLVM OPTIONS_DEFAULT+= LLVM LLVM_DESC= Build with support for JIT-compiling expressions OPTIONS_EXCLUDE+= ${OPTIONS_EXCLUDE_${ARCH}_${OSREL:R}} OPTIONS_EXCLUDE_powerpc64_12= LLVM -. endif +LLVM_CONFIGURE_WITH= llvm +LLVM_CONFIGURE_ENV= LLVM_CONFIG=${LLVM_CONFIG} \ + CLANG=${LOCALBASE}/bin/clang${LLVM_VERSION} +LLVM_USES= llvm:max=15,min=11,lib # See http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/76999 for more info # (requires dump/restore if modified.) @@ -185,10 +187,11 @@ SUB_LIST+= PG_VERSION=${PORTVERSION:R} \ .include +# i386 older than Pentium lacks SSE2 so the binary will not run if we build with clang -msse2 +# For such ancient CPUs, gcc must be used to build PostgreSQL. +# https://www.postgresql.org/message-id/20190307140421.GA8362%40gate.oper.dinoex.org .if ${ARCH} == "i386" -USES+= compiler:gcc-c++11-lib -.else -USES+= compiler +CFLAGS+= -msse2 .endif .if !defined(SLAVE_ONLY) @@ -228,49 +231,7 @@ CONFIGURE_ARGS+=--with-krb5 .include .if ${PORT_OPTIONS:MLLVM} -CONFIGURE_ARGS+= --with-llvm -BUILD_DEPENDS+= llvm${PG_LLVM_VERSION}>0:devel/llvm${PG_LLVM_VERSION} -BUILD_DEPENDS+= llvm-config${PG_LLVM_VERSION}:devel/llvm${PG_LLVM_VERSION} -RUN_DEPENDS+= llvm-config${PG_LLVM_VERSION}:devel/llvm${PG_LLVM_VERSION} -CONFIGURE_ENV+= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config${PG_LLVM_VERSION} -.endif - -# Convert LLVM_DEFAULT to COMPILER_VERSION format to make it -# suitable for version comparison. -.if ${LLVM_DEFAULT} >= 70 && ${LLVM_DEFAULT} <= 90 -LLVM_DEFAULT_VERSION= ${LLVM_DEFAULT} -.else -LLVM_DEFAULT_VERSION= ${LLVM_DEFAULT}0 -.endif - -# Convert COMPILER_VERSION to LLVM_DEFAULT format to make it -# suitable for LLVM port name. -# All supported FreeBSD versions have Clang 10.0.1 or later. -LLVM_PORT_SUFFIX= ${COMPILER_VERSION:C/.$//} - -# sync LLVM to the preferred compiler if possible -# or else use a lower version compiler that is compatible -.if ${COMPILER_VERSION} > ${LLVM_DEFAULT_VERSION} -# LLVM versions in ports are, in order, 70, 80 90, 10, 11, 12... where 10 > 90. [sic] -. if ${LLVM_PORT_SUFFIX} < 70 -PG_LLVM_VERSION=${LLVM_PORT_SUFFIX} -PG_COMPILER_VERSION=${LLVM_PORT_SUFFIX} -. else -PG_LLVM_VERSION=11 -PG_COMPILER_VERSION=11 -. endif -.else -PG_LLVM_VERSION=${LLVM_DEFAULT} -PG_COMPILER_VERSION=${LLVM_PORT_SUFFIX} -.endif - -.if ${DISTVERSION:C/([0-9]*).*/\1/} >= 11 -. if defined(SERVER_ONLY) && ${PORT_OPTIONS:MLLVM} INSTALL_DIRS+= src/backend/jit/llvm -. if ${LLVM_PORT_SUFFIX} != ${PG_COMPILER_VERSION} -LLVM_CONFIGURE_ARGS?= CC=${LOCALBASE}/bin/clang${PG_COMPILER_VERSION} -. endif -. endif .endif .if defined(SERVER_ONLY)