Skip to content

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

Open
imtherealnaska wants to merge 6 commits into
apache:mainfrom
imtherealnaska:gh-51007-uriparser-external
Open

imtherealnaska wants to merge 6 commits into
apache:mainfrom
imtherealnaska:gh-51007-uriparser-external

Conversation

@imtherealnaska

@imtherealnaska imtherealnaska commented Sep 8, 2026 •

Copy link
Copy Markdown

Rationale for this change

Updating the uriparser version so as to include security fixes. Rather than refreshing vendored copy , this makes uriparser and external dependency.

What changes are included in this PR?

  • uriparser added to ARROW_THIRDPARTY_DEPENDENCIES, with a
    build_uriparser() using FetchContent pinned to 1.0.2 (docs, tests, tools
    and wchar_t support disabled; static; URI_STATIC_BUILD on the
    interface; registered in ARROW_BUNDLED_STATIC_LIBS).
  • REQUIRED_VERSION "0.9.6" for SYSTEM builds, so supported platforms can
    use the uriparser their distro already ships instead of building from
    source. The bundled build still uses 1.0.2.
  • New cmake_modules/FinduriparserAlt.cmake. Upstream ships a CMake package
    config, but Debian/Ubuntu's liburiparser-dev installs only
    liburiparser.pc, so the module tries find_package(CONFIG) first, then
    pkg-config, then a plain library search.
  • ARROW_STATIC_INSTALL_INTERFACE_LIBS gains uriparser::uriparser for
    SYSTEM builds, so static consumers link correctly.
  • meson: new subprojects/uriparser.wrap (method = cmake, same tarball
    and checksum as the CMake pin) plus a cmake.subproject fallback, since
    meson has no BUNDLED equivalent.
  • cpp/src/arrow/vendored/uriparser/ (28 files) and its LICENSE.txt
    section removed; util/uri.cc now includes <uriparser/Uri.h>.
  • Packaging: 6 dockerfiles, conda, Brewfile, both vcpkg manifests, MSYS2
    PKGBUILD and msys2_setup.sh, r_windows_build.sh, the
    -Duriparser_SOURCE passthrough in cpp_build.sh, and the dependency
    list in 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.

Verified on Ubuntu 22.04:

  • With 0.9.6 (Distro bundled)present, it finds that the version is not suitable and falls back to building 1.0.2
  • Explicit -Duriparser_SOURCE=SYSTEM with 0.9.6 fails .
  • Also builds and passes 13/13 on macOS against Homebrew

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
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
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
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
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
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
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
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
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

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