-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-5370: [C++] Use system uriparser if available #4525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I tried this on Debian strecth. Debian stretch ships uriparser 0.8.4 https://packages.debian.org/search?suite=default§ion=all&arch=any&searchon=names&keywords=uriparser We use uriparser 0.9.0 API, I need the following patch to confirm this change: diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 0841767e..ee0e24d4 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -56,6 +56,7 @@ set(ARROW_THIRDPARTY_DEPENDENCIES
RapidJSON
Snappy
Thrift
+ uriparser
ZLIB
ZSTD)
@@ -597,7 +598,7 @@ if(ARROW_WITH_URIPARSER)
endmacro()
if("${uriparser_SOURCE}" STREQUAL "AUTO")
- pkg_check_modules(URIPARSER_PC liburiparser)
+ pkg_check_modules(URIPARSER_PC "liburiparser >= 0.9.0")
if(URIPARSER_PC_FOUND)
set(URIPARSER_INCLUDE_DIR "${URIPARSER_PC_INCLUDEDIR}")
list(APPEND URIPARSER_PC_LIBRARY_DIRS "${URIPARSER_PC_LIBDIR}")+1 with this patch. |
|
OK, thanks, I'll incorporate this change. |
|
@kou done. I'll merge once the build look ok |
|
Ah, sorry. Please wait. uriparser package in MSYS2 provides files for CMake: ls /mingw64/lib/cmake/uriparser-0.9.2/
uriparser-release.cmake
uriparser.cmakeSo the following logic is better like we did for other packages: find_package(uriparser)
if(NOT uriparser_FOUND)
pkg_check_modules(...)
...
endif()Note that uriparser package in Debian doesn't provide files for CMake yet. |
|
Wow! We already have |
|
I didn't try yet but something the following will be better. ( diff --git a/cpp/cmake_modules/Finduriparser.cmake b/cpp/cmake_modules/FinduriparserAlt.cmake
similarity index 85%
rename from cpp/cmake_modules/Finduriparser.cmake
rename to cpp/cmake_modules/FinduriparserAlt.cmake
index a24cca47..95a9a7fe 100644
--- a/cpp/cmake_modules/Finduriparser.cmake
+++ b/cpp/cmake_modules/FinduriparserAlt.cmake
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-pkg_check_modules(uriparser_PC liburiparser)
+pkg_check_modules(uriparser_PC "liburiparser >= 0.9.0")
if(uriparser_PC_FOUND)
set(uriparser_INCLUDE_DIR "${uriparser_PC_INCLUDEDIR}")
@@ -43,11 +43,13 @@ else()
find_path(uriparser_INCLUDE_DIR NAMES uriparser/Uri.h PATH_SUFFIXES ${INCLUDE_PATH_SUFFIXES})
endif()
-find_package_handle_standard_args(uriparser REQUIRED_VARS uriparser_LIB uriparser_INCLUDE_DIR)
+find_package_handle_standard_args(uriparserAlt REQUIRED_VARS uriparser_LIB uriparser_INCLUDE_DIR)
-if(uriparser_FOUND)
+if(uriparserAlt_FOUND)
add_library(uriparser::uriparser UNKNOWN IMPORTED)
set_target_properties(uriparser::uriparser
PROPERTIES IMPORTED_LOCATION "${uriparser_LIB}"
- INTERFACE_INCLUDE_DIRECTORIES "${uriparser_INCLUDE_DIR}")
+ INTERFACE_INCLUDE_DIRECTORIES "${uriparser_INCLUDE_DIR}"
+ # URI_STATIC_BUILD required on Windows
+ INTERFACE_COMPILE_DEFINITIONS "URI_NO_UNICODE")
endif()
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 1fe04d79..8ad14b3c 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -590,9 +590,23 @@ macro(build_uriparser)
endmacro()
if(ARROW_WITH_URIPARSER)
- # Unless the user overrides uriparser_SOURCE, build uriparser ourselves
- if("${uriparser_SOURCE}" STREQUAL "")
- set(uriparser_SOURCE "BUNDLED")
+ if(uriparser_SOURCE STREQUAL "AUTO")
+ find_package(uriparser QUIET)
+ if(NOT uriparser_FOUND)
+ # Ubuntu doesn't package the CMake config
+ find_package(uriparserAlt)
+ endif()
+ if(NOT uriparser_FOUND AND NOT uriparserAlt_FOUND)
+ build_uriparser()
+ endif()
+ elseif(uriparser_SOURCE STREQUAL "BUNDLED")
+ build_uriparser()
+ elseif(uriparser_SOURCE STREQUAL "SYSTEM")
+ find_package(uriparser QUIET)
+ if(NOT uriparser_FOUND)
+ # Ubuntu doesn't package the CMake config
+ find_package(uriparserAlt REQUIRED)
+ endif()
endif()
resolve_dependency(uriparser) |
|
Oh okay. Do you want to take over this PR and push the commits here? I didn't realize we had the CMake file |
|
OK. I take over this. |
Codecov Report
@@ Coverage Diff @@
## master #4525 +/- ##
==========================================
+ Coverage 88.16% 88.58% +0.41%
==========================================
Files 852 860 +8
Lines 106398 108022 +1624
Branches 1253 1253
==========================================
+ Hits 93806 95691 +1885
+ Misses 12347 12052 -295
- Partials 245 279 +34
Continue to review full report at Codecov.
|
It works on local but doesn't work on AppVeyor.
|
GLib CI failure on macOS is unrelated. |
|
This patch is breaking my local builds (Ubuntu 19.04) |
|
The issue is that I'm using |
|
OK. You can use |
This change will use uriparser >= 0.9.0 (found via pkgconfig) if it is available in the system toolchain, otherwise it will build from source. Using the SYSTEM method it will not fail for now if the version is not new enough given that the version we require is too new for many Linux distributions. We can look into supporting older uriparser some other time