Skip to content

Conversation

@kou
Copy link
Member

@kou kou commented Apr 2, 2025

Rationale for this change

We always use BoostConfig.cmake by #45623. We don't use FindBoost.cmake.

We need to use recent vcpkg to use BoostConfig.cmake because old Boost doesn't provide it.

What changes are included in this PR?

  • Update vcpkg.json for cpp/ and c_glib/.
  • Always use the latest vcpkg instead of using vcpkg bundled in Visual Studio.
  • C++: Don't use gflags for building bundled gRPC because bundled gRPC doens't use gflags.
  • C++: Don't define -D*_EXPORT macros to Cflags.private in *.pc because pkgconf 1.7.4 or later uses --static by default on Windows. If --static is used by default, *_EXPORTs are defined for shared linking. It causes link errors. This is a workaround of this.
  • GLib: Add support for finding Apache Arrow C++ by CMake. It's another workaround for the pkgconf problem. If we use CMake, the pkgconf problem isn't related.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

@github-actions
Copy link

github-actions bot commented Apr 2, 2025

⚠️ GitHub issue #45994 has been automatically assigned in GitHub to PR creator.

@github-actions
Copy link

github-actions bot commented Apr 2, 2025

⚠️ GitHub issue #45994 has no components, please add labels for components.

@kou
Copy link
Member Author

kou commented Apr 2, 2025

@github-actions crossbow submit test-build-vcpkg-win

@github-actions

This comment was marked as outdated.

@kou
Copy link
Member Author

kou commented Apr 2, 2025

@github-actions crossbow submit test-build-vcpkg-win

@github-actions

This comment was marked as outdated.

@kou kou force-pushed the glib-vcpkg branch 3 times, most recently from 6fe94e7 to 3a1fa83 Compare April 2, 2025 10:29
@kou
Copy link
Member Author

kou commented Apr 2, 2025

@github-actions crossbow submit test-build-vcpkg-win

@github-actions

This comment was marked as outdated.

@kou
Copy link
Member Author

kou commented Apr 2, 2025

@github-actions crossbow submit test-build-vcpkg-win

@github-actions

This comment was marked as outdated.

@kou
Copy link
Member Author

kou commented Apr 3, 2025

@github-actions crossbow submit test-build-vcpkg-win

@assignUser
Copy link
Member

Let me know if this is ready for review!

@kou
Copy link
Member Author

kou commented Apr 3, 2025

OK!

This is the last error to be fixed:

https://github.com/apache/arrow/actions/runs/14237881729/job/39900817789?pr=46006#step:13:857

