From 671ecf955a9e5861517c698acbd13bcabbdb23e0 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Thu, 30 Apr 2026 13:44:58 +0800 Subject: [PATCH 01/10] fix ci --- .github/workflows/wheels.yml | 4 ++-- python/pyproject.toml | 4 +--- python/requirements.txt | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 84af04f42..79bb3150d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -108,8 +108,8 @@ jobs: CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*" CIBW_SKIP: "pp* *-musllinux*" - CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" - CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28" + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" + CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014" MACOSX_DEPLOYMENT_TARGET: "12.0" diff --git a/python/pyproject.toml b/python/pyproject.toml index 3a2789853..624d26a96 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -39,9 +39,7 @@ dependencies = [ "numpy>=1.26.4,<3", "pandas>=2.0,<2.3; python_full_version < '3.14.0'", "pandas>=2.3.3; python_full_version >= '3.14.0'", - "pyarrow>=16.0,<18; python_version<'3.10'", - "pyarrow>=18.0,<20; python_version>='3.10' and python_version<'3.14'", - "pyarrow>=22.0,<24; python_version>='3.14'" + "pyarrow>=21.0.0,<24" ] [project.urls] diff --git a/python/requirements.txt b/python/requirements.txt index 057ab3518..38a2a3f71 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -25,4 +25,4 @@ pandas==2.2.2; python_full_version < "3.14.0" pandas>=2.3.3; python_full_version >= "3.14.0" setuptools==78.1.1 wheel==0.46.2 -pyarrow>=8.0.0 +pyarrow>=21.0.0,<24 From 34a3235702dd230a88807c330e89455caef42f1e Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Thu, 30 Apr 2026 15:36:21 +0800 Subject: [PATCH 02/10] update linux wheel images for py314 compatibility Build Python 3.9-3.13 wheels on manylinux2014 and move Python 3.14 to a separate manylinux_2_28 job. --- .github/workflows/wheels.yml | 52 ++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 79bb3150d..ab24c9f5d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -99,13 +99,13 @@ jobs: -Dcmake.args="-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0" otool -l cpp/target/build/lib/libtsfile*.dylib | grep -A2 LC_VERSION_MIN_MACOSX || true - - name: Build wheels via cibuildwheel + - name: Build wheels via cibuildwheel (Linux cp39-cp313) if: matrix.platform != 'macos' env: CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} # CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }} - CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*" + CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" CIBW_SKIP: "pp* *-musllinux*" CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" @@ -144,6 +144,54 @@ jobs: python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" CIBW_BUILD_VERBOSITY: "1" run: cibuildwheel --output-dir wheelhouse python + + - name: Build wheels via cibuildwheel (Linux cp314) + if: matrix.platform != 'macos' + env: + CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} +# CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }} + + CIBW_BUILD: "cp314-*" + CIBW_SKIP: "pp* *-musllinux*" + + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" + CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28" + + MACOSX_DEPLOYMENT_TARGET: "12.0" + + CIBW_BEFORE_ALL_LINUX: | + set -euxo pipefail + if command -v yum >/dev/null 2>&1; then + yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel + elif command -v dnf >/dev/null 2>&1; then + dnf install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel + else + echo "No supported package manager found (expected yum or dnf)." ; exit 1 + fi + ARCH="$(uname -m)" + mkdir -p /opt/java + if [ "$ARCH" = "x86_64" ]; then + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" + else + # aarch64 + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" + fi + curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" + tar -xzf /tmp/jdk17.tar.gz -C /opt/java + export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) + export PATH="$JAVA_HOME/bin:$PATH" + java -version + + chmod +x mvnw || true + ./mvnw -Pwith-cpp clean package \ + -DskipTests -Dbuild.test=OFF \ + -Dspotless.check.skip=true -Dspotless.apply.skip=true + test -d cpp/target/build/lib && test -d cpp/target/build/include + + CIBW_TEST_COMMAND: > + python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" + CIBW_BUILD_VERBOSITY: "1" + run: cibuildwheel --output-dir wheelhouse python - name: Build wheels via cibuildwheel (macOS) if: matrix.platform == 'macos' From 43d13cf23d0236f56ac2625c70c45c5152c04a54 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Thu, 30 Apr 2026 15:38:23 +0800 Subject: [PATCH 03/10] revert python pyarrow dependency changes Restore pyarrow version constraints in Python packaging files without changing CI workflow updates. --- python/pyproject.toml | 4 +++- python/requirements.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 624d26a96..3a2789853 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -39,7 +39,9 @@ dependencies = [ "numpy>=1.26.4,<3", "pandas>=2.0,<2.3; python_full_version < '3.14.0'", "pandas>=2.3.3; python_full_version >= '3.14.0'", - "pyarrow>=21.0.0,<24" + "pyarrow>=16.0,<18; python_version<'3.10'", + "pyarrow>=18.0,<20; python_version>='3.10' and python_version<'3.14'", + "pyarrow>=22.0,<24; python_version>='3.14'" ] [project.urls] diff --git a/python/requirements.txt b/python/requirements.txt index 38a2a3f71..057ab3518 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -25,4 +25,4 @@ pandas==2.2.2; python_full_version < "3.14.0" pandas>=2.3.3; python_full_version >= "3.14.0" setuptools==78.1.1 wheel==0.46.2 -pyarrow>=21.0.0,<24 +pyarrow>=8.0.0 From 854b62362934a4217ea8ef7cc106eb997d3bd3b9 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 09:51:16 +0800 Subject: [PATCH 04/10] Address wheels workflow PR review feedback for Linux cibuildwheel. Use package-manager OpenJDK on manylinux_2_28, deduplicate shared Linux env via YAML anchor, and make Linux step conditions explicit. --- .github/workflows/wheels.yml | 127 +++++++++++++---------------------- 1 file changed, 46 insertions(+), 81 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ab24c9f5d..45226b249 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -6,6 +6,47 @@ on: - "rc/**" workflow_dispatch: +x-cibw-linux-shared: &cibw-linux-shared + CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} + CIBW_SKIP: "pp* *-musllinux*" + MACOSX_DEPLOYMENT_TARGET: "12.0" + CIBW_BEFORE_ALL_LINUX: | + set -euxo pipefail + if command -v yum >/dev/null 2>&1; then + yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel + elif command -v dnf >/dev/null 2>&1; then + dnf install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel + else + echo "No supported package manager found (expected yum or dnf)." ; exit 1 + fi + if (command -v dnf >/dev/null 2>&1 && dnf install -y java-17-openjdk-devel) \ + || (command -v yum >/dev/null 2>&1 && yum install -y java-17-openjdk-devel); then + export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")" + else + ARCH="$(uname -m)" + mkdir -p /opt/java + if [ "$ARCH" = "x86_64" ]; then + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" + else + # aarch64 + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" + fi + curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" + tar -xzf /tmp/jdk17.tar.gz -C /opt/java + export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) + fi + export PATH="$JAVA_HOME/bin:$PATH" + java -version + + chmod +x mvnw || true + ./mvnw -Pwith-cpp clean package \ + -DskipTests -Dbuild.test=OFF \ + -Dspotless.check.skip=true -Dspotless.apply.skip=true + test -d cpp/target/build/lib && test -d cpp/target/build/include + CIBW_TEST_COMMAND: > + python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" + CIBW_BUILD_VERBOSITY: "1" + jobs: build: name: Build wheels on ${{ matrix.name }} @@ -100,97 +141,21 @@ jobs: otool -l cpp/target/build/lib/libtsfile*.dylib | grep -A2 LC_VERSION_MIN_MACOSX || true - name: Build wheels via cibuildwheel (Linux cp39-cp313) - if: matrix.platform != 'macos' - env: - CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} -# CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }} - + if: matrix.platform == 'linux' + env: + <<: *cibw-linux-shared CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" - CIBW_SKIP: "pp* *-musllinux*" - CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014" - - MACOSX_DEPLOYMENT_TARGET: "12.0" - - CIBW_BEFORE_ALL_LINUX: | - set -euxo pipefail - if command -v yum >/dev/null 2>&1; then - yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel - else - echo "Not a yum-based image?" ; exit 1 - fi - ARCH="$(uname -m)" - mkdir -p /opt/java - if [ "$ARCH" = "x86_64" ]; then - JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" - else - # aarch64 - JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" - fi - curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" - tar -xzf /tmp/jdk17.tar.gz -C /opt/java - export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) - export PATH="$JAVA_HOME/bin:$PATH" - java -version - - chmod +x mvnw || true - ./mvnw -Pwith-cpp clean package \ - -DskipTests -Dbuild.test=OFF \ - -Dspotless.check.skip=true -Dspotless.apply.skip=true - test -d cpp/target/build/lib && test -d cpp/target/build/include - - CIBW_TEST_COMMAND: > - python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" - CIBW_BUILD_VERBOSITY: "1" run: cibuildwheel --output-dir wheelhouse python - name: Build wheels via cibuildwheel (Linux cp314) - if: matrix.platform != 'macos' + if: matrix.platform == 'linux' env: - CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} -# CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }} - + <<: *cibw-linux-shared CIBW_BUILD: "cp314-*" - CIBW_SKIP: "pp* *-musllinux*" - CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28" - - MACOSX_DEPLOYMENT_TARGET: "12.0" - - CIBW_BEFORE_ALL_LINUX: | - set -euxo pipefail - if command -v yum >/dev/null 2>&1; then - yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel - elif command -v dnf >/dev/null 2>&1; then - dnf install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel - else - echo "No supported package manager found (expected yum or dnf)." ; exit 1 - fi - ARCH="$(uname -m)" - mkdir -p /opt/java - if [ "$ARCH" = "x86_64" ]; then - JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" - else - # aarch64 - JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" - fi - curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" - tar -xzf /tmp/jdk17.tar.gz -C /opt/java - export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) - export PATH="$JAVA_HOME/bin:$PATH" - java -version - - chmod +x mvnw || true - ./mvnw -Pwith-cpp clean package \ - -DskipTests -Dbuild.test=OFF \ - -Dspotless.check.skip=true -Dspotless.apply.skip=true - test -d cpp/target/build/lib && test -d cpp/target/build/include - - CIBW_TEST_COMMAND: > - python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" - CIBW_BUILD_VERBOSITY: "1" run: cibuildwheel --output-dir wheelhouse python - name: Build wheels via cibuildwheel (macOS) From 5088ecd2320ddce1eea226a664b2ae06263906e3 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 10:28:09 +0800 Subject: [PATCH 05/10] Fix wheels workflow parse error by replacing YAML anchors with a shared script. GitHub Actions rejects top-level YAML anchors; move CIBW_BEFORE_ALL_LINUX logic into .github/scripts/cibw-before-all-linux.sh. --- .github/scripts/cibw-before-all-linux.sh | 52 +++++++++++++++++++++ .github/workflows/wheels.yml | 57 ++++++------------------ 2 files changed, 66 insertions(+), 43 deletions(-) create mode 100755 .github/scripts/cibw-before-all-linux.sh diff --git a/.github/scripts/cibw-before-all-linux.sh b/.github/scripts/cibw-before-all-linux.sh new file mode 100755 index 000000000..b79685770 --- /dev/null +++ b/.github/scripts/cibw-before-all-linux.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -euxo pipefail +if command -v yum >/dev/null 2>&1; then + yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel +elif command -v dnf >/dev/null 2>&1; then + dnf install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel +else + echo "No supported package manager found (expected yum or dnf)." ; exit 1 +fi +if (command -v dnf >/dev/null 2>&1 && dnf install -y java-17-openjdk-devel) \ + || (command -v yum >/dev/null 2>&1 && yum install -y java-17-openjdk-devel); then + export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")" +else + ARCH="$(uname -m)" + mkdir -p /opt/java + if [ "$ARCH" = "x86_64" ]; then + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" + else + # aarch64 + JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" + fi + curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" + tar -xzf /tmp/jdk17.tar.gz -C /opt/java + export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) +fi +export PATH="$JAVA_HOME/bin:$PATH" +java -version + +chmod +x mvnw || true +./mvnw -Pwith-cpp clean package \ + -DskipTests -Dbuild.test=OFF \ + -Dspotless.check.skip=true -Dspotless.apply.skip=true +test -d cpp/target/build/lib && test -d cpp/target/build/include diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 45226b249..f752372aa 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -6,47 +6,6 @@ on: - "rc/**" workflow_dispatch: -x-cibw-linux-shared: &cibw-linux-shared - CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} - CIBW_SKIP: "pp* *-musllinux*" - MACOSX_DEPLOYMENT_TARGET: "12.0" - CIBW_BEFORE_ALL_LINUX: | - set -euxo pipefail - if command -v yum >/dev/null 2>&1; then - yum install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel - elif command -v dnf >/dev/null 2>&1; then - dnf install -y wget tar gzip pkgconfig libuuid-devel libblkid-devel - else - echo "No supported package manager found (expected yum or dnf)." ; exit 1 - fi - if (command -v dnf >/dev/null 2>&1 && dnf install -y java-17-openjdk-devel) \ - || (command -v yum >/dev/null 2>&1 && yum install -y java-17-openjdk-devel); then - export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")" - else - ARCH="$(uname -m)" - mkdir -p /opt/java - if [ "$ARCH" = "x86_64" ]; then - JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz" - else - # aarch64 - JDK_URL="https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-aarch64_bin.tar.gz" - fi - curl -L -o /tmp/jdk17.tar.gz "$JDK_URL" - tar -xzf /tmp/jdk17.tar.gz -C /opt/java - export JAVA_HOME=$(echo /opt/java/jdk-17.0.12*) - fi - export PATH="$JAVA_HOME/bin:$PATH" - java -version - - chmod +x mvnw || true - ./mvnw -Pwith-cpp clean package \ - -DskipTests -Dbuild.test=OFF \ - -Dspotless.check.skip=true -Dspotless.apply.skip=true - test -d cpp/target/build/lib && test -d cpp/target/build/include - CIBW_TEST_COMMAND: > - python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" - CIBW_BUILD_VERBOSITY: "1" - jobs: build: name: Build wheels on ${{ matrix.name }} @@ -143,19 +102,31 @@ jobs: - name: Build wheels via cibuildwheel (Linux cp39-cp313) if: matrix.platform == 'linux' env: - <<: *cibw-linux-shared + CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} + CIBW_SKIP: "pp* *-musllinux*" + MACOSX_DEPLOYMENT_TARGET: "12.0" CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux2014" + CIBW_BEFORE_ALL_LINUX: bash .github/scripts/cibw-before-all-linux.sh + CIBW_TEST_COMMAND: > + python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" + CIBW_BUILD_VERBOSITY: "1" run: cibuildwheel --output-dir wheelhouse python - name: Build wheels via cibuildwheel (Linux cp314) if: matrix.platform == 'linux' env: - <<: *cibw-linux-shared + CIBW_ARCHS_LINUX: ${{ matrix.cibw_archs_linux }} + CIBW_SKIP: "pp* *-musllinux*" + MACOSX_DEPLOYMENT_TARGET: "12.0" CIBW_BUILD: "cp314-*" CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28" CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28" + CIBW_BEFORE_ALL_LINUX: bash .github/scripts/cibw-before-all-linux.sh + CIBW_TEST_COMMAND: > + python -c "import tsfile, tsfile.tsfile_reader as r; print('import-ok:')" + CIBW_BUILD_VERBOSITY: "1" run: cibuildwheel --output-dir wheelhouse python - name: Build wheels via cibuildwheel (macOS) From c0714cb0f2b3d632fadf2f004ce38a77a70d553a Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 11:02:56 +0800 Subject: [PATCH 06/10] Fix MinGW build failure from always_inline in filter headers. Disable FORCE_INLINE always_inline attribute on MinGW where recursive filter inlining hits max-inline-insns-single limits. --- cpp/src/utils/util_define.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/src/utils/util_define.h b/cpp/src/utils/util_define.h index 2796dfb0f..f97457d02 100644 --- a/cpp/src/utils/util_define.h +++ b/cpp/src/utils/util_define.h @@ -34,11 +34,11 @@ #endif /* ======== inline ======== */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__MINGW32__) #define FORCE_INLINE inline __attribute__((always_inline)) #else #define FORCE_INLINE inline -#endif // __GNUC__ +#endif #ifdef BUILD_FOR_SMALL_BINARY #define INLINE FORCE_INLINE From 084bb0aaf40dbaafddd775e5477f8ed44ad99052 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 15:53:26 +0800 Subject: [PATCH 07/10] Fix Windows wheel CI DLL mismatch across split build jobs. Bundle MinGW runtime DLLs with the C++ artifact and preload them before libtsfile.dll so pytest no longer fails with WinError 127 on Windows runners. --- .github/workflows/wheels.yml | 9 +++++++-- python/setup.py | 7 +++++++ python/tsfile/__init__.py | 10 ++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index f752372aa..ba8ba27d1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -190,6 +190,11 @@ jobs: -Dspotless.check.skip=true -Dspotless.apply.skip=true test -d cpp/target/build/lib test -d cpp/target/build/include + # Bundle MinGW runtime DLLs built with libtsfile.dll so wheel jobs + # load matching libstdc++/libgcc instead of a different MSYS2 install. + for dll in libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll; do + cp "/mingw64/bin/$dll" cpp/target/build/lib/ + done - name: Upload C++ build output uses: actions/upload-artifact@v7 @@ -229,7 +234,7 @@ jobs: uses: msys2/setup-msys2@v2 with: msystem: MINGW64 - update: false + update: true install: >- mingw-w64-x86_64-gcc mingw-w64-x86_64-make @@ -247,7 +252,7 @@ jobs: set -euxo pipefail export JAVA_HOME="$(cygpath "$JAVA_HOME")" export PYTHON_HOME="$(cygpath "$pythonLocation")" - export PATH="$PYTHON_HOME:$PYTHON_HOME/Scripts:$JAVA_HOME/bin:$PATH" + export PATH="/mingw64/bin:$PYTHON_HOME:$PYTHON_HOME/Scripts:$JAVA_HOME/bin:$PATH" # Build wheel via Maven (no clean — keep C++ artifacts from previous job) chmod +x mvnw || true diff --git a/python/setup.py b/python/setup.py index 63d99de03..7e3371b63 100644 --- a/python/setup.py +++ b/python/setup.py @@ -86,7 +86,14 @@ # Copy MinGW runtime DLLs next to libtsfile.dll so Python can find them. # Python 3.8+ does not search PATH for DLLs; they must be in the same # directory as the .pyd extensions (registered via os.add_dll_directory). + # Prefer DLLs bundled with the C++ build output to avoid version mismatch + # when libtsfile.dll is produced on a different CI runner. for _mingw_dll in ("libstdc++-6.dll", "libgcc_s_seh-1.dll", "libwinpthread-1.dll"): + _bundled = CPP_LIB / _mingw_dll + if _bundled.is_file(): + shutil.copy2(_bundled, PKG / _mingw_dll) + print(f"setup.py: copied {_mingw_dll} from {_bundled}") + continue for _dir in os.environ.get("PATH", "").split(os.pathsep): _src = Path(_dir) / _mingw_dll if _src.is_file(): diff --git a/python/tsfile/__init__.py b/python/tsfile/__init__.py index 32021d52e..0113d0362 100644 --- a/python/tsfile/__init__.py +++ b/python/tsfile/__init__.py @@ -24,6 +24,16 @@ if sys.platform == "win32": os.add_dll_directory(_pkg_dir) + # Preload MinGW runtime DLLs before libtsfile.dll to avoid 0xc0000139 / + # WinError 127 when their versions must match the C++ build toolchain. + for _mingw_dll in ( + "libwinpthread-1.dll", + "libgcc_s_seh-1.dll", + "libstdc++-6.dll", + ): + _mingw_path = os.path.join(_pkg_dir, _mingw_dll) + if os.path.isfile(_mingw_path): + ctypes.CDLL(_mingw_path) # Preload libtsfile.dll with absolute path to bypass DLL search issues. # This ensures it's already in memory when .pyd extensions reference it. _tsfile_dll = os.path.join(_pkg_dir, "libtsfile.dll") From 0de0c46e6fafcd4761a6a54cdae0c6de4df06ccb Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 16:05:42 +0800 Subject: [PATCH 08/10] Fix antlr4 CMake compatibility with CLion/CMake 4.x. Use NEW policy behavior on CMake 4+ and pass CMAKE_POLICY_VERSION_MINIMUM to the utfcpp external project so local MinGW builds configure successfully. --- .../antlr4-cpp-runtime-4/CMakeLists.txt | 32 ++++++++++++++++--- .../runtime/CMakeLists.txt | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/cpp/third_party/antlr4-cpp-runtime-4/CMakeLists.txt b/cpp/third_party/antlr4-cpp-runtime-4/CMakeLists.txt index 9e293de75..cf20c95dc 100644 --- a/cpp/third_party/antlr4-cpp-runtime-4/CMakeLists.txt +++ b/cpp/third_party/antlr4-cpp-runtime-4/CMakeLists.txt @@ -28,15 +28,37 @@ project(LIBANTLR4) if(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR CMAKE_VERSION VERSION_GREATER "3.0.0") CMAKE_POLICY(SET CMP0026 NEW) - CMAKE_POLICY(SET CMP0054 OLD) - CMAKE_POLICY(SET CMP0045 OLD) - CMAKE_POLICY(SET CMP0042 OLD) + # CMake 4.x no longer allows OLD behavior for these policies. + if(CMAKE_VERSION VERSION_LESS "4.0") + CMAKE_POLICY(SET CMP0054 OLD) + CMAKE_POLICY(SET CMP0045 OLD) + CMAKE_POLICY(SET CMP0042 OLD) + else() + if(POLICY CMP0054) + CMAKE_POLICY(SET CMP0054 NEW) + endif() + if(POLICY CMP0045) + CMAKE_POLICY(SET CMP0045 NEW) + endif() + if(POLICY CMP0042) + CMAKE_POLICY(SET CMP0042 NEW) + endif() + endif() endif() if(CMAKE_VERSION VERSION_EQUAL "3.3.0" OR CMAKE_VERSION VERSION_GREATER "3.3.0") - CMAKE_POLICY(SET CMP0059 OLD) - CMAKE_POLICY(SET CMP0054 OLD) + if(CMAKE_VERSION VERSION_LESS "4.0") + CMAKE_POLICY(SET CMP0059 OLD) + CMAKE_POLICY(SET CMP0054 OLD) + else() + if(POLICY CMP0059) + CMAKE_POLICY(SET CMP0059 NEW) + endif() + if(POLICY CMP0054) + CMAKE_POLICY(SET CMP0054 NEW) + endif() + endif() endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/cpp/third_party/antlr4-cpp-runtime-4/runtime/CMakeLists.txt b/cpp/third_party/antlr4-cpp-runtime-4/runtime/CMakeLists.txt index a143befb0..f2fd3f421 100644 --- a/cpp/third_party/antlr4-cpp-runtime-4/runtime/CMakeLists.txt +++ b/cpp/third_party/antlr4-cpp-runtime-4/runtime/CMakeLists.txt @@ -61,7 +61,7 @@ else() GIT_TAG "v3.1.1" SOURCE_DIR ${UTFCPP_DIR} UPDATE_DISCONNECTED 1 - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${UTFCPP_DIR}/install -DUTF8_TESTS=off -DUTF8_SAMPLES=off + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${UTFCPP_DIR}/install -DUTF8_TESTS=off -DUTF8_SAMPLES=off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 STEP_TARGETS build ) From 1ef4b9f262a81e6f9f69e600fb06ebf25b7b98f6 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 17:28:04 +0800 Subject: [PATCH 09/10] Static-link MinGW C++ runtime in libtsfile.dll for Windows wheels. libtsfile.dll no longer depends on libstdc++/libgcc DLLs from the C++ CI job, avoiding WinError 127 when wheel jobs use a different MSYS2 install. Python extensions still bundle runtime DLLs from the local compiler on PATH. --- .github/workflows/wheels.yml | 5 ----- cpp/src/CMakeLists.txt | 11 +++++++++++ python/setup.py | 9 ++------- python/tsfile/__init__.py | 23 +++++++++++++---------- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index ba8ba27d1..493c2a590 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -190,11 +190,6 @@ jobs: -Dspotless.check.skip=true -Dspotless.apply.skip=true test -d cpp/target/build/lib test -d cpp/target/build/include - # Bundle MinGW runtime DLLs built with libtsfile.dll so wheel jobs - # load matching libstdc++/libgcc instead of a different MSYS2 install. - for dll in libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll; do - cp "/mingw64/bin/$dll" cpp/target/build/lib/ - done - name: Upload C++ build output uses: actions/upload-artifact@v7 diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index e922836b7..75f967c95 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -152,6 +152,17 @@ endif() add_dependencies(tsfile utils_obj encoding_obj) +# Static-link MinGW runtime on Windows so libtsfile.dll does not depend on +# libstdc++/libgcc DLL versions that may differ across CI runners. +if(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_link_options(tsfile PRIVATE + -static-libgcc + -static-libstdc++ + -Wl,--whole-archive + -lwinpthread + -Wl,--no-whole-archive) +endif() + set(LIBTSFILE_PROJECT_VERSION ${TsFile_CPP_VERSION}) set(LIBTSFILE_SO_VERSION ${TsFile_CPP_VERSION}) set_target_properties(tsfile PROPERTIES VERSION ${LIBTSFILE_PROJECT_VERSION}) diff --git a/python/setup.py b/python/setup.py index 7e3371b63..99ef0bc0d 100644 --- a/python/setup.py +++ b/python/setup.py @@ -86,14 +86,9 @@ # Copy MinGW runtime DLLs next to libtsfile.dll so Python can find them. # Python 3.8+ does not search PATH for DLLs; they must be in the same # directory as the .pyd extensions (registered via os.add_dll_directory). - # Prefer DLLs bundled with the C++ build output to avoid version mismatch - # when libtsfile.dll is produced on a different CI runner. + # libtsfile.dll is statically linked against libstdc++/libgcc; copy the + # MinGW runtime used to build the Python extensions from PATH. for _mingw_dll in ("libstdc++-6.dll", "libgcc_s_seh-1.dll", "libwinpthread-1.dll"): - _bundled = CPP_LIB / _mingw_dll - if _bundled.is_file(): - shutil.copy2(_bundled, PKG / _mingw_dll) - print(f"setup.py: copied {_mingw_dll} from {_bundled}") - continue for _dir in os.environ.get("PATH", "").split(os.pathsep): _src = Path(_dir) / _mingw_dll if _src.is_file(): diff --git a/python/tsfile/__init__.py b/python/tsfile/__init__.py index 0113d0362..d00fab414 100644 --- a/python/tsfile/__init__.py +++ b/python/tsfile/__init__.py @@ -22,23 +22,26 @@ _pkg_dir = os.path.dirname(os.path.abspath(__file__)) +def _preload_dll(path): + if not os.path.isfile(path): + return + try: + ctypes.CDLL(path) + except OSError: + pass + + if sys.platform == "win32": os.add_dll_directory(_pkg_dir) - # Preload MinGW runtime DLLs before libtsfile.dll to avoid 0xc0000139 / - # WinError 127 when their versions must match the C++ build toolchain. + # Preload MinGW runtime DLLs used by the Python extensions. libtsfile.dll is + # statically linked against libstdc++/libgcc and only needs libwinpthread. for _mingw_dll in ( "libwinpthread-1.dll", "libgcc_s_seh-1.dll", "libstdc++-6.dll", ): - _mingw_path = os.path.join(_pkg_dir, _mingw_dll) - if os.path.isfile(_mingw_path): - ctypes.CDLL(_mingw_path) - # Preload libtsfile.dll with absolute path to bypass DLL search issues. - # This ensures it's already in memory when .pyd extensions reference it. - _tsfile_dll = os.path.join(_pkg_dir, "libtsfile.dll") - if os.path.isfile(_tsfile_dll): - ctypes.CDLL(_tsfile_dll) + _preload_dll(os.path.join(_pkg_dir, _mingw_dll)) + _preload_dll(os.path.join(_pkg_dir, "libtsfile.dll")) elif sys.platform == "darwin": _tsfile_dylib = os.path.join(_pkg_dir, "libtsfile.dylib") if os.path.isfile(_tsfile_dylib): From f4c123cb6092889cc0a61f908382c0eac4410575 Mon Sep 17 00:00:00 2001 From: 761417898 <761417898@qq.com> Date: Fri, 5 Jun 2026 18:18:46 +0800 Subject: [PATCH 10/10] Fix Spotless formatting in tsfile/__init__.py for CI. Add the blank line Black requires before the module-level _preload_dll helper. --- python/tsfile/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/tsfile/__init__.py b/python/tsfile/__init__.py index 92606bd82..d5f106bf8 100644 --- a/python/tsfile/__init__.py +++ b/python/tsfile/__init__.py @@ -22,6 +22,7 @@ _pkg_dir = os.path.dirname(os.path.abspath(__file__)) + def _preload_dll(path): if not os.path.isfile(path): return