Skip to content
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

[clickhouse-cpp] Update to 2.2.1 #27250

Merged
merged 8 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions ports/clickhouse-cpp/fix-deps-and-build-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31cd8a5..d8ee404 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,11 +29,12 @@ PROJECT (CLICKHOUSE-CLIENT)
INCLUDE_DIRECTORIES (.)
INCLUDE_DIRECTORIES (contrib)

+ find_package(absl CONFIG REQUIRED)
+ find_package(cityhash CONFIG REQUIRED)
+ find_package(lz4 CONFIG REQUIRED)
+
SUBDIRS (
clickhouse
- contrib/absl
- contrib/cityhash
- contrib/lz4
)

IF (BUILD_BENCHMARK)
diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt
index d96ff88..ad1cb0d 100644
--- a/clickhouse/CMakeLists.txt
+++ b/clickhouse/CMakeLists.txt
@@ -36,19 +36,21 @@ IF (WITH_OPENSSL)
LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp)
ENDIF ()

-ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src})
Copy link
Member

Choose a reason for hiding this comment

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

I was going to push a change that minimized this patch: the indenting of this to be inside the BUILD_SHARED_LIBS was unnecessary. However, the TARGET_LINK_LIBRARIES are also different, so it made sense to leave this alone.

Thanks for your contribution to vcpkg!

-SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
-TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
- absl-lib
- cityhash-lib
- lz4-lib
-)
-
-ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
-TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static
- absl-lib
- cityhash-lib
- lz4-lib
+set(LIB_NAME "")
+
+if(BUILD_SHARED_LIBS)
+ ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src})
+ SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
+ set(LIB_NAME "clickhouse-cpp-lib")
+else()
+ ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
+ set(LIB_NAME "clickhouse-cpp-lib-static")
+endif()
+
+TARGET_LINK_LIBRARIES ("${LIB_NAME}"
+ absl::base absl::numeric
+ cityhash
+ lz4::lz4
)

IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@@ -68,12 +70,11 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
# /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line
# FIXME: that workaround breaks clang build on mingw
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s)
+ TARGET_LINK_LIBRARIES (${LIB_NAME} gcc_s)
ENDIF ()
ENDIF ()

-INSTALL (TARGETS clickhouse-cpp-lib clickhouse-cpp-lib-static
+INSTALL (TARGETS ${LIB_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
@@ -123,11 +124,9 @@ INSTALL(FILES types/type_parser.h DESTINATION include/clickhouse/types/)
INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/)

IF (WITH_OPENSSL)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static OpenSSL::SSL)
+ TARGET_LINK_LIBRARIES (${LIB_NAME} OpenSSL::SSL)
ENDIF ()

IF (WIN32 OR MINGW)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib wsock32 ws2_32)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static wsock32 ws2_32)
+ TARGET_LINK_LIBRARIES (${LIB_NAME} wsock32 ws2_32)
ENDIF ()
15 changes: 0 additions & 15 deletions ports/clickhouse-cpp/fix-error-C4996.patch

This file was deleted.

13 changes: 0 additions & 13 deletions ports/clickhouse-cpp/fix-error-c2668.patch

This file was deleted.

13 changes: 13 additions & 0 deletions ports/clickhouse-cpp/fix-uwp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/clickhouse/base/socket.cpp b/clickhouse/base/socket.cpp
index c6dc920..43bbd02 100644
--- a/clickhouse/base/socket.cpp
+++ b/clickhouse/base/socket.cpp
@@ -27,7 +27,7 @@ char const* windowsErrorCategory::name() const noexcept {

std::string windowsErrorCategory::message(int c) const {
char error[UINT8_MAX];
- auto len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast<DWORD>(c), 0, error, sizeof(error), nullptr);
+ auto len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast<DWORD>(c), 0, error, sizeof(error), nullptr);
if (len == 0) {
return "unknown";
}
24 changes: 16 additions & 8 deletions ports/clickhouse-cpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
Comment on lines +1 to +3
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Abseil does not dll_export class absl::int128 __cdecl absl::operator/(class absl::int128,class absl::int128):