FAILED: arrow-glib/arrow-glib-2000.dll arrow-glib/arrow-glib-2000.pdb 
"link"  /MACHINE:x64 /OUT:arrow-glib/arrow-glib-2000.dll arrow-glib/arrow-glib-2000.dll.p/meson-generated_.._enums.c.obj arrow-glib/arrow-glib-2000.dll.p/array-builder.cpp.obj arrow-glib/arrow-glib-2000.dll.p/basic-array.cpp.obj arrow-glib/arrow-glib-2000.dll.p/basic-data-type.cpp.obj arrow-glib/arrow-glib-2000.dll.p/buffer.cpp.obj arrow-glib/arrow-glib-2000.dll.p/chunked-array.cpp.obj arrow-glib/arrow-glib-2000.dll.p/codec.cpp.obj arrow-glib/arrow-glib-2000.dll.p/composite-array.cpp.obj arrow-glib/arrow-glib-2000.dll.p/composite-data-type.cpp.obj arrow-glib/arrow-glib-2000.dll.p/datum.cpp.obj arrow-glib/arrow-glib-2000.dll.p/decimal.cpp.obj arrow-glib/arrow-glib-2000.dll.p/decoder.cpp.obj arrow-glib/arrow-glib-2000.dll.p/error.cpp.obj arrow-glib/arrow-glib-2000.dll.p/expression.cpp.obj arrow-glib/arrow-glib-2000.dll.p/field.cpp.obj arrow-glib/arrow-glib-2000.dll.p/interval.cpp.obj arrow-glib/arrow-glib-2000.dll.p/memory-pool.cpp.obj arrow-glib/arrow-glib-2000.dll.p/record-batch.cpp.obj arrow-glib/arrow-glib-2000.dll.p/scalar.cpp.obj arrow-glib/arrow-glib-2000.dll.p/schema.cpp.obj arrow-glib/arrow-glib-2000.dll.p/table-builder.cpp.obj arrow-glib/arrow-glib-2000.dll.p/table.cpp.obj arrow-glib/arrow-glib-2000.dll.p/tensor.cpp.obj arrow-glib/arrow-glib-2000.dll.p/timestamp-parser.cpp.obj arrow-glib/arrow-glib-2000.dll.p/type.cpp.obj arrow-glib/arrow-glib-2000.dll.p/file-mode.cpp.obj arrow-glib/arrow-glib-2000.dll.p/file.cpp.obj arrow-glib/arrow-glib-2000.dll.p/input-stream.cpp.obj arrow-glib/arrow-glib-2000.dll.p/output-stream.cpp.obj arrow-glib/arrow-glib-2000.dll.p/readable.cpp.obj arrow-glib/arrow-glib-2000.dll.p/writable-file.cpp.obj arrow-glib/arrow-glib-2000.dll.p/writable.cpp.obj arrow-glib/arrow-glib-2000.dll.p/ipc-options.cpp.obj arrow-glib/arrow-glib-2000.dll.p/metadata-version.cpp.obj arrow-glib/arrow-glib-2000.dll.p/reader.cpp.obj arrow-glib/arrow-glib-2000.dll.p/writer.cpp.obj arrow-glib/arrow-glib-2000.dll.p/compute.cpp.obj arrow-glib/arrow-glib-2000.dll.p/file-system.cpp.obj arrow-glib/arrow-glib-2000.dll.p/local-file-system.cpp.obj "/release" "/nologo" "/DEBUG" "/PDB:arrow-glib\arrow-glib-2000.pdb" "/DLL" "/IMPLIB:arrow-glib\arrow-glib.lib" "D:/a/arrow/arrow/dist/lib/arrow.lib" "D:/a/arrow/arrow/dist/lib/arrow_acero.lib" "D:/a/arrow/arrow/build/vcpkg_installed/x64-windows/lib/gobject-2.0.lib" "D:/a/arrow/arrow/build/vcpkg_installed/x64-windows/lib/glib-2.0.lib" "D:/a/arrow/arrow/build/vcpkg_installed/x64-windows/lib/intl.lib" "D:/a/arrow/arrow/build/vcpkg_installed/x64-windows/lib/iconv.lib" "/LIBPATH:D:/a/arrow/arrow/build/vcpkg_installed/x64-windows/lib" "ws2_32.lib" "winmm.lib" "D:/a/arrow/arrow/build/vcpkg_installed/x64-windows/lib/gio-2.0.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "comdlg32.lib" "advapi32.lib"
   Creating library arrow-glib\arrow-glib.lib and object arrow-glib\arrow-glib.exp
array-builder.cpp.obj : error LNK2019: unresolved external symbol "const arrow::AdaptiveUIntBuilder::`vftable'" (??_7AdaptiveUIntBuilder@arrow@@6B@) referenced in function "public: __cdecl arrow::AdaptiveUIntBuilder::AdaptiveUIntBuilder(class arrow::MemoryPool *)" (??0AdaptiveUIntBuilder@arrow@@QEAA@PEAVMemoryPool@1@@Z)
array-builder.cpp.obj : error LNK2019: unresolved external symbol "const arrow::AdaptiveIntBuilder::`vftable'" (??_7AdaptiveIntBuilder@arrow@@6B@) referenced in function "public: __cdecl arrow::AdaptiveIntBuilder::AdaptiveIntBuilder(class arrow::MemoryPool *,__int64)" (??0AdaptiveIntBuilder@arrow@@QEAA@PEAVMemoryPool@1@_J@Z)

I think that we can fix it by using correct build configurations not changing existing code but I haven't found it yet... I think that I can fix this tomorrow...

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting committer review Awaiting committer review labels Apr 4, 2025
@kou
Copy link
Member Author

kou commented Apr 4, 2025

@assignUser This is ready but there are many changes I thought...
See the PR description for summary of changes.

There were some problems to be fixed:

  • We need to use recent vcpkg to use Boost's CMake package (this was done by GH-45614: [C++] Use Boost's CMake packages instead of FindBoost.cmake in CMake #45623)
  • We need to fix the followings to use recent vcpkg:
    • GLib is buildable only with the very recent vcpkg
    • CMake 4.0.0 workaround (this is needed for gflags) is only available with the very recent vcpkg
    • pkgconf and our .pc aren't good pair for shared linking on Windows (I don't know why it didn't cause a link problem with old vcpkg we used... I think that pkgconf in the old vcpkg still has this problem...)

