From 7fee31ebba7d077a1b97958bf4eed230c6aac854 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 2 Apr 2025 15:06:36 +0900 Subject: [PATCH 01/18] GH-45994: [CI][GLib] Fix vcpkg configuration for Windows job --- .github/workflows/ruby.yml | 8 ++++++++ c_glib/vcpkg.json | 18 +++--------------- cpp/vcpkg.json | 17 ++++++++++------- dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat | 1 - dev/tasks/vcpkg-tests/github.windows.yml | 1 + 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ed26e72cf15..318470afb4a 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -413,8 +413,16 @@ jobs: run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build" + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + if: failure() + with: + path: | + build/cpp/vcpkg_installed/vcpkg/blds/gflags/*.log + build/cpp/vcpkg*.log + name: vcpkg-log - name: Build GLib shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + set PATH=%VCPKG_ROOT%;%PATH% bash -c "ci/scripts/c_glib_build.sh $(pwd) $(pwd)/build" diff --git a/c_glib/vcpkg.json b/c_glib/vcpkg.json index df4508d2973..3e151785586 100644 --- a/c_glib/vcpkg.json +++ b/c_glib/vcpkg.json @@ -1,23 +1,11 @@ { "name": "arrow-glib", "version-string": "20.0.0-SNAPSHOT", + "$comment:dependencies": "We can enable gobject-introspection again once it's updated", "dependencies": [ "glib", - "gobject-introspection", "pkgconf" ], - "$comment": "2025.02.14", - "builtin-baseline": "d5ec528843d29e3a52d745a64b469f810b2cedbf", - "overrides": [ - { - "$comment": - "We need gobject-introspection 1.80.0 or later for GLib 2.80.0 but vcpkg doesn't provide it yet.", - "name": "glib", - "version": "2.78.4" - }, - { - "name": "vcpkg-tool-meson", - "version": "1.3.2" - } - ] + "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", + "builtin-baseline": "460551b0ec06be1ba6b918448bf3b0f44add813d" } diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index 6eb24ad1803..056f93696d3 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -1,6 +1,7 @@ { "name": "arrow", "version-string": "20.0.0-SNAPSHOT", + "$comment:dependencies": "We can enable gflags and glog once gflags' CMake 4 support is applied", "dependencies": [ "abseil", { @@ -26,18 +27,20 @@ "c-ares", "curl", "flatbuffers", - "gflags", - "glog", { - "name":"google-cloud-cpp", - "version>=": "1.32.1", + "name": "google-cloud-cpp", "default-features": false, "features": [ "storage" ] }, "grpc", - "gtest", + { + "name": "gtest", + "features": [ + "cxx17" + ] + }, "lz4", "openssl", "orc", @@ -52,6 +55,6 @@ "zlib", "zstd" ], - "$comment": "2025.02.14", - "builtin-baseline": "d5ec528843d29e3a52d745a64b469f810b2cedbf" + "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", + "builtin-baseline": "460551b0ec06be1ba6b918448bf3b0f44add813d" } diff --git a/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat b/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat index 3b337bb1750..e118ce6f57e 100644 --- a/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat +++ b/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat @@ -27,7 +27,6 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Too @rem changes in vcpkg vcpkg install ^ - --triplet x64-windows ^ --x-manifest-root cpp ^ --feature-flags=versions ^ --clean-after-build ^ diff --git a/dev/tasks/vcpkg-tests/github.windows.yml b/dev/tasks/vcpkg-tests/github.windows.yml index 0fd4892c0a6..81213d9fc8b 100644 --- a/dev/tasks/vcpkg-tests/github.windows.yml +++ b/dev/tasks/vcpkg-tests/github.windows.yml @@ -25,6 +25,7 @@ jobs: runs-on: windows-2019 env: VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' + VCPKG_DEFAULT_TRIPLET: 'x64-windows' steps: {{ macros.github_checkout_arrow()|indent }} # CMake 3.29.1 that is pre-installed on the Windows image has a problem. From 0fa4d2805e2230fcb1c2a5fe4dc8eb7f181f9be2 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 09:17:56 +0900 Subject: [PATCH 02/18] Enable gflags and glog --- c_glib/vcpkg.json | 2 +- cpp/vcpkg.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/c_glib/vcpkg.json b/c_glib/vcpkg.json index 3e151785586..99d0369f6b0 100644 --- a/c_glib/vcpkg.json +++ b/c_glib/vcpkg.json @@ -7,5 +7,5 @@ "pkgconf" ], "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", - "builtin-baseline": "460551b0ec06be1ba6b918448bf3b0f44add813d" + "builtin-baseline": "db1ddd074bd51bf01baf4c4672b82de9680835ca" } diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index 056f93696d3..b00677af2d3 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -1,7 +1,6 @@ { "name": "arrow", "version-string": "20.0.0-SNAPSHOT", - "$comment:dependencies": "We can enable gflags and glog once gflags' CMake 4 support is applied", "dependencies": [ "abseil", { @@ -27,6 +26,8 @@ "c-ares", "curl", "flatbuffers", + "gflags", + "glog", { "name": "google-cloud-cpp", "default-features": false, @@ -56,5 +57,5 @@ "zstd" ], "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", - "builtin-baseline": "460551b0ec06be1ba6b918448bf3b0f44add813d" + "builtin-baseline": "db1ddd074bd51bf01baf4c4672b82de9680835ca" } From bce42569f0d39cf4d61f7897ed056719cd4622d1 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 14:52:45 +0900 Subject: [PATCH 03/18] Don't require gflags for gRPC --- c_glib/vcpkg.json | 2 +- cpp/cmake_modules/ThirdpartyToolchain.cmake | 7 +++---- cpp/vcpkg.json | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/c_glib/vcpkg.json b/c_glib/vcpkg.json index 99d0369f6b0..9ece019dafb 100644 --- a/c_glib/vcpkg.json +++ b/c_glib/vcpkg.json @@ -7,5 +7,5 @@ "pkgconf" ], "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", - "builtin-baseline": "db1ddd074bd51bf01baf4c4672b82de9680835ca" + "builtin-baseline": "1852c473a9d8dbb632693f533d7c7c550cb7a07a" } diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 5d57bf31280..fb7b793a686 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1667,11 +1667,10 @@ endif() if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS OR ARROW_BUILD_INTEGRATION - OR ARROW_USE_GLOG - OR ARROW_WITH_GRPC) - set(ARROW_NEED_GFLAGS 1) + OR ARROW_USE_GLOG) + set(ARROW_NEED_GFLAGS TRUE) else() - set(ARROW_NEED_GFLAGS 0) + set(ARROW_NEED_GFLAGS FALSE) endif() macro(build_gflags) diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index b00677af2d3..9a97a3b61eb 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -57,5 +57,5 @@ "zstd" ], "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", - "builtin-baseline": "db1ddd074bd51bf01baf4c4672b82de9680835ca" + "builtin-baseline": "1852c473a9d8dbb632693f533d7c7c550cb7a07a" } From fc5afb2c0ddfd30b9a104d0785093d286b0f7647 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 15:16:59 +0900 Subject: [PATCH 04/18] Remove needless gflags dependency --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index fb7b793a686..0cd09fa3cae 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -3961,9 +3961,6 @@ macro(build_grpc) IMPORTED_LOCATION) get_target_property(GRPC_CARES_INCLUDE_DIR c-ares::cares INTERFACE_INCLUDE_DIRECTORIES) get_filename_component(GRPC_CARES_ROOT "${GRPC_CARES_INCLUDE_DIR}" DIRECTORY) - get_target_property(GRPC_GFLAGS_INCLUDE_DIR ${GFLAGS_LIBRARIES} - INTERFACE_INCLUDE_DIRECTORIES) - get_filename_component(GRPC_GFLAGS_ROOT "${GRPC_GFLAGS_INCLUDE_DIR}" DIRECTORY) get_target_property(GRPC_RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) get_filename_component(GRPC_RE2_ROOT "${GRPC_RE2_INCLUDE_DIR}" DIRECTORY) @@ -3971,7 +3968,6 @@ macro(build_grpc) # before (what are likely) system directories set(GRPC_CMAKE_PREFIX "${GRPC_CMAKE_PREFIX};${ABSL_PREFIX}") set(GRPC_CMAKE_PREFIX "${GRPC_CMAKE_PREFIX};${GRPC_PB_ROOT}") - set(GRPC_CMAKE_PREFIX "${GRPC_CMAKE_PREFIX};${GRPC_GFLAGS_ROOT}") set(GRPC_CMAKE_PREFIX "${GRPC_CMAKE_PREFIX};${GRPC_CARES_ROOT}") set(GRPC_CMAKE_PREFIX "${GRPC_CMAKE_PREFIX};${GRPC_RE2_ROOT}") @@ -4021,7 +4017,6 @@ macro(build_grpc) -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF -DgRPC_BUILD_TESTS=OFF -DgRPC_CARES_PROVIDER=package - -DgRPC_GFLAGS_PROVIDER=package -DgRPC_MSVC_STATIC_RUNTIME=${ARROW_USE_STATIC_CRT} -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_RE2_PROVIDER=package From 90bed67e5d792efb37a780864136f7cfea373a09 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 15:19:57 +0900 Subject: [PATCH 05/18] Collect more logs --- .github/workflows/ruby.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 318470afb4a..c634676b53c 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -419,6 +419,8 @@ jobs: path: | build/cpp/vcpkg_installed/vcpkg/blds/gflags/*.log build/cpp/vcpkg*.log + build/cpp/vcpkg/buildtrees/gflags/ + ${{ env.VCPKG_ROOT }}/buildtrees/gflags/ name: vcpkg-log - name: Build GLib shell: cmd From cc27680048b76f582308425e752c10258a8d0bfe Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 15:49:12 +0900 Subject: [PATCH 06/18] Prepare vcpkg --- .github/workflows/ruby.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index c634676b53c..c9ddeb4d777 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -79,7 +79,7 @@ jobs: UBUNTU: ${{ matrix.ubuntu }} steps: - name: Checkout Arrow - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 submodules: recursive @@ -148,7 +148,7 @@ jobs: ARROW_WITH_ZSTD: ON steps: - name: Checkout Arrow - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 submodules: recursive @@ -248,7 +248,7 @@ jobs: /d 1 ` /f - name: Checkout Arrow - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 submodules: recursive @@ -366,7 +366,7 @@ jobs: /d 1 ` /f - name: Checkout Arrow - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 submodules: recursive @@ -395,6 +395,19 @@ jobs: env: # We can invalidate the current cache by updating this. CACHE_VERSION: "2024-05-09" + - name: Checkout vcpkg + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: vcpkg + repository: microsoft/vcpkg + - name: Bootstrap vcpkg + run: | + vcpkg\bootstrap-vcpkg.bat + $VCPKG_ROOT = $(Resolve-Path -LiteralPath "vcpkg").ToString() + Write-Output ${VCPKG_ROOT} | ` + Out-File -FilePath ${Env:GITHUB_PATH} -Encoding utf8 -Append + Write-Output "VCPKG_ROOT=${VCPKG_ROOT}" | ` + Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append - name: Setup NuGet credentials for vcpkg caching shell: bash run: | From 2a85365f8395d63f0a1245120c8f3e88a843b2b6 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 15:52:55 +0900 Subject: [PATCH 07/18] Debug --- .github/workflows/ruby.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index c9ddeb4d777..060da2fd98e 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -411,6 +411,8 @@ jobs: - name: Setup NuGet credentials for vcpkg caching shell: bash run: | + echo $PATH + which vcpkg $(vcpkg fetch nuget | tail -n 1) \ sources add \ -source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" \ From 4212d8a7ecee40eaf0c1c347ee3b7329518b9999 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 15:57:09 +0900 Subject: [PATCH 08/18] Debug --- cpp/cmake_modules/Usevcpkg.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/cmake_modules/Usevcpkg.cmake b/cpp/cmake_modules/Usevcpkg.cmake index 016cfd169e4..2b222155653 100644 --- a/cpp/cmake_modules/Usevcpkg.cmake +++ b/cpp/cmake_modules/Usevcpkg.cmake @@ -40,6 +40,7 @@ endmacro() # Get VCPKG_ROOT if(DEFINED CMAKE_TOOLCHAIN_FILE) + message("CMAKE_TOOLCHAIN_FILE is defined: ${CMAKE_TOOLCHAIN_FILE}") # Get it from the CMake variable CMAKE_TOOLCHAIN_FILE get_filename_component(_VCPKG_DOT_CMAKE "${CMAKE_TOOLCHAIN_FILE}" NAME) if(EXISTS "${CMAKE_TOOLCHAIN_FILE}" AND _VCPKG_DOT_CMAKE STREQUAL "vcpkg.cmake") @@ -51,6 +52,7 @@ if(DEFINED CMAKE_TOOLCHAIN_FILE) endif() else() if(DEFINED VCPKG_ROOT) + message("VCPKG_ROOT is defined: ${VCPKG_ROOT}") # Get it from the CMake variable VCPKG_ROOT find_program(_VCPKG_BIN vcpkg PATHS "${VCPKG_ROOT}" @@ -59,6 +61,7 @@ else() message(FATAL_ERROR "vcpkg not found in directory specified in -DVCPKG_ROOT") endif() elseif(DEFINED ENV{VCPKG_ROOT}) + message("ENV{VCPKG_ROOT} is defined: $ENV{VCPKG_ROOT}") # Get it from the environment variable VCPKG_ROOT set(VCPKG_ROOT $ENV{VCPKG_ROOT}) find_program(_VCPKG_BIN vcpkg @@ -69,6 +72,7 @@ else() ) endif() else() + message("else") # Get it from the file vcpkg.path.txt find_program(_VCPKG_BIN vcpkg) if(_VCPKG_BIN) From ecddc67c598640b87c39f639a8e9dbcb25a7356e Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 16:06:54 +0900 Subject: [PATCH 09/18] Debug --- .github/workflows/ruby.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 060da2fd98e..131f9ce5dcc 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -411,8 +411,6 @@ jobs: - name: Setup NuGet credentials for vcpkg caching shell: bash run: | - echo $PATH - which vcpkg $(vcpkg fetch nuget | tail -n 1) \ sources add \ -source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" \ @@ -426,7 +424,9 @@ jobs: - name: Build C++ shell: cmd run: | + set VCPKG_ROOT_KEEP=%VCPKG_ROOT% call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + set VCPKG_ROOT=%VCPKG_ROOT_KEEP% bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build" - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: failure() @@ -440,6 +440,7 @@ jobs: - name: Build GLib shell: cmd run: | + set VCPKG_ROOT_KEEP=%VCPKG_ROOT% call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - set PATH=%VCPKG_ROOT%;%PATH% + set VCPKG_ROOT=%VCPKG_ROOT_KEEP% bash -c "ci/scripts/c_glib_build.sh $(pwd) $(pwd)/build" From ea01b385a65e423c66107218fa34f0205a82c0fb Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 16:14:47 +0900 Subject: [PATCH 10/18] Use specified baseline --- .github/workflows/ruby.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 131f9ce5dcc..60668628c1d 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -395,10 +395,15 @@ jobs: env: # We can invalidate the current cache by updating this. CACHE_VERSION: "2024-05-09" + - name: Detect vcpkg commit ID + run: | + baseline=$(jq -r '.["builtin-baseline"]' cpp/vcpkg.json) + echo "VCPKG_BASELINE=${baseline}" >> ${GITHUB_ENV} - name: Checkout vcpkg uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: path: vcpkg + ref: ${{ env.VCPKG_BASELINE }} repository: microsoft/vcpkg - name: Bootstrap vcpkg run: | From e9dfa9eafd03fee85fe9e853447e3551bc969dfc Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 16:20:47 +0900 Subject: [PATCH 11/18] bash --- .github/workflows/ruby.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 60668628c1d..7a7174e5bbd 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -396,6 +396,7 @@ jobs: # We can invalidate the current cache by updating this. CACHE_VERSION: "2024-05-09" - name: Detect vcpkg commit ID + shell: bash run: | baseline=$(jq -r '.["builtin-baseline"]' cpp/vcpkg.json) echo "VCPKG_BASELINE=${baseline}" >> ${GITHUB_ENV} From 3faa97af5004d3c6febc6d00e03bf657b86e24d1 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 16:23:58 +0900 Subject: [PATCH 12/18] Fetch all --- .github/workflows/ruby.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7a7174e5bbd..96920921411 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -395,16 +395,11 @@ jobs: env: # We can invalidate the current cache by updating this. CACHE_VERSION: "2024-05-09" - - name: Detect vcpkg commit ID - shell: bash - run: | - baseline=$(jq -r '.["builtin-baseline"]' cpp/vcpkg.json) - echo "VCPKG_BASELINE=${baseline}" >> ${GITHUB_ENV} - name: Checkout vcpkg uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: + fetch-depth: 0 path: vcpkg - ref: ${{ env.VCPKG_BASELINE }} repository: microsoft/vcpkg - name: Bootstrap vcpkg run: | From 91a347f1b8bcbdd3c2084c0897d8a2104e916b85 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 16:51:54 +0900 Subject: [PATCH 13/18] Remove debug prints --- c_glib/vcpkg.json | 4 ++-- cpp/cmake_modules/Usevcpkg.cmake | 4 ---- cpp/vcpkg.json | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/c_glib/vcpkg.json b/c_glib/vcpkg.json index 9ece019dafb..b05f7e8d1f2 100644 --- a/c_glib/vcpkg.json +++ b/c_glib/vcpkg.json @@ -6,6 +6,6 @@ "glib", "pkgconf" ], - "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", - "builtin-baseline": "1852c473a9d8dbb632693f533d7c7c550cb7a07a" + "$comment": "We can update builtin-baseline by 'vcpkg x-update-baseline'", + "builtin-baseline": "09f6a4ef2f08252f7f4d924fd9c2d42165fb21c9" } diff --git a/cpp/cmake_modules/Usevcpkg.cmake b/cpp/cmake_modules/Usevcpkg.cmake index 2b222155653..016cfd169e4 100644 --- a/cpp/cmake_modules/Usevcpkg.cmake +++ b/cpp/cmake_modules/Usevcpkg.cmake @@ -40,7 +40,6 @@ endmacro() # Get VCPKG_ROOT if(DEFINED CMAKE_TOOLCHAIN_FILE) - message("CMAKE_TOOLCHAIN_FILE is defined: ${CMAKE_TOOLCHAIN_FILE}") # Get it from the CMake variable CMAKE_TOOLCHAIN_FILE get_filename_component(_VCPKG_DOT_CMAKE "${CMAKE_TOOLCHAIN_FILE}" NAME) if(EXISTS "${CMAKE_TOOLCHAIN_FILE}" AND _VCPKG_DOT_CMAKE STREQUAL "vcpkg.cmake") @@ -52,7 +51,6 @@ if(DEFINED CMAKE_TOOLCHAIN_FILE) endif() else() if(DEFINED VCPKG_ROOT) - message("VCPKG_ROOT is defined: ${VCPKG_ROOT}") # Get it from the CMake variable VCPKG_ROOT find_program(_VCPKG_BIN vcpkg PATHS "${VCPKG_ROOT}" @@ -61,7 +59,6 @@ else() message(FATAL_ERROR "vcpkg not found in directory specified in -DVCPKG_ROOT") endif() elseif(DEFINED ENV{VCPKG_ROOT}) - message("ENV{VCPKG_ROOT} is defined: $ENV{VCPKG_ROOT}") # Get it from the environment variable VCPKG_ROOT set(VCPKG_ROOT $ENV{VCPKG_ROOT}) find_program(_VCPKG_BIN vcpkg @@ -72,7 +69,6 @@ else() ) endif() else() - message("else") # Get it from the file vcpkg.path.txt find_program(_VCPKG_BIN vcpkg) if(_VCPKG_BIN) diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index 9a97a3b61eb..529df24cc85 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -56,6 +56,6 @@ "zlib", "zstd" ], - "$comment": "You can update builtin-baseline by 'vcpkg x-update-baseline'", - "builtin-baseline": "1852c473a9d8dbb632693f533d7c7c550cb7a07a" + "$comment": "We can update builtin-baseline by 'vcpkg x-update-baseline'", + "builtin-baseline": "09f6a4ef2f08252f7f4d924fd9c2d42165fb21c9" } From 65846529f86802111f23db1fe143b1b3df41cb62 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 16:57:55 +0900 Subject: [PATCH 14/18] Remove debug code --- .github/workflows/ruby.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 96920921411..be90eeee39b 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -429,15 +429,6 @@ jobs: call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 set VCPKG_ROOT=%VCPKG_ROOT_KEEP% bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build" - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: failure() - with: - path: | - build/cpp/vcpkg_installed/vcpkg/blds/gflags/*.log - build/cpp/vcpkg*.log - build/cpp/vcpkg/buildtrees/gflags/ - ${{ env.VCPKG_ROOT }}/buildtrees/gflags/ - name: vcpkg-log - name: Build GLib shell: cmd run: | From 13d1304891764614c0617d0fa227b8391e9735de Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Apr 2025 20:15:35 +0900 Subject: [PATCH 15/18] Specify start_int_size explicitly --- c_glib/arrow-glib/array-builder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c_glib/arrow-glib/array-builder.cpp b/c_glib/arrow-glib/array-builder.cpp index 87e22c74352..d7a6d8233ca 100644 --- a/c_glib/arrow-glib/array-builder.cpp +++ b/c_glib/arrow-glib/array-builder.cpp @@ -1120,7 +1120,7 @@ garrow_int_array_builder_new(void) { auto memory_pool = arrow::default_memory_pool(); auto arrow_builder = std::static_pointer_cast( - std::make_shared(memory_pool)); + std::make_shared(sizeof(int8_t), memory_pool)); auto builder = garrow_array_builder_new_raw(&arrow_builder, GARROW_TYPE_INT_ARRAY_BUILDER); return GARROW_INT_ARRAY_BUILDER(builder); @@ -1274,7 +1274,7 @@ garrow_uint_array_builder_new(void) { auto memory_pool = arrow::default_memory_pool(); auto arrow_builder = std::static_pointer_cast( - std::make_shared(memory_pool)); + std::make_shared(sizeof(uint8_t), memory_pool)); auto builder = garrow_array_builder_new_raw(&arrow_builder, GARROW_TYPE_UINT_ARRAY_BUILDER); return GARROW_UINT_ARRAY_BUILDER(builder); From e99ea173c1f9c482a4efe1678ac1d3752dc8b8df Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 4 Apr 2025 00:29:47 +0900 Subject: [PATCH 16/18] Don't use pkgconf on Windows --- c_glib/arrow-glib/array-builder.cpp | 4 +- c_glib/meson.build | 97 +++++++++++++++++++++++------ ci/scripts/c_glib_build.sh | 5 +- 3 files changed, 83 insertions(+), 23 deletions(-) diff --git a/c_glib/arrow-glib/array-builder.cpp b/c_glib/arrow-glib/array-builder.cpp index d7a6d8233ca..87e22c74352 100644 --- a/c_glib/arrow-glib/array-builder.cpp +++ b/c_glib/arrow-glib/array-builder.cpp @@ -1120,7 +1120,7 @@ garrow_int_array_builder_new(void) { auto memory_pool = arrow::default_memory_pool(); auto arrow_builder = std::static_pointer_cast( - std::make_shared(sizeof(int8_t), memory_pool)); + std::make_shared(memory_pool)); auto builder = garrow_array_builder_new_raw(&arrow_builder, GARROW_TYPE_INT_ARRAY_BUILDER); return GARROW_INT_ARRAY_BUILDER(builder); @@ -1274,7 +1274,7 @@ garrow_uint_array_builder_new(void) { auto memory_pool = arrow::default_memory_pool(); auto arrow_builder = std::static_pointer_cast( - std::make_shared(sizeof(uint8_t), memory_pool)); + std::make_shared(memory_pool)); auto builder = garrow_array_builder_new_raw(&arrow_builder, GARROW_TYPE_UINT_ARRAY_BUILDER); return GARROW_UINT_ARRAY_BUILDER(builder); diff --git a/c_glib/meson.build b/c_glib/meson.build index 11b6ba2f476..3cea9b4182e 100644 --- a/c_glib/meson.build +++ b/c_glib/meson.build @@ -48,6 +48,7 @@ endif version_major = version_numbers[0].to_int() version_minor = version_numbers[1].to_int() version_micro = version_numbers[2].to_int() +version_no_snapshot = '.'.join(version_numbers) api_version = '1.0' so_version = version_major * 100 + version_minor @@ -81,7 +82,7 @@ endif generate_vapi = have_gi and get_option('vapi') if generate_vapi pkgconfig_variables += ['vapidir=@0@'.format(vapi_dir)] - add_languages('vala') + add_languages('vala', native: false) endif arrow_cpp_build_dir = get_option('arrow_cpp_build_dir') @@ -97,47 +98,103 @@ else endif if arrow_cpp_build_lib_dir == '' - arrow = dependency('arrow', version: ['>=' + version]) + common_args = {'version': [f'>=@version_no_snapshot@']} + if build_machine.system() == 'windows' + # pkgconf uses "--static" by default on Windows. It doesn't work + # for arrow*.pc because arrow*.pc use "Cflags.private: + # -DARROW*_STATIC". Shared libraries don't work with + # "-DARROW*_STATIC". So we always use CMake on Windows. + common_args += {'method': 'cmake'} + endif + arrow = dependency( + 'arrow', + 'Arrow', + kwargs: common_args, + modules: ['Arrow::arrow_shared'], + ) # They are just for checking required modules are enabled. They are built into # libarrow.so. So we don't need additional build flags for them. - dependency('arrow-compute', version: ['>=' + version]) - dependency('arrow-csv', version: ['>=' + version]) - dependency('arrow-filesystem', version: ['>=' + version]) - dependency('arrow-json', version: ['>=' + version]) + if arrow.type_name() == 'cmake' + assert( + arrow.get_variable('ARROW_COMPUTE', default_value: 'OFF') == 'ON', + 'compute module must be enabled', + ) + assert( + arrow.get_variable('ARROW_CSV', default_value: 'OFF') == 'ON', + 'CSV module must be enabled', + ) + assert( + arrow.get_variable('ARROW_FILESYSTEM', default_value: 'OFF') == 'ON', + 'filesystem module must be enabled', + ) + assert( + arrow.get_variable('ARROW_JSON', default_value: 'OFF') == 'ON', + 'JSON module must be enabled', + ) + else + dependency('arrow-compute', kwargs: common_args) + dependency('arrow-csv', kwargs: common_args) + dependency('arrow-filesystem', kwargs: common_args) + dependency('arrow-json', kwargs: common_args) + endif - have_arrow_orc = dependency( - 'arrow-orc', - required: false, - version: ['>=' + version], - ).found() + if arrow.type_name() == 'cmake' + have_arrow_orc = (arrow.get_variable('ARROW_ORC', default_value: 'OFF') == 'ON') + else + have_arrow_orc = dependency( + 'arrow-orc', + kwargs: common_args, + required: false, + ).found() + endif arrow_cuda = dependency( 'arrow-cuda', + 'ArrowCUDA', + kwargs: common_args, + modules: ['ArrowCUDA::arrow_cuda_shared'], required: false, - version: ['>=' + version], ) - # we do not support compiling glib without acero engine + # we do not support compiling GLib without Acero engine arrow_acero = dependency( 'arrow-acero', - required: true, - version: ['>=' + version], + 'ArrowAcero', + kwargs: common_args, + modules: ['ArrowAcero::arrow_acero_shared'], ) arrow_dataset = dependency( 'arrow-dataset', + 'ArrowDataset', + kwargs: common_args, + modules: ['ArrowDataset::arrow_dataset_shared'], required: false, - version: ['>=' + version], ) arrow_flight = dependency( 'arrow-flight', + 'ArrowFlight', + kwargs: common_args, + modules: ['ArrowFlight::arrow_flight_shared'], required: false, - version: ['>=' + version], ) arrow_flight_sql = dependency( 'arrow-flight-sql', + 'ArrowFlightSql', + kwargs: common_args, + modules: ['ArrowFlightSql::arrow_flight_sql_shared'], + required: false, + ) + gandiva = dependency( + 'gandiva', + 'Gandiva', + kwargs: common_args, + modules: ['Gandiva::gandiva_shared'], required: false, - version: ['>=' + version], ) - gandiva = dependency('gandiva', required: false, version: ['>=' + version]) - parquet = dependency('parquet', required: false, version: ['>=' + version]) + parquet = dependency( + 'parquet', + 'Parquet', + kwargs: common_args, + modules: ['Parquet::parquet_shared'], + ) else base_include_directories += [ include_directories(join_paths(arrow_cpp_build_dir, 'src')), diff --git a/ci/scripts/c_glib_build.sh b/ci/scripts/c_glib_build.sh index 54bd7e5645a..359d76c6d75 100755 --- a/ci/scripts/c_glib_build.sh +++ b/ci/scripts/c_glib_build.sh @@ -37,6 +37,7 @@ fi PATH="${ARROW_HOME}/bin:${PATH}" +meson_cmake_prefix_path="${ARROW_HOME}" meson_pkg_config_path="${ARROW_HOME}/lib/pkgconfig" mkdir -p "${build_dir}" @@ -46,6 +47,7 @@ if [ -n "${VCPKG_DEFAULT_TRIPLET:-}" ]; then vcpkg install \ --x-manifest-root="${source_dir}" \ --x-install-root="${vcpkg_install_root}" + meson_cmake_prefix_path="${vcpkg_install_root}/${VCPKG_DEFAULT_TRIPLET}:${meson_cmake_prefix_path}" PKG_CONFIG="${vcpkg_install_root}/${VCPKG_DEFAULT_TRIPLET}/tools/pkgconf/pkgconf.exe" export PKG_CONFIG meson_pkg_config_path="${vcpkg_install_root}/${VCPKG_DEFAULT_TRIPLET}/lib/pkgconfig:${meson_pkg_config_path}" @@ -65,9 +67,10 @@ fi # Build with Meson meson setup \ --backend=ninja \ - --prefix="${ARROW_HOME}" \ + --cmake-prefix-path="${meson_cmake_prefix_path}" \ --libdir=lib \ --pkg-config-path="${meson_pkg_config_path}" \ + --prefix="${ARROW_HOME}" \ -Ddoc="${with_doc}" \ -Dvapi="${ARROW_GLIB_VAPI}" \ -Dwerror="${ARROW_GLIB_WERROR}" \ From 680bba1256a108ab8ab60088b06707eeab8f39c8 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 4 Apr 2025 10:43:32 +0900 Subject: [PATCH 17/18] Don't provide -D*_STATIC without ARROW_BUILD_STATIC --- c_glib/meson.build | 7 --- cpp/CMakeLists.txt | 63 ++++++++++++++++++- cpp/src/arrow/acero/CMakeLists.txt | 9 +++ cpp/src/arrow/acero/arrow-acero.pc.in | 3 +- cpp/src/arrow/dataset/CMakeLists.txt | 9 +++ cpp/src/arrow/dataset/arrow-dataset.pc.in | 3 +- cpp/src/arrow/engine/CMakeLists.txt | 9 +++ cpp/src/arrow/engine/arrow-substrait.pc.in | 3 +- cpp/src/arrow/flight/CMakeLists.txt | 9 +++ cpp/src/arrow/flight/arrow-flight.pc.in | 3 +- cpp/src/arrow/flight/sql/CMakeLists.txt | 9 +++ .../arrow/flight/sql/arrow-flight-sql.pc.in | 3 +- cpp/src/gandiva/CMakeLists.txt | 9 +++ cpp/src/gandiva/gandiva.pc.in | 4 +- 14 files changed, 126 insertions(+), 17 deletions(-) diff --git a/c_glib/meson.build b/c_glib/meson.build index 3cea9b4182e..fd931cc6a48 100644 --- a/c_glib/meson.build +++ b/c_glib/meson.build @@ -99,13 +99,6 @@ endif if arrow_cpp_build_lib_dir == '' common_args = {'version': [f'>=@version_no_snapshot@']} - if build_machine.system() == 'windows' - # pkgconf uses "--static" by default on Windows. It doesn't work - # for arrow*.pc because arrow*.pc use "Cflags.private: - # -DARROW*_STATIC". Shared libraries don't work with - # "-DARROW*_STATIC". So we always use CMake on Windows. - common_args += {'method': 'cmake'} - endif arrow = dependency( 'arrow', 'Arrow', diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 3c628a20c35..1434eefd0bd 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -532,22 +532,79 @@ enable_testing() # For arrow.pc. Cflags.private, Libs.private and Requires.private are # used when "pkg-config --cflags --libs --static arrow" is used. set(ARROW_PC_CFLAGS "") -set(ARROW_PC_CFLAGS_PRIVATE " -DARROW_STATIC") +set(ARROW_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + # We add -DARROW_STATIC only when static build is enabled because + # pkgconf 1.7.4 or later on Windows uses "--static" by default. If + # Cflags.private (-DARROW_STATIC) is used for shared linking, it + # will cause linke error. We recommend users to not use pkgconf for + # shared linking on Windows but we also provide a workaround here. + # If users don't enable ARROW_BUILD_STATIC, users can use pkgconf on + # Windows because Cflags.private is used but it has nothing. + string(APPEND ARROW_PC_CFLAGS_PRIVATE " -DARROW_STATIC") +endif() set(ARROW_PC_LIBS_PRIVATE "") set(ARROW_PC_REQUIRES_PRIVATE "") +# For arrow-acero.pc. +set(ARROW_ACERO_PC_CFLAGS "") +set(ARROW_ACERO_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND ARROW_ACERO_PC_CFLAGS_PRIVATE " -DARROW_ACERO_STATIC") +endif() + +# For arrow-acero.pc. +set(ARROW_DATASET_PC_CFLAGS "") +set(ARROW_DATASET_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND ARROW_DATASET_PC_CFLAGS_PRIVATE " -DARROW_DS_STATIC") +endif() + # For arrow-flight.pc. +set(ARROW_FLIGHT_PC_CFLAGS "") +set(ARROW_FLIGHT_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND ARROW_FLIGHT_PC_CFLAGS_PRIVATE " -DARROW_FLIGHT_STATIC") +endif() set(ARROW_FLIGHT_PC_REQUIRES_PRIVATE "") +# For arrow-flight-sql.pc. +set(ARROW_FLIGHT_SQL_PC_CFLAGS "") +set(ARROW_FLIGHT_SQL_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND ARROW_FLIGHT_SQL_PC_CFLAGS_PRIVATE " -DARROW_FLIGHT_SQL_STATIC") +endif() +set(ARROW_FLIGHT_PC_REQUIRES_PRIVATE "") + +# For arrow-substrait.pc. +set(ARROW_SUBSTRAIT_PC_CFLAGS "") +set(ARROW_SUBSTRAIT_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND ARROW_SUBSTRAIT_PC_CFLAGS_PRIVATE " -DARROW_ENGINE_STATIC") +endif() + # For arrow-testing.pc. set(ARROW_TESTING_PC_CFLAGS "") -set(ARROW_TESTING_PC_CFLAGS_PRIVATE " -DARROW_TESTING_STATIC") +set(ARROW_TESTING_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND ARROW_TESTING_PC_CFLAGS_PRIVATE " -DARROW_TESTING_STATIC") +endif() set(ARROW_TESTING_PC_LIBS "") set(ARROW_TESTING_PC_REQUIRES "") +# For gandiva.pc. +set(GANDIVA_PC_CFLAGS "") +set(GANDIVA_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND GANDIVA_PC_CFLAGS_PRIVATE " -DGANDIVA_STATIC") +endif() + # For parquet.pc. set(PARQUET_PC_CFLAGS "") -set(PARQUET_PC_CFLAGS_PRIVATE " -DPARQUET_STATIC") +set(PARQUET_PC_CFLAGS_PRIVATE "") +if(ARROW_BUILD_STATIC) + string(APPEND PARQUET_PC_CFLAGS_PRIVATE " -DPARQUET_STATIC") +endif() set(PARQUET_PC_REQUIRES "") set(PARQUET_PC_REQUIRES_PRIVATE "") diff --git a/cpp/src/arrow/acero/CMakeLists.txt b/cpp/src/arrow/acero/CMakeLists.txt index e6aa0560dfa..5708d71737c 100644 --- a/cpp/src/arrow/acero/CMakeLists.txt +++ b/cpp/src/arrow/acero/CMakeLists.txt @@ -19,6 +19,15 @@ add_custom_target(arrow_acero) arrow_install_all_headers("arrow/acero") +# If libarrow_acero.a is only built, "pkg-config --cflags --libs +# arrow-acero" outputs build flags for static linking not shared +# linking. ARROW_ACERO_PC_* except ARROW_ACERO_PC_*_PRIVATE are for +# the static linking case. +if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) + string(APPEND ARROW_ACERO_PC_CFLAGS "${ARROW_ACERO_PC_CFLAGS_PRIVATE}") + set(ARROW_ACERO_PC_CFLAGS_PRIVATE "") +endif() + set(ARROW_ACERO_SRCS accumulation_queue.cc scalar_aggregate_node.cc diff --git a/cpp/src/arrow/acero/arrow-acero.pc.in b/cpp/src/arrow/acero/arrow-acero.pc.in index fde3262b9a2..ddddd52c4dd 100644 --- a/cpp/src/arrow/acero/arrow-acero.pc.in +++ b/cpp/src/arrow/acero/arrow-acero.pc.in @@ -24,4 +24,5 @@ Description: Apache Arrow's Acero Engine. Version: @ARROW_VERSION@ Requires: arrow Libs: -L${libdir} -larrow_acero -Cflags.private: -DARROW_ACERO_STATIC +Cflags:@ARROW_ACERO_PC_CFLAGS@ +Cflags.private:@ARROW_ACERO_PC_CFLAGS_PRIVATE@ diff --git a/cpp/src/arrow/dataset/CMakeLists.txt b/cpp/src/arrow/dataset/CMakeLists.txt index e99593f669b..29d8c3cb59f 100644 --- a/cpp/src/arrow/dataset/CMakeLists.txt +++ b/cpp/src/arrow/dataset/CMakeLists.txt @@ -19,6 +19,15 @@ add_custom_target(arrow_dataset) arrow_install_all_headers("arrow/dataset") +# If libarrow_dataset.a is only built, "pkg-config --cflags --libs +# arrow-dataset" outputs build flags for static linking not shared +# linking. ARROW_DATASET_PC_* except ARROW_DATASET_PC_*_PRIVATE are for +# the static linking case. +if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) + string(APPEND ARROW_DATASET_PC_CFLAGS "${ARROW_DATASET_PC_CFLAGS_PRIVATE}") + set(ARROW_DATASET_PC_CFLAGS_PRIVATE "") +endif() + set(ARROW_DATASET_SRCS dataset.cc dataset_writer.cc diff --git a/cpp/src/arrow/dataset/arrow-dataset.pc.in b/cpp/src/arrow/dataset/arrow-dataset.pc.in index d587fd110c0..4e35c554d7f 100644 --- a/cpp/src/arrow/dataset/arrow-dataset.pc.in +++ b/cpp/src/arrow/dataset/arrow-dataset.pc.in @@ -24,4 +24,5 @@ Description: Apache Arrow Dataset provides an API to read and write semantic dat Version: @ARROW_VERSION@ Requires: @ARROW_DATASET_PKG_CONFIG_REQUIRES@ Libs: -L${libdir} -larrow_dataset -Cflags.private: -DARROW_DS_STATIC +Cflags:@ARROW_DATASET_PC_CFLAGS@ +Cflags.private:@ARROW_DATASET_PC_CFLAGS_PRIVATE@ diff --git a/cpp/src/arrow/engine/CMakeLists.txt b/cpp/src/arrow/engine/CMakeLists.txt index fcaa242b114..6978a8383f0 100644 --- a/cpp/src/arrow/engine/CMakeLists.txt +++ b/cpp/src/arrow/engine/CMakeLists.txt @@ -19,6 +19,15 @@ add_custom_target(arrow_substrait) arrow_install_all_headers("arrow/engine") +# If libarrow_substrait.a is only built, "pkg-config --cflags --libs +# arrow-substrait" outputs build flags for static linking not shared +# linking. ARROW_SUBSTRAIT_PC_* except ARROW_SUBSTRAIT_PC_*_PRIVATE are for +# the static linking case. +if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) + string(APPEND ARROW_SUBSTRAIT_PC_CFLAGS "${ARROW_SUBSTRAIT_PC_CFLAGS_PRIVATE}") + set(ARROW_SUBSTRAIT_PC_CFLAGS_PRIVATE "") +endif() + set(ARROW_SUBSTRAIT_SRCS substrait/expression_internal.cc substrait/extended_expression_internal.cc diff --git a/cpp/src/arrow/engine/arrow-substrait.pc.in b/cpp/src/arrow/engine/arrow-substrait.pc.in index 1e891995e2d..ceb9d0fadaa 100644 --- a/cpp/src/arrow/engine/arrow-substrait.pc.in +++ b/cpp/src/arrow/engine/arrow-substrait.pc.in @@ -24,4 +24,5 @@ Description: Apache Arrow's Substrait Consumer. Version: @ARROW_VERSION@ Requires: arrow-dataset Libs: -L${libdir} -larrow_substrait -Cflags.private: -DARROW_ENGINE_STATIC +Cflags:@ARROW_SUBSTRAIT_PC_CFLAGS@ +Cflags.private:@ARROW_SUBSTRAIT_PC_CFLAGS_PRIVATE@ diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt index b92d900ffd9..564d300ffa6 100644 --- a/cpp/src/arrow/flight/CMakeLists.txt +++ b/cpp/src/arrow/flight/CMakeLists.txt @@ -19,6 +19,15 @@ add_custom_target(arrow_flight) arrow_install_all_headers("arrow/flight") +# If libarrow_flight.a is only built, "pkg-config --cflags --libs +# arrow-flight" outputs build flags for static linking not shared +# linking. ARROW_FLIGHT_PC_* except ARROW_FLIGHT_PC_*_PRIVATE are for +# the static linking case. +if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) + string(APPEND ARROW_FLIGHT_PC_CFLAGS "${ARROW_FLIGHT_PC_CFLAGS_PRIVATE}") + set(ARROW_FLIGHT_PC_CFLAGS_PRIVATE "") +endif() + set(ARROW_FLIGHT_LINK_LIBS gRPC::grpc++ ${ARROW_PROTOBUF_LIBPROTOBUF}) if(ARROW_WITH_OPENTELEMETRY) list(APPEND ARROW_FLIGHT_LINK_LIBS ${ARROW_OPENTELEMETRY_LIBS}) diff --git a/cpp/src/arrow/flight/arrow-flight.pc.in b/cpp/src/arrow/flight/arrow-flight.pc.in index a63d6cadaa8..f548c642a71 100644 --- a/cpp/src/arrow/flight/arrow-flight.pc.in +++ b/cpp/src/arrow/flight/arrow-flight.pc.in @@ -25,4 +25,5 @@ Version: @ARROW_VERSION@ Requires: arrow Requires.private:@ARROW_FLIGHT_PC_REQUIRES_PRIVATE@ Libs: -L${libdir} -larrow_flight -Cflags.private: -DARROW_FLIGHT_STATIC +Cflags:@ARROW_FLIGHT_PC_CFLAGS@ +Cflags.private:@ARROW_FLIGHT_PC_CFLAGS_PRIVATE@ diff --git a/cpp/src/arrow/flight/sql/CMakeLists.txt b/cpp/src/arrow/flight/sql/CMakeLists.txt index b32f7314967..796cb9da18e 100644 --- a/cpp/src/arrow/flight/sql/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/CMakeLists.txt @@ -19,6 +19,15 @@ add_custom_target(arrow_flight_sql) arrow_install_all_headers("arrow/flight/sql") +# If libarrow_flight_sql.a is only built, "pkg-config --cflags --libs +# arrow-flight-sql" outputs build flags for static linking not shared +# linking. ARROW_FLIGHT_SQL_PC_* except ARROW_FLIGHT_PC_SQL_*_PRIVATE +# are for the static linking case. +if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) + string(APPEND ARROW_FLIGHT_SQL_PC_CFLAGS "${ARROW_FLIGHT_SQL_PC_CFLAGS_PRIVATE}") + set(ARROW_FLIGHT_SQL_PC_CFLAGS_PRIVATE "") +endif() + set(FLIGHT_SQL_PROTO_PATH "${ARROW_SOURCE_DIR}/../format") set(FLIGHT_SQL_PROTO ${ARROW_SOURCE_DIR}/../format/FlightSql.proto) diff --git a/cpp/src/arrow/flight/sql/arrow-flight-sql.pc.in b/cpp/src/arrow/flight/sql/arrow-flight-sql.pc.in index b76964b97c8..b42f00703a3 100644 --- a/cpp/src/arrow/flight/sql/arrow-flight-sql.pc.in +++ b/cpp/src/arrow/flight/sql/arrow-flight-sql.pc.in @@ -24,4 +24,5 @@ Description: Apache Arrow Flight SQL extension Version: @ARROW_VERSION@ Requires: arrow-flight Libs: -L${libdir} -larrow_flight_sql -Cflags.private: -DARROW_FLIGHT_SQL_STATIC +Cflags:@ARROW_FLIGHT_SQL_PC_CFLAGS@ +Cflags.private:@ARROW_FLIGHT_SQL_PC_CFLAGS_PRIVATE@ diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 3e63f88c3d2..a7f5f9dacff 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -25,6 +25,15 @@ add_custom_target(gandiva-benchmarks) add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) +# If libgandiva.a is only built, "pkg-config --cflags --libs +# arrow-flight" outputs build flags for static linking not shared +# linking. GANDIVA_PC_* except GANDIVA_PC_*_PRIVATE are for the static +# linking case. +if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC) + string(APPEND GANDIVA_PC_CFLAGS "${GANDIVA_PC_CFLAGS_PRIVATE}") + set(GANDIVA_PC_CFLAGS_PRIVATE "") +endif() + include(GandivaAddBitcode) find_package(LLVMAlt REQUIRED) diff --git a/cpp/src/gandiva/gandiva.pc.in b/cpp/src/gandiva/gandiva.pc.in index 49260092d29..e999a785fea 100644 --- a/cpp/src/gandiva/gandiva.pc.in +++ b/cpp/src/gandiva/gandiva.pc.in @@ -24,5 +24,5 @@ Description: Gandiva is a toolset for compiling and evaluating expressions on Ar Version: @GANDIVA_VERSION@ Requires: arrow Libs: -L${libdir} -lgandiva -Cflags: -I${includedir} -Cflags.private: -DGANDIVA_STATIC +Cflags: -I${includedir}@GANDIVA_PC_CFLAGS@ +Cflags.private:@GANDIVA_PC_CFLAGS_PRIVATE@ From 4a71e33526aa3a95ab5082e941af2dc3257347c6 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 4 Apr 2025 13:58:33 +0900 Subject: [PATCH 18/18] Fix a typo --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 1434eefd0bd..d1b7f3f31bd 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -553,7 +553,7 @@ if(ARROW_BUILD_STATIC) string(APPEND ARROW_ACERO_PC_CFLAGS_PRIVATE " -DARROW_ACERO_STATIC") endif() -# For arrow-acero.pc. +# For arrow-dataset.pc. set(ARROW_DATASET_PC_CFLAGS "") set(ARROW_DATASET_PC_CFLAGS_PRIVATE "") if(ARROW_BUILD_STATIC)