LINK Pass 1: command "C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\link.exe clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\base\compressed.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\base\input.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\base\output.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\base\platform.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\base\socket.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\base\wire_format.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\array.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\column.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\date.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\decimal.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\enum.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\factory.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\ip4.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\ip6.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\lowcardinality.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\nullable.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\numeric.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\string.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\tuple.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\uuid.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\columns\itemview.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\types\type_parser.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\types\types.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\block.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\client.cpp.obj clickhouse\CMakeFiles\clickhouse-cpp-lib.dir\query.cpp.obj /out:clickhouse\clickhouse-cpp-lib.dll /implib:clickhouse\clickhouse-cpp-lib.lib /pdb:clickhouse\clickhouse-cpp-lib.pdb /dll /version:0.0 /machine:x64 /nologo /debug /INCREMENTAL D:\installed\x64-windows\debug\lib\cityhash.lib D:\installed\x64-windows\debug\lib\lz4d.lib wsock32.lib ws2_32.lib D:\installed\x64-windows\debug\lib\abseil_dll.lib -ignore:4221 kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:clickhouse\CMakeFiles\clickhouse-cpp-lib.dir/intermediate.manifest clickhouse\CMakeFiles\clickhouse-cpp-lib.dir/manifest.res" failed (exit code 1120) with the following output:
decimal.cpp.obj : error LNK2019: unresolved external symbol "class absl::int128 __cdecl absl::operator/(class absl::int128,class absl::int128)" (??Kabsl@@YA?AVint128@0@V10@0@Z) referenced in function "bool __cdecl `anonymous namespace'::mulOverflow<int>(class absl::int128 const &,int const &,class absl::int128 *)" (??$mulOverflow@H@?A0xd80ac12a@@YA_NAEBVint128@absl@@AEBHPEAV12@@Z)
clickhouse\clickhouse-cpp-lib.dll : fatal error LNK1120: 1 unresolved externals


vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ClickHouse/clickhouse-cpp
REF 1415b5936a2ac2f084850b09057e05fb5798b2f1 #v1.5.0
SHA512 222b31b16744af64f0a874ec956568adcecb553e43f8d4a2d16c00d55b31015d917a4dc7bb30d5430a894459b1be5e05b292e2d0918bf6f5609046a60539f80f
REF v2.2.1
SHA512 cf9f14e6bdbf2b739a25004c8f30ef8057cf4afa618c91fc2672059869cbbbdafb72f3027863b3f731f7f2cc239d5690e5e87301bf7930b79fe71d7a4ae3f833
HEAD_REF master
PATCHES
fix-error-c2668.patch
fix-error-C4996.patch #fix x64-uwp error:std::uncaught_exception() is deprecated in C++17
PATCHES
fix-deps-and-build-type.patch
fix-uwp.patch
Copy link
Contributor Author

@Thomas1664 Thomas1664 Oct 16, 2022

Choose a reason for hiding this comment

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

fix-uwp.patch fixes

D:\buildtrees\clickhouse-cpp\src\v2.2.1-26f006ec81.clean\clickhouse\base\socket.cpp(30): error C2664: 'DWORD FormatMessageW(DWORD,LPCVOID,DWORD,DWORD,LPWSTR,DWORD,va_list *)': cannot convert argument 5 from 'char [255]' to 'LPWSTR'
D:\buildtrees\clickhouse-cpp\src\v2.2.1-26f006ec81.clean\clickhouse\base\socket.cpp(30): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winbase.h(2476): note: see declaration of 'FormatMessageW'

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this error fixed by upstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also submit an issue or PR on upstream to fix this issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
openssl WITH_OPENSSL
)

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
)

vcpkg_cmake_install()
Expand All @@ -21,4 +29,4 @@ vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
18 changes: 12 additions & 6 deletions ports/clickhouse-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"name": "clickhouse-cpp",
"version": "1.5.0",
"version": "2.2.1",
"description": "C++ client for Yandex ClickHouse",
"homepage": "https://github.com/ClickHouse/clickhouse-cpp",
"license": "Apache-2.0",
"dependencies": [
"abseil",
"cityhash",
"lz4",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Port doesn't provide CMake config files

"host": true
}
]
],
"features": {
"openssl": {
"description": "Enable OpenSSL support",
"dependencies": [
"openssl"
]
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@
"port-version": 0
},
"clickhouse-cpp": {
"baseline": "1.5.0",
"baseline": "2.2.1",
"port-version": 0
},
"clipboardxx": {
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/clickhouse-cpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "10588d8080311cbc920f1805d3dd51e5b9c27ebe",
"version": "2.2.1",
"port-version": 0
},
{
"git-tree": "14c4074d1a59fbe8b01ebe934698519c63885b8b",
"version": "1.5.0",
Expand Down