This PR fixes all of them.

Comment on lines +398 to +411
- name: Checkout vcpkg
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure using the latest vcpkg. vcpkg exists in GitHub Actions runner by default. But it may be older than vcpkg we want to use.

shell: cmd
run: |
set VCPKG_ROOT_KEEP=%VCPKG_ROOT%
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overrides VCPKG_ROOT. So we need to restore our VCPKG_ROOT after this.

if generate_vapi
pkgconfig_variables += ['vapidir=@0@'.format(vapi_dir)]
add_languages('vala')
add_languages('vala', native: false)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not required but it reports a warning.

common_args = {'version': [f'>=@version_no_snapshot@']}
arrow = dependency(
'arrow',
'Arrow',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for detecting a package for CMake.

'arrow',
'Arrow',
kwargs: common_args,
modules: ['Arrow::arrow_shared'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for detecting a package for CMake.

meson setup \
--backend=ninja \
--prefix="${ARROW_HOME}" \
--cmake-prefix-path="${meson_cmake_prefix_path}" \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for finding CMake packages of Apache Arrow C++.

Comment on lines +537 to +544
# 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")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for recent pkgconf on Windows. Our CI doesn't use -DARROW_BUILD_STATIC=ON.

Comment on lines -1671 to -1672
OR ARROW_WITH_GRPC)
set(ARROW_NEED_GFLAGS 1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundled gRPC doesn't need gflags.

This is not required because we use gflags provided by vcpkg. (This was needed before vcpkg adds CMake 4.0.0 workaround.)

{
"name": "gtest",
"features": [
"cxx17"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this because vcpkg's gtest uses C++14 by default.

@rem changes in vcpkg

vcpkg install ^
--triplet x64-windows ^
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use VCPKG_DEFAULT_TRIPLET env instead of this.

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting changes Awaiting changes labels Apr 7, 2025
@raulcd raulcd merged commit 3351aeb into apache:main Apr 7, 2025
38 checks passed
@raulcd raulcd removed the awaiting merge Awaiting merge label Apr 7, 2025
assignUser pushed a commit that referenced this pull request Apr 7, 2025
### Rationale for this change

We always use `BoostConfig.cmake` by #45623. We don't use `FindBoost.cmake`.

We need to use recent vcpkg to use `BoostConfig.cmake` because old Boost doesn't provide it. 

### What changes are included in this PR?

* Update `vcpkg.json` for `cpp/` and `c_glib/`.
* Always use the latest vcpkg instead of using vcpkg bundled in Visual Studio.
* C++: Don't use gflags for building bundled gRPC because bundled gRPC doens't use gflags.
* C++: Don't define `-D*_EXPORT` macros to `Cflags.private` in `*.pc` because pkgconf 1.7.4 or later uses `--static` by default on Windows. If `--static` is used by default, `*_EXPORT`s are defined for shared linking. It causes link errors. This is a workaround of this.
  * FYI: pkgconf/pkgconf@008d706
* GLib: Add support for finding Apache Arrow C++ by CMake. It's another workaround for the pkgconf problem. If we use CMake, the pkgconf problem isn't related.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #45994

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 3351aeb.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them.

@kou kou deleted the glib-vcpkg branch April 8, 2025 01:02
zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Apr 15, 2025
…pache#46006)

### Rationale for this change

We always use `BoostConfig.cmake` by apache#45623. We don't use `FindBoost.cmake`.

We need to use recent vcpkg to use `BoostConfig.cmake` because old Boost doesn't provide it. 

### What changes are included in this PR?

* Update `vcpkg.json` for `cpp/` and `c_glib/`.
* Always use the latest vcpkg instead of using vcpkg bundled in Visual Studio.
* C++: Don't use gflags for building bundled gRPC because bundled gRPC doens't use gflags.
* C++: Don't define `-D*_EXPORT` macros to `Cflags.private` in `*.pc` because pkgconf 1.7.4 or later uses `--static` by default on Windows. If `--static` is used by default, `*_EXPORT`s are defined for shared linking. It causes link errors. This is a workaround of this.
  * FYI: pkgconf/pkgconf@008d706
* GLib: Add support for finding Apache Arrow C++ by CMake. It's another workaround for the pkgconf problem. If we use CMake, the pkgconf problem isn't related.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: apache#45994

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants