From a538fe4b4f87a46c01d0959af8f4128689b921fd Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Fri, 7 Feb 2025 20:21:15 +0900 Subject: [PATCH] GH-45416: [CI][C++][Homebrew] Backport the latest formula changes (#45460) ### Rationale for this change To check the operation of Homebrew after the new version is released, we need to sync the latest formula. ### What changes are included in this PR? Backport the latest formula changes ### Are these changes tested? Yes. ### Are there any user-facing changes? No. Comparison result. ```diff diff -ur /tmp/arrow/apache-arrow-glib.rb dev/tasks/homebrew-formulae/apache-arrow-glib.rb --- /tmp/arrow/apache-arrow-glib.rb 2025-02-03 09:30:42 +++ dev/tasks/homebrew-formulae/apache-arrow-glib.rb 2025-02-07 18:20:47 @@ -1,23 +1,41 @@ +# BSD 2-Clause License +# +# Copyright (c) 2009-present, Homebrew contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# https://github.com/Homebrew/homebrew-core/blob/-/Formula/a/apache-arrow-glib.rb + class ApacheArrowGlib < Formula desc "GLib bindings for Apache Arrow" homepage "https://arrow.apache.org/" - url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz" - mirror "https://archive.apache.org/dist/arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz" - sha256 "f89b93f39954740f7184735ff1e1d3b5be2640396febc872c4955274a011f56b" + url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-20.0.0-SNAPSHOT/apache-arrow-20.0.0-SNAPSHOT.tar.gz" + sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28" license "Apache-2.0" head "https://github.com/apache/arrow.git", branch: "main" livecheck do formula "apache-arrow" - end - - bottle do - sha256 cellar: :any, arm64_sequoia: "e420ce8d7c772054c9040a326f54be83306741c3b13f1f95c1aa660bcc3419bc" - sha256 cellar: :any, arm64_sonoma: "f7f697c4bb8922d0fd7ebea9fdedcb03798bb3ce641525bd5b5def7e30d9dbe4" - sha256 cellar: :any, arm64_ventura: "90c37373807d0607465aeb66dfa6a8f4e1073a1c609ac3d3968234f2f63b12ef" - sha256 cellar: :any, sonoma: "2f66ab77233cfaebd4a6cb35ee75a33b6533973ee25608c88a6a4e0f074762c7" - sha256 cellar: :any, ventura: "8339abe968a0697213167673c40071a958f1eb636f02da0ce33e4f61d3a8de2a" - sha256 x86_64_linux: "6776b45d6bafd3bdc32f1d6d0be57e7ed60b8bf0171e87c5931ad76a176a2191" end depends_on "gobject-introspection" => :build diff -ur /tmp/arrow/apache-arrow.rb dev/tasks/homebrew-formulae/apache-arrow.rb --- /tmp/arrow/apache-arrow.rb 2025-02-02 11:32:18 +++ dev/tasks/homebrew-formulae/apache-arrow.rb 2025-02-07 18:10:13 @@ -1,21 +1,38 @@ +# BSD 2-Clause License +# +# Copyright (c) 2009-present, Homebrew contributors +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# https://github.com/Homebrew/homebrew-core/blob/-/Formula/a/apache-arrow.rb + class ApacheArrow < Formula desc "Columnar in-memory analytics layer designed to accelerate big data" homepage "https://arrow.apache.org/" - url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz" - mirror "https://archive.apache.org/dist/arrow/arrow-19.0.0/apache-arrow-19.0.0.tar.gz" - sha256 "f89b93f39954740f7184735ff1e1d3b5be2640396febc872c4955274a011f56b" + url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-20.0.0-SNAPSHOT/apache-arrow-20.0.0-SNAPSHOT.tar.gz" + sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28" license "Apache-2.0" - revision 1 head "https://github.com/apache/arrow.git", branch: "main" - - bottle do - sha256 cellar: :any, arm64_sequoia: "a6c9c00a48857deb74c1d00bbf7858466307853629866e9500fe57dc5889eb58" - sha256 cellar: :any, arm64_sonoma: "d1b3aa26f91c7c452a60dca1b590c54b0026a5ee05a9c148782946c66d878c6e" - sha256 cellar: :any, arm64_ventura: "5d71a8bd28fd50e5bf190c3764e5cf1367d2c6ee45fc0b3850da6f178cb0d5eb" - sha256 cellar: :any, sonoma: "45a9742c35214fd74301c6261a5f137e43b5e4be2c0b1281567e5699d35f46a9" - sha256 cellar: :any, ventura: "bac30f19cf4bb0ed2c444a782152b8458ebcdfd3602e0f7f70457e4b0faf9396" - sha256 cellar: :any_skip_relocation, x86_64_linux: "4699146750ca07631a98168da1b237315363dbaa0dd4fae8f4ad29044e724545" - end depends_on "boost" => :build depends_on "cmake" => :build ``` * GitHub Issue: #45416 Authored-by: Hiroyuki Sato Signed-off-by: Sutou Kouhei --- .../homebrew-formulae/apache-arrow-glib.rb | 30 ++------- dev/tasks/homebrew-formulae/apache-arrow.rb | 61 +++++++++++-------- 2 files changed, 42 insertions(+), 49 deletions(-) diff --git a/dev/tasks/homebrew-formulae/apache-arrow-glib.rb b/dev/tasks/homebrew-formulae/apache-arrow-glib.rb index 82d8464abed9d..f403d5db87aa6 100644 --- a/dev/tasks/homebrew-formulae/apache-arrow-glib.rb +++ b/dev/tasks/homebrew-formulae/apache-arrow-glib.rb @@ -41,45 +41,27 @@ class ApacheArrowGlib < Formula depends_on "gobject-introspection" => :build depends_on "meson" => :build depends_on "ninja" => :build - depends_on "pkg-config" => :build - depends_on "vala" => :build + depends_on "pkgconf" => [:build, :test] depends_on "apache-arrow" depends_on "glib" - fails_with gcc: "5" - def install - system "meson", "setup", "build", "c_glib", *std_meson_args, "-Dvapi=true" + system "meson", "setup", "build", "c_glib", *std_meson_args system "meson", "compile", "-C", "build", "--verbose" system "meson", "install", "-C", "build" end test do - (testpath/"test.c").write <<~SOURCE + (testpath/"test.c").write <<~C #include int main(void) { GArrowNullArray *array = garrow_null_array_new(10); g_object_unref(array); return 0; } - SOURCE - apache_arrow = Formula["apache-arrow"] - glib = Formula["glib"] - flags = %W[ - -I#{include} - -I#{apache_arrow.opt_include} - -I#{glib.opt_include}/glib-2.0 - -I#{glib.opt_lib}/glib-2.0/include - -L#{lib} - -L#{apache_arrow.opt_lib} - -L#{glib.opt_lib} - -DNDEBUG - -larrow-glib - -larrow - -lgio-2.0 - -lgobject-2.0 - -lglib-2.0 - ] + C + + flags = shell_output("pkgconf --cflags --libs arrow-glib gobject-2.0").chomp.split system ENV.cc, "test.c", "-o", "test", *flags system "./test" end diff --git a/dev/tasks/homebrew-formulae/apache-arrow.rb b/dev/tasks/homebrew-formulae/apache-arrow.rb index caf82b8db89d4..6e1505859ae6a 100644 --- a/dev/tasks/homebrew-formulae/apache-arrow.rb +++ b/dev/tasks/homebrew-formulae/apache-arrow.rb @@ -36,35 +36,42 @@ class ApacheArrow < Formula depends_on "boost" => :build depends_on "cmake" => :build - depends_on "llvm@15" => :build + depends_on "gflags" => :build + depends_on "rapidjson" => :build + depends_on "xsimd" => :build + depends_on "abseil" + depends_on "aws-crt-cpp" depends_on "aws-sdk-cpp" depends_on "brotli" - depends_on "bzip2" - depends_on "glog" depends_on "grpc" + depends_on "llvm" depends_on "lz4" - depends_on "mimalloc" depends_on "openssl@3" depends_on "protobuf" - depends_on "rapidjson" depends_on "re2" depends_on "snappy" depends_on "thrift" depends_on "utf8proc" depends_on "zstd" + uses_from_macos "python" => :build + uses_from_macos "bzip2" + uses_from_macos "zlib" - fails_with gcc: "5" + # Issue ref: https://github.com/protocolbuffers/protobuf/issues/19447 + fails_with :gcc do + version "12" + cause "Protobuf 29+ generated code with visibility and deprecated attributes needs GCC 13+" + end def install - # This isn't for https://github.com/Homebrew/homebrew-core/issues/76537 . - # This may improve performance. - ENV.runtime_cpu_detection if Hardware::CPU.intel? + ENV.llvm_clang if OS.linux? - # link against system libc++ instead of llvm provided libc++ - ENV.remove "HOMEBREW_LIBRARY_PATHS", Formula["llvm"].opt_lib + # We set `ARROW_ORC=OFF` because it fails to build with Protobuf 27.0 args = %W[ -DCMAKE_INSTALL_RPATH=#{rpath} + -DLLVM_ROOT=#{Formula["llvm"].opt_prefix} + -DARROW_DEPENDENCY_SOURCE=SYSTEM -DARROW_ACERO=ON -DARROW_COMPUTE=ON -DARROW_CSV=ON @@ -73,29 +80,31 @@ def install -DARROW_FLIGHT=ON -DARROW_FLIGHT_SQL=ON -DARROW_GANDIVA=ON - -DARROW_GCS=ON -DARROW_HDFS=ON - -DARROW_INSTALL_NAME_RPATH=OFF -DARROW_JSON=ON - -DARROW_MIMALLOC=ON - -DARROW_ORC=ON + -DARROW_ORC=OFF -DARROW_PARQUET=ON -DARROW_PROTOBUF_USE_SHARED=ON -DARROW_S3=ON - -DARROW_WITH_BROTLI=ON -DARROW_WITH_BZ2=ON + -DARROW_WITH_ZLIB=ON + -DARROW_WITH_ZSTD=ON -DARROW_WITH_LZ4=ON -DARROW_WITH_SNAPPY=ON + -DARROW_WITH_BROTLI=ON -DARROW_WITH_UTF8PROC=ON - -DARROW_WITH_ZLIB=ON - -DARROW_WITH_ZSTD=ON + -DARROW_INSTALL_NAME_RPATH=OFF -DPARQUET_BUILD_EXECUTABLES=ON ] - # Disable runtime SIMD dispatch. It may cause "illegal opcode" - # error on Intel Mac because of one-definition-rule violation. - # - # https://github.com/apache/arrow/issues/36685 - args << "-DARROW_RUNTIME_SIMD_LEVEL=NONE" if OS.mac? and Hardware::CPU.intel? + args << "-DARROW_MIMALLOC=ON" unless Hardware::CPU.arm? + # Reduce overlinking. Can remove on Linux if GCC 11 issue is fixed + args << "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,#{OS.mac? ? "-dead_strip_dylibs" : "--as-needed"}" + # ARROW_SIMD_LEVEL sets the minimum required SIMD. Since this defaults to + # SSE4.2 on x86_64, we need to reduce level to match oldest supported CPU. + # Ref: https://arrow.apache.org/docs/cpp/env_vars.html#envvar-ARROW_USER_SIMD_LEVEL + if build.bottle? && Hardware::CPU.intel? && (!OS.mac? || !MacOS.version.requires_sse42?) + args << "-DARROW_SIMD_LEVEL=NONE" + end system "cmake", "-S", "cpp", "-B", "build", *args, *std_cmake_args system "cmake", "--build", "build" @@ -103,13 +112,15 @@ def install end test do - (testpath/"test.cpp").write <<~EOS + ENV.method(DevelopmentTools.default_compiler).call if OS.linux? + + (testpath/"test.cpp").write <<~CPP #include "arrow/api.h" int main(void) { arrow::int64(); return 0; } - EOS + CPP system ENV.cxx, "test.cpp", "-std=c++17", "-I#{include}", "-L#{lib}", "-larrow", "-o", "test" system "./test" end