Skip to content

GH-51007: [C++] Make uriparser an external dependency - #51244

Merged
raulcd merged 6 commits into
apache:mainfrom
imtherealnaska:gh-51007-uriparser-external
Oct 1, 2026
Merged

raulcd merged 6 commits into
apache:mainfrom
imtherealnaska:gh-51007-uriparser-external

Conversation

@imtherealnaska

@imtherealnaska imtherealnaska commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

The vendored uriparser in cpp/src/arrow/vendored/uriparser/ is 0.9.3, which is old and misses upstream security fixes. Instead of refreshing the vendored copy, this makes uriparser an external dependency like our other third-party dependencies.

What changes are included in this PR?

  • Add uriparser to ARROW_THIRDPARTY_DEPENDENCIES
  • Add build_uriparser() that builds uriparser 1.0.2 with FetchContent for uriparser_SOURCE=BUNDLED (static; docs, tests, tools and wchar_t support are disabled). The built library is bundled into arrow_bundled_dependencies.
  • Require uriparser 0.9.6 or later for uriparser_SOURCE=SYSTEM. All uriparser APIs used by Arrow are available in 0.9.6, so supported platforms such as Ubuntu 22.04 can use their distribution package.
  • Add cmake_modules/FinduriparserAlt.cmake. It tries uriparser's CMake package configuration first and falls back to pkg-config (liburiparser.pc), because Debian and Ubuntu's liburiparser-dev provides only the pkg-config file.
  • Add uriparser::uriparser to ARROW_STATIC_INSTALL_INTERFACE_LIBS for uriparser_SOURCE=SYSTEM, so that static library users link uriparser.
  • meson: Use the system uriparser 0.9.6 or later if available. Otherwise, build uriparser 1.0.2 via subprojects/uriparser.wrap with the CMake subproject support.
  • Remove cpp/src/arrow/vendored/uriparser/ and its section in LICENSE.txt.
  • Packaging: Install uriparser in our Docker images, conda environment, Brewfile, vcpkg manifests, MSYS2 setup and Linux packages build environments.
  • Packaging: Pass -Duriparser_SOURCE in ci/scripts/cpp_build.sh.
  • Packaging: Add uriparser to the dependency list in docs/source/developers/cpp/building.rst.

NOTICE : The floor is 0.9.6 rather than 1.0.2, so supported platforms such as Ubuntu 22.04 can use their distro package and CI does not have to build uriparser from source.

Are these changes tested?

All existing tests pass.

Are there any user-facing changes?

Now Arrow requires uriparser or builds it . No user facing changes as such because no API changes .

This PR contains a "Critical Fix". It has security fixes that has gone in uriparser.

AI Usage:

  • Used for testing <-> building loop.

Comment thread ci/scripts/msys2_setup.sh Outdated
packages+=("${MINGW_PACKAGE_PREFIX}-gflags")
packages+=("${MINGW_PACKAGE_PREFIX}-grpc")
packages+=("${MINGW_PACKAGE_PREFIX}-gtest")
packages+=("${MINGW_PACKAGE_PREFIX}-uriparser")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we revert this because we already have it in this list?

Comment on lines +42 to +53
if(URIPARSER_ROOT)
find_library(URIPARSER_LIB
NAMES uriparser
PATHS ${URIPARSER_ROOT}
PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES}
NO_DEFAULT_PATH)
find_path(URIPARSER_INCLUDE_DIR
NAMES uriparser/Uri.h
PATHS ${URIPARSER_ROOT}
NO_DEFAULT_PATH
PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})
else()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need this check. We need to check only CMake package and pkg-config package.

NO_DEFAULT_PATH
PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})
else()
find_package(PkgConfig QUIET)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add QUIET only when uriparserAlt_FIND_QUIETLY?

PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})
else()
find_package(PkgConfig QUIET)
pkg_check_modules(URIPARSER_PC liburiparser)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add QUIET when uriparserAlt_FIND_QUIETLY?

Could you add IMPORTED_TARGET?

NO_DEFAULT_PATH
PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES})
set(URIPARSER_VERSION "${URIPARSER_PC_VERSION}")
else()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need this because we want to use CMake target instead of variables.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't need this because we want to use CMake target instead of variables.

Didnt really get this. I have made some changes , please see if they work.

Comment on lines +66 to +71
find_library(URIPARSER_LIB
NAMES uriparser
PATH_SUFFIXES ${ARROW_LIBRARY_PATH_SUFFIXES})
find_path(URIPARSER_INCLUDE_DIR
NAMES uriparser/Uri.h
PATH_SUFFIXES ${ARROW_INCLUDE_PATH_SUFFIXES})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We don't need this fallback.

