Skip to content

Commit 6c7630e

Browse files
committed
Fix remaining CI failures: rc.exe flags, LTO archives, R proxies, docs deps
- Conda Build win: /GR /EHsc moved out of ADD_DEFINITIONS into CXX-scoped compile options. With the Ninja generator, cmcldeps forwards directory definitions to rc.exe, which aborted with RC1203 on the bundled libtiff version resource (the VS generator used by the pip build does not forward them, which is why only conda failed). - Docs/pip TIFF symbols: build the bundled libtiff without LTO. When the static archive is created by an 'ar' without the LTO plugin (conda's binutils, MinGW), slim LTO members have invisible symbols and the final link silently leaves TIFFSetErrorHandler/TIFFSetWarningHandler undefined, failing at import. - R interface: only pass SWIGWORDSIZE64 to SWIG >= 4.4. Older SWIG keeps int64_t literal (flag unnecessary) and SWIG 4.2's R backend mishandles 'long long' returns under the flag: the C side returns a native vector while the R proxy wraps it as an external pointer, so every burst_search call died in validObject. - Docs Build: render the documentation against the freshly built tttrlib conda package instead of pip-building from source. The docs job now depends on the Linux conda build, downloads its conda-bld artifact and passes it to rattler-build as a local channel; the recipe drops the compiler toolchain and gains tttrlib/pooch/tqdm host dependencies.
1 parent c78afa1 commit 6c7630e

5 files changed

Lines changed: 48 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ jobs:
702702

703703
build_conda_docs:
704704
name: Docs Build (rattler)
705-
needs: setup
705+
needs: [setup, build_conda_lnx]
706706
if: needs.setup.outputs.is_main == 'true'
707707
runs-on: ubuntu-latest
708708
timeout-minutes: 120
@@ -721,20 +721,28 @@ jobs:
721721
- name: Install rattler-build
722722
shell: bash -l {0}
723723
run: conda install -y rattler-build -c conda-forge
724+
# The docs recipe consumes the tttrlib conda package built by
725+
# build_conda_lnx instead of rebuilding from source, so the docs are
726+
# rendered against exactly what gets shipped.
727+
- uses: actions/download-artifact@v4
728+
with:
729+
name: conda-packages-ubuntu-latest
730+
path: local-channel
724731
- name: Build documentation package (rattler)
725732
shell: bash -l {0}
726733
run: |
727734
export PKG_VERSION=$(python -c "import re; v=re.search(r'version\s*=\s*\"([^\"]+)\"', open('pyproject.toml').read()); print(v.group(1))")
728735
rattler-build build --recipe recipes/docs \
729736
--output-dir ./conda-bld \
737+
-c "file://$PWD/local-channel" \
730738
-c conda-forge
731739
# PRD-003 M1: extract the built HTML from the docs package (install it into a
732740
# throwaway prefix, then copy) so the gh-pages deploy job can consume the
733741
# rattler-built docs instead of re-running Sphinx.
734742
- name: Extract built HTML
735743
shell: bash -l {0}
736744
run: |
737-
mamba create -y -p ./docsenv -c ./conda-bld -c conda-forge tttrlib-docs
745+
mamba create -y -p ./docsenv -c ./conda-bld -c ./local-channel -c conda-forge tttrlib-docs
738746
mkdir -p docs-html
739747
cp -r ./docsenv/share/doc/tttrlib/html/. docs-html/
740748
ls docs-html | head

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ IF (MSVC)
174174
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
175175
# Issue with MSVC exceptions (https://stackoverflow.com/questions/6832666/lnk2019-when-including-asio-headers-solution-generated-with-cmake)
176176
# https://github.com/microsoft/vcpkg/discussions/25414
177-
ADD_DEFINITIONS(/DWIN32 /D_WINDOWS /GR /EHsc)
177+
ADD_DEFINITIONS(/DWIN32 /D_WINDOWS)
178+
# /GR /EHsc are cl-only flags: keep them out of ADD_DEFINITIONS, or the
179+
# Ninja generator (cmcldeps) forwards them to rc.exe, which then fails
180+
# with RC1203 on the bundled libtiff version resource.
181+
ADD_COMPILE_OPTIONS("$<$<COMPILE_LANGUAGE:CXX>:/GR;/EHsc>")
178182
ENDIF (MSVC)
179183
if(APPLE)
180184
FIND_PACKAGE(Threads)
@@ -290,6 +294,13 @@ IF(WITH_TIFF)
290294
SET(webp OFF CACHE BOOL "" FORCE)
291295
SET(pixarlog OFF CACHE BOOL "" FORCE)
292296
ADD_SUBDIRECTORY(thirdparty/libtiff EXCLUDE_FROM_ALL)
297+
IF(NOT MSVC)
298+
# libtiff.a may be archived by an 'ar' without the LTO plugin (conda's
299+
# binutils, MinGW). Slim LTO members then have invisible symbols and the
300+
# final link silently leaves TIFF* symbols undefined (import error at
301+
# runtime). Always put real machine code into the bundled archive.
302+
TARGET_COMPILE_OPTIONS(tiff PRIVATE -fno-lto)
303+
ENDIF()
293304
LINK_LIBRARIES(TIFF::tiff)
294305
ADD_COMPILE_DEFINITIONS(BUILD_TIFF)
295306
MESSAGE(STATUS "TIFF support: bundled libtiff 4.7.0 (static, built-in codecs; Deflate/ZIP=${WITH_TIFF_ZLIB})")

ext/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ MESSAGE(STATUS "SWIG_VERSION: ${SWIG_VERSION}")
1515
INCLUDE(${SWIG_USE_FILE})
1616
INCLUDE_DIRECTORIES(.)
1717

18-
# glibc on LP64 Linux defines int64_t as 'long', but SWIG's stdint.i typedefs
19-
# (applied by SWIG >= 4.4 whenever stdint.i is included) resolve int64_t to
20-
# 'long long' unless SWIGWORDSIZE64 is defined. Without this flag the
21-
# generated wrappers mix std::vector<long long> with the library's
22-
# std::vector<long> and do not compile on Linux.
23-
IF(UNIX AND NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8)
18+
# glibc on LP64 Linux defines int64_t as 'long', but SWIG >= 4.4 eagerly
19+
# resolves the stdint.i typedefs and picks 'long long' unless SWIGWORDSIZE64
20+
# is defined. Without this flag the generated wrappers mix
21+
# std::vector<long long> with the library's std::vector<long> and do not
22+
# compile on Linux. Only define it for SWIG >= 4.4: older SWIG keeps int64_t
23+
# literal in generated code (so the flag is unnecessary), and SWIG 4.2's R
24+
# backend mishandles 'long long' returns under SWIGWORDSIZE64 (the C side
25+
# returns a native vector while the R proxy expects an external pointer).
26+
IF(UNIX AND NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT SWIG_VERSION VERSION_LESS "4.4")
2427
SET(TTTRLIB_SWIG_INT64_FLAG "-DSWIGWORDSIZE64")
2528
LIST(APPEND CMAKE_SWIG_FLAGS ${TTTRLIB_SWIG_INT64_FLAG})
2629
ENDIF()

recipes/docs/build.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env bash
22
set -euxo pipefail
33

4-
# 1. Build & install tttrlib into the host python (needed for autodoc/gallery).
5-
export CMAKE_ARGS="-DWITH_AVX=OFF"
6-
"${PYTHON}" -m pip install . --no-deps --no-build-isolation -vv
4+
# tttrlib itself comes from the freshly built conda package (host dependency);
5+
# the CI docs job passes its conda-bld channel to rattler-build. Nothing is
6+
# compiled here - this recipe only runs Sphinx against the installed package.
7+
"${PYTHON}" -c "import tttrlib; print('tttrlib', tttrlib.__version__ if hasattr(tttrlib, '__version__') else 'imported')"
78

8-
# 2. Reference data for the example gallery (examples are NOT executed).
9+
# 1. Reference data for the example gallery (examples are NOT executed).
910
export TTTRLIB_DATA="${SRC_DIR}/tttr-data"
1011
export TTTRLIB_DOCS_EXECUTE_EXAMPLES=0
11-
"${PYTHON}" -m pip install --no-build-isolation pooch tqdm || true
1212
"${PYTHON}" test/download_test_data.py --output-dir "${TTTRLIB_DATA}" --quiet || \
1313
echo "warning: reference data download failed; gallery thumbnails may be missing"
1414

15-
# 3. Build the HTML documentation.
15+
# 2. Build the HTML documentation.
1616
export BUILD_TIER="${BUILD_TIER:-4}"
1717
cd doc
1818
mkdir -p _build/api
@@ -22,6 +22,6 @@ rm -rf _build/html/stable/api
2222
[ -d _build/api ] && cp -r _build/api _build/html/stable/ || true
2323
cd ..
2424

25-
# 4. Install the built HTML into the package.
25+
# 3. Install the built HTML into the package.
2626
mkdir -p "${PREFIX}/share/doc/tttrlib"
2727
cp -r doc/_build/html/stable "${PREFIX}/share/doc/tttrlib/html"

recipes/docs/recipe.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# rattler-build recipe that builds the tttrlib HTML documentation (Sphinx +
22
# Doxygen) reproducibly and packages it under share/doc/tttrlib/html.
3-
# Build with: rattler-build build --recipe recipes/docs -c conda-forge
3+
# tttrlib itself is NOT built here: it is consumed as a conda package from the
4+
# channel passed on the command line (in CI: the conda-bld artifact of the
5+
# Linux conda build job).
6+
# Build with:
7+
# rattler-build build --recipe recipes/docs -c <channel-with-tttrlib> -c conda-forge
48
context:
59
version: ${{ env.get("PKG_VERSION", default="0.27.0") }}
610

@@ -18,23 +22,17 @@ build:
1822

1923
requirements:
2024
build:
21-
- ${{ compiler('c') }}
22-
- ${{ compiler('cxx') }}
23-
- cmake
24-
- ninja
25-
- make
26-
- swig >=4.1
2725
- doxygen
2826
- pandoc
2927
- graphviz
3028
host:
3129
- python
32-
- pip
33-
- scikit-build-core
30+
# The package under documentation - freshly built by the CI conda job.
31+
- tttrlib ==${{ version }}
3432
- numpy
35-
- hdf5
36-
- highfive
37-
- nlohmann_json
33+
# Reference data download (test/download_test_data.py)
34+
- pooch
35+
- tqdm
3836
# Sphinx documentation stack (mirrors the CI docs dependencies)
3937
- sphinx
4038
- sphinx-copybutton

0 commit comments

Comments
 (0)