Skip to content

Commit 3864b94

Browse files
committed
fix(client-cpp): Linux Thrift link and macOS Boost 1.84
Linux: keep --whole-archive for Thrift in libiotdb_session.so but add --allow-multiple-definition to avoid libgcc morestack duplicate symbols. macOS: default BOOST_VERSION to 1.84.0 for modern Clang enum checks (other platforms stay on 1.60.0).
1 parent 5ce0b02 commit 3864b94

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

iotdb-client/client-cpp/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ option(IOTDB_OFFLINE "Disable all network access during configure" OFF)
4747

4848
set(IOTDB_DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third-party"
4949
CACHE PATH "Local tarball cache for third-party dependencies (lives under client-cpp/)")
50-
set(BOOST_VERSION "1.84.0"
50+
if(APPLE)
51+
set(_iotdb_default_boost_version "1.84.0")
52+
else()
53+
set(_iotdb_default_boost_version "1.60.0")
54+
endif()
55+
set(BOOST_VERSION "${_iotdb_default_boost_version}"
5156
CACHE STRING "Boost version used when downloading / unpacking (Thrift build only)")
5257
set(THRIFT_VERSION "0.21.0"
5358
CACHE STRING "Apache Thrift version used when downloading / building")
@@ -107,9 +112,13 @@ target_include_directories(iotdb_session
107112
if(APPLE)
108113
target_link_libraries(iotdb_session PRIVATE "-Wl,-force_load,${THRIFT_STATIC_LIB_PATH}")
109114
elseif(UNIX AND NOT MSVC)
110-
# Link only required Thrift objects into the shared library. --whole-archive can
111-
# pull duplicate libgcc morestack symbols on modern GCC (split-stack).
112-
target_link_libraries(iotdb_session PRIVATE ${THRIFT_STATIC_LIB_PATH})
115+
# whole-archive pulls all Thrift objects into libiotdb_session.so; allow-multiple-definition
116+
# avoids libgcc __morestack_* duplicate symbol errors on some GCC/toolchain combos.
117+
target_link_libraries(iotdb_session PRIVATE
118+
-Wl,--whole-archive
119+
${THRIFT_STATIC_LIB_PATH}
120+
-Wl,--no-whole-archive
121+
-Wl,--allow-multiple-definition)
113122
else()
114123
target_link_libraries(iotdb_session PRIVATE iotdb_thrift_static)
115124
endif()

iotdb-client/client-cpp/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ passed directly to `cmake`.
7878
| `BUILD_TESTING` | `OFF` (Maven sets `ON` for verify) | Build Catch2 IT executables. |
7979
| `IOTDB_OFFLINE` | `OFF` | Disallow any network access during configure. |
8080
| `IOTDB_DEPS_DIR` | `<client-cpp>/third-party` | Override the local tarball cache directory. |
81-
| `BOOST_VERSION` | `1.84.0` | Boost version that CMake will look for / download. |
81+
| `BOOST_VERSION` | `1.60.0` (`1.84.0` on macOS) | Boost version that CMake will look for / download. |
8282
| `THRIFT_VERSION` | `0.21.0` | Apache Thrift version to build from source. |
8383
| `BOOST_ROOT` | (unset) | Existing Boost install to reuse, equivalent to `-Dboost.include.dir=...` from the legacy build. |
8484
| `OPENSSL_ROOT_DIR` | (unset) | Existing OpenSSL install when `WITH_SSL=ON`. |
@@ -104,13 +104,13 @@ mvn -P with-cpp -pl iotdb-client/client-cpp -am -DskipTests "-Dboost.include.dir
104104

105105
| Platform | Required files |
106106
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
107-
| `linux/` | `thrift-0.21.0.tar.gz`, `boost_1_84_0.tar.gz`, `m4-1.4.19.tar.gz`, `flex-2.6.4.tar.gz`, `bison-3.8.tar.gz` (and `openssl-3.5.0.tar.gz` when `WITH_SSL=ON`) |
108-
| `mac/` | `thrift-0.21.0.tar.gz`, `boost_1_84_0.tar.gz` (Apple already ships m4/flex/bison; `openssl-3.5.0.tar.gz` optional) |
109-
| `windows/` | `thrift-0.21.0.tar.gz`, `boost_1_84_0.tar.gz` or `boost_1_84_0.zip` (headers only; no `b2` build required) |
107+
| `linux/` | `thrift-0.21.0.tar.gz`, `boost_1_60_0.tar.gz`, `m4-1.4.19.tar.gz`, `flex-2.6.4.tar.gz`, `bison-3.8.tar.gz` (and `openssl-3.5.0.tar.gz` when `WITH_SSL=ON`) |
108+
| `mac/` | `thrift-0.21.0.tar.gz`, `boost_1_84_0.tar.gz` (newer Boost for Xcode/Clang; Apple ships m4/flex/bison; `openssl-3.5.0.tar.gz` optional) |
109+
| `windows/` | `thrift-0.21.0.tar.gz`, `boost_1_60_0.tar.gz` (Boost headers only - no `b2` build required for `iotdb_session`) |
110110

111111
Reference URLs (the configure step uses the same):
112112
- Apache Thrift 0.21.0: <https://archive.apache.org/dist/thrift/0.21.0/thrift-0.21.0.tar.gz>
113-
- Boost 1.84.0: <https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.gz>
113+
- Boost 1.60.0: <https://archives.boost.io/release/1.60.0/source/boost_1_60_0.tar.gz>
114114
- GNU m4 1.4.19: <https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz>
115115
- GNU flex 2.6.4: <https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz>
116116
- GNU bison 3.8: <https://ftp.gnu.org/gnu/bison/bison-3.8.tar.gz>
@@ -160,7 +160,7 @@ Prerequisites:
160160

161161
1. **Boost.** Download and extract
162162
<https://archives.boost.io/release/1.88.0/source/boost_1_88_0.zip>
163-
(1.74+ recommended for modern Clang; 1.84.0 is the default download). `iotdb_session` only needs Boost
163+
(any 1.60+ release will work). `iotdb_session` only needs Boost
164164
headers, so running `bootstrap.bat` / `b2` is optional. Pass the
165165
location with either `-Dboost.include.dir="C:\boost_1_88_0"` (Maven)
166166
or `-DBOOST_ROOT="C:\boost_1_88_0"` (raw CMake).

0 commit comments

Comments
 (0)