Comment on lines +3293 to +3299
externalproject_add(uriparser_ep
${EP_COMMON_OPTIONS}
CMAKE_ARGS ${URIPARSER_CMAKE_ARGS}
INSTALL_DIR ${URIPARSER_PREFIX}
URL ${ARROW_URIPARSER_SOURCE_URL}
URL_HASH "SHA256=${ARROW_URIPARSER_BUILD_SHA256_CHECKSUM}"
BUILD_BYPRODUCTS "${URIPARSER_STATIC_LIB}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you use FetchContent instead of ExternalProject?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. Will refactor .

HAVE_ALT
TRUE
REQUIRED_VERSION
"1.0.2"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we require 0.9.6 or later for Ubuntu 22.04?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Specifically for ubuntu ? or do you want me to have the distribution bundled minimum for other distros as well? fedora has 1.0 and likewise.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No. I think that Ubuntu 22.04 ships the oldest uriparser in our supported (CI checked) platforms. If we don't require 1.0.2 or later features, I want to accept older versions in supported platforms such as Ubuntu 22.04:

Suggested change
"1.0.2"
"0.9.6"

If we accept older versions, we can reduce our CI time because we don't need to build bundled uriparser.

@imtherealnaska imtherealnaska Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will update with >= 0.9.6

Comment thread cpp/src/arrow/meson.build

arrow_util_deps = [threads_dep]
uriparser_dep = dependency(
'liburiparser',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this search both of CMake package and pkg-config package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added uriparser as well so we can check for both the names

@pitrou
pitrou removed their request for review September 21, 2026 15:19
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Sep 28, 2026
@kou

kou commented Sep 28, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g r

@github-actions

Copy link
Copy Markdown

Revision: c885134

Submitted crossbow builds: ursacomputing/crossbow @ actions-f0e03a3a56

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

@kou

kou commented Sep 28, 2026

Copy link
Copy Markdown
Member

Could you check CI results and update the PR description?

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@imtherealnaska could you rebase main, several of the CI failures are old and have been fixed on main. I want to assess the state of the PR as we would prefer to merge this before the 26.0.0 release and the feature freeze is expected for tomorrow.

@raulcd

raulcd commented Sep 30, 2026

Copy link
Copy Markdown
Member

The lint failure requires fixing, see the diff on the job failure:

 diff --git a/cpp/cmake_modules/FinduriparserAlt.cmake b/cpp/cmake_modules/FinduriparserAlt.cmake
index 7ef10f1841..0dd810d4fc 100644
--- a/cpp/cmake_modules/FinduriparserAlt.cmake
+++ b/cpp/cmake_modules/FinduriparserAlt.cmake
@@ -53,9 +53,10 @@ if(uriparser_PC_FOUND)
   set(uriparserAlt_VERSION "${uriparser_PC_VERSION}")
 endif()
 
-find_package_handle_standard_args(uriparserAlt
-                                  REQUIRED_VARS uriparser_PC_FOUND
-                                  VERSION_VAR uriparserAlt_VERSION)
+find_package_handle_standard_args(
+  uriparserAlt
+  REQUIRED_VARS uriparser_PC_FOUND
+  VERSION_VAR uriparserAlt_VERSION)

@github-actions github-actions Bot added awaiting changes Awaiting changes awaiting change review Awaiting change review and removed awaiting committer review Awaiting committer review awaiting changes Awaiting changes labels Sep 30, 2026
@imtherealnaska
imtherealnaska force-pushed the gh-51007-uriparser-external branch from 9b47937 to 525b820 Compare September 30, 2026 11:17
@imtherealnaska

Copy link
Copy Markdown
Contributor Author

@imtherealnaska could you rebase main, several of the CI failures are old and have been fixed on main. I want to assess the state of the PR as we would prefer to merge this before the 26.0.0 release and the feature freeze is expected for tomorrow.

I had some more changes for Dockerfiles. I have tested them . MinIO failures should be fixed from rebase.

@imtherealnaska

Copy link
Copy Markdown
Contributor Author

of the 3 jobs failing 2 are MINGW at parquet-reader-test and are fixed by this PR . Conda forge is not sure

@imtherealnaska

Copy link
Copy Markdown
Contributor Author

I think the conda job failure is also because of simdjson 5.0.1 bug , but the env change in this PR forces a fresh solve so it's exposed i think . Should I pin simdjson in ci/conda_env_cpp.txt ? (on a different PR ? )

@raulcd

raulcd commented Sep 30, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g r

@github-actions

Copy link
Copy Markdown

Revision: 525b820

Submitted crossbow builds: ursacomputing/crossbow @ actions-a46fa27440

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

I've updated the description.

@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Oct 1, 2026

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks so much @imtherealnaska ! I am going to merge, I don't expect failures but if there are any failures on any of the extended CI checks we can fix them as part of the release preparation.

@raulcd
raulcd merged commit 1998ed3 into apache:main Oct 1, 2026
63 of 66 checks passed
@raulcd raulcd removed the awaiting merge Awaiting merge label Oct 1, 2026
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.

3 participants