Skip to content

Commit 1ca4aa6

Browse files
authored
Use Rocky Linux 8 for building Python packages (#4842)
* WIP: Use Rocky Linux 8 for building Python packages * Remove obsolete config * Use custom minimal OpenCASCADE build * Update CI * Update CI * Update CI * Revert excess changes * Add comment * Add comment * Add readme
1 parent f36c8da commit 1ca4aa6

17 files changed

+449
-113
lines changed

.github/workflows/build-test-distribute.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ jobs:
332332
if: ${{ needs.config.outputs.test_pip_build == 'true' }}
333333
uses: ./.github/workflows/pip-build.yml
334334
with:
335-
docker_image_tag: ${{ needs.config.outputs.docker_image_tag }}
335+
vcpkg_docker_image_tag: ${{ needs.config.outputs.vcpkg_docker_image_tag }}
336336

337337
collect-stats:
338338
timeout-minutes: 5

.github/workflows/build-test-linux-vcpkg.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,20 +161,6 @@ jobs:
161161
CXX: ${{ matrix.cxx-compiler }}
162162
run: make -f scripts/mrbind/generate.mk MODE=none -B --trace MESHLIB_SHLIB_DIR=build/${{matrix.config}}/bin CXX_FOR_BINDINGS=/usr/bin/clang++ DEPS_BASE_DIR=/opt/vcpkg/installed/${{ matrix.arch }}-linux-meshlib
163163

164-
# TODO: move to pip-build.yml after migrating from ubuntu20
165-
#- name: Build Python shim libs
166-
# if: ${{ inputs.mrbind && !matrix.skip_mrbind }}
167-
# env:
168-
# CXX: ${{ matrix.cxx-compiler }}
169-
# CXX_FOR_BINDINGS: /usr/bin/clang++
170-
# VCPKG_BASE_DIR: /opt/vcpkg/installed/${{ matrix.arch }}-linux-meshlib
171-
# run: |
172-
# python3 -m pip install uv
173-
# for PYTHON_VER in $(cat scripts/mrbind-pybind11/python_versions.txt | xargs) ; do
174-
# export PKG_CONFIG_PATH=$(uv run -p ${PYTHON_VER} python -c "import sysconfig; print(sysconfig.get_config_var('LIBPC'))")
175-
# make shims -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 MESHLIB_SHLIB_DIR=build/${{matrix.config}}/bin PYTHON_VERSIONS=${PYTHON_VER}
176-
# done
177-
178164
- name: Collect Timings
179165
run: ./scripts/devops/collect_timing_logs.sh linux-vcpkg-${{ matrix.arch }} ${{matrix.config}} "${{matrix.compiler}}"
180166

.github/workflows/pip-build.yml

Lines changed: 85 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
# This is the manual run from the UI.
1212
workflow_dispatch:
1313
inputs:
14-
docker_image_tag:
14+
vcpkg_docker_image_tag:
1515
# Empty string means the same thing as "latest", but we use an empty string here to ensure this works,
1616
# because `types: [published]` can't have any inputs, so there we are forced to use an empty string, so it needs to work.
1717
default: ""
@@ -20,7 +20,7 @@ on:
2020
# This is the `uses:` call from other `.yml` files.
2121
workflow_call:
2222
inputs:
23-
docker_image_tag:
23+
vcpkg_docker_image_tag:
2424
required: true
2525
type: string
2626

@@ -52,25 +52,23 @@ jobs:
5252
timeout-minutes: 80
5353
runs-on: ${{ matrix.runner }}
5454
container:
55-
image: meshlib/meshlib-${{matrix.os}}:${{inputs.docker_image_tag || 'latest'}}
55+
image: meshlib/meshlib-${{matrix.os}}:${{inputs.vcpkg_docker_image_tag || 'latest'}}
5656
options: ${{ matrix.container-options }}
5757
strategy:
5858
fail-fast: false
5959
matrix:
6060
platform: ["x86_64", "aarch64"]
6161
include:
6262
- platform: "x86_64"
63-
os: "ubuntu20"
63+
os: rockylinux8-vcpkg-x64
6464
container-options: "--user root"
6565
runner: ubuntu-latest
66-
compiler: /usr/bin/clang++-11
66+
compiler: /usr/bin/clang++
6767
- platform: "aarch64"
68-
os: "ubuntu20-arm64"
68+
os: rockylinux8-vcpkg-arm64
6969
container-options: " " # empty
7070
runner: [ self-hosted, linux-arm64, on-demand, meshinspector ]
71-
# When using Clang 11 on Ubuntu Arm 20.04, we get some obscure ABI issues that fail some tests,
72-
# see the comments in `test_regression/test_algorithms/test_decimate.py` for more details.
73-
compiler: /usr/bin/clang++-18
71+
compiler: /usr/bin/clang++
7472

7573
steps:
7674
- name: Work-around possible permission issues
@@ -102,39 +100,50 @@ jobs:
102100
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/mrbind
103101
git submodule update --init --recursive --depth 1 thirdparty/imgui thirdparty/parallel-hashmap thirdparty/mrbind-pybind11 thirdparty/mrbind
104102
105-
- name: Python setup
106-
env:
107-
ALLOW_DELETING_EXISTING_PYTHON: 1
108-
run: |
109-
scripts/mrbind-pybind11/install_all_python_versions_ubuntu_reqs.sh
110-
111-
- name: Install thirdparty libs
103+
- name: Install mrbind
112104
# Also print the amount of RAM. If there's not enough RAM, building MRBind bindings can fail. Not doing it in that step, because OOM fails can erase logs from the current step.
113105
run: |
114-
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
115-
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
116-
./scripts/mrbind/install_mrbind_ubuntu.sh
106+
./scripts/mrbind/install_mrbind_rockylinux.sh
117107
free -h
118108
119109
- name: Build
120110
run: ./scripts/build_source.sh
121111
env:
122112
MESHLIB_BUILD_RELEASE: "ON"
123113
MESHLIB_BUILD_DEBUG: "OFF"
124-
# When using Clang 11 on Ubuntu Arm 20.04, we get some obscure ABI issues that fail some tests,
125-
# see the comments in `test_regression/test_algorithms/test_decimate.py` for more details.
126-
CMAKE_CXX_COMPILER: ${{matrix.compiler}}
127-
# FIXME: OpenGL libraries are included to wheel packages when the XDE module is used
128-
# Enabling `-allow-unsupported-compiler` because we use Clang 18 on Arm, while Cuda supports at most 16.
114+
CMAKE_CXX_COMPILER: ${{ matrix.compiler }}
129115
MR_CMAKE_OPTIONS: >
130-
-DMRIOEXTRAS_OPENCASCADE_USE_XDE=OFF
131116
-DMRVIEWER_NO_GTK=ON
132-
-DMESHLIB_BUILD_MRCUDA=ON
133-
${{ fromJSON('["", "-DCMAKE_CUDA_FLAGS=-allow-unsupported-compiler"]')[matrix.platform == 'aarch64'] }}
117+
-DMR_PCH_USE_EXTRA_HEADERS=ON
118+
-DCMAKE_CUDA_HOST_COMPILER=/opt/rh/gcc-toolset-11/root/usr/bin/g++
134119
135120
- name: Generate and build MRBind bindings
136121
run: |
137-
make -f scripts/mrbind/generate.mk -B --trace FOR_WHEEL=1 CXX_FOR_ABI=${{matrix.compiler}}
122+
make -f scripts/mrbind/generate.mk -B --trace \
123+
FOR_WHEEL=1 \
124+
CXX_FOR_ABI=${{ matrix.compiler }} \
125+
CXX_FOR_BINDINGS=${{ matrix.compiler }} \
126+
DEPS_BASE_DIR=${VCPKG_ROOT}/installed/${VCPKG_TRIPLET}
127+
128+
# install helper utility for Python version management
129+
- name: Install uv
130+
uses: astral-sh/setup-uv@bd01e18f51369d5a26f1651c3cb451d3417e3bba # v6
131+
132+
- name: Build Python shim libs
133+
run: |
134+
PYTHON_VERSIONS=$(cat scripts/mrbind-pybind11/python_versions.txt | xargs)
135+
GET_SYSCONFIG_VAR=${PWD}/scripts/wheel/get_sysconfig_var.py
136+
137+
for PYTHON_VER in ${PYTHON_VERSIONS} ; do
138+
export PKG_CONFIG_PATH=$(uv run --python ${PYTHON_VER} ${GET_SYSCONFIG_VAR} LIBPC)
139+
140+
make shims -f scripts/mrbind/generate.mk -B --trace \
141+
FOR_WHEEL=1 \
142+
CXX_FOR_ABI=${{ matrix.compiler }} \
143+
CXX_FOR_BINDINGS=${{ matrix.compiler }} \
144+
DEPS_BASE_DIR=${VCPKG_ROOT}/installed/${VCPKG_TRIPLET} \
145+
PYTHON_VERSIONS=${PYTHON_VER}
146+
done
138147
139148
- name: Run Tests
140149
run: MR_LOCAL_RESOURCES=1 xvfb-run -a ./build/Release/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd
@@ -143,14 +152,28 @@ jobs:
143152
run: build/Release/bin/MRTest
144153

145154
- name: Python Tests
146-
working-directory: ./build/Release/bin
147-
run: python3 ./../../../scripts/run_python_test_script.py -multi-cmd
155+
run: |
156+
PYTHON_VERSIONS=$(cat scripts/mrbind-pybind11/python_versions.txt | xargs)
157+
REQUIREMENTS_FILE=${PWD}/requirements/python.txt
158+
GET_SYSCONFIG_VAR=${PWD}/scripts/wheel/get_sysconfig_var.py
159+
160+
cd build/Release/bin
161+
for PYTHON_VER in ${PYTHON_VERSIONS} ; do
162+
PYTHON_LIB_DIR=$(uv run --python ${PYTHON_VER} ${GET_SYSCONFIG_VAR} LIBDIR)
163+
164+
LD_LIBRARY_PATH=${PYTHON_LIB_DIR} \
165+
uv run \
166+
--python ${PYTHON_VER} \
167+
--with-requirements ${REQUIREMENTS_FILE} \
168+
--with pytest \
169+
python3 ./../../../scripts/run_python_test_script.py -d '../test_python'
170+
done
148171
149172
- name: Create and fix Wheel
150-
shell: bash
151173
run: |
152174
python3.12 -m venv ./wheel_venv
153175
source ./wheel_venv/bin/activate
176+
python3.12 -m pip install patchelf
154177
python3.12 ./scripts/wheel/build_wheel.py --version ${{needs.setup.outputs.version_tag || '0'}}
155178
156179
- name: Upload Python Stubs
@@ -407,7 +430,7 @@ jobs:
407430
fail-fast: false
408431
matrix:
409432
platform: ["x86_64", "aarch64"]
410-
os: ["ubuntu:20.04", "ubuntu:22.04", "debian:11-slim", "fedora:37", "fedora:39"]
433+
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
411434
include:
412435
- platform: "x86_64"
413436
runner: ubuntu-latest
@@ -417,41 +440,44 @@ jobs:
417440
runner: [ self-hosted, linux-arm64, on-demand, meshinspector ]
418441
container-options: " " # empty
419442
container-prefix: "arm64v8/"
420-
- os: "ubuntu:20.04"
421-
py-version: "3.8"
422-
py-cmd: "python3.8"
423-
- os: "debian:11-slim"
424-
py-version: "3.9"
425-
py-cmd: "python3.9"
426-
- os: "ubuntu:22.04"
427-
py-version: "3.10"
428-
py-cmd: "python3.10"
429-
- os: "fedora:37"
430-
py-version: "3.11"
431-
py-cmd: "python3.11"
432-
- os: "fedora:39"
433-
py-version: "3.12"
434-
py-cmd: "python3.12"
443+
- py-version: "3.8"
444+
os: "rockylinux:8"
445+
- py-version: "3.9"
446+
os: "debian:11-slim"
447+
- py-version: "3.10"
448+
os: "ubuntu:22.04"
449+
- py-version: "3.11"
450+
os: "fedora:37"
451+
- py-version: "3.12"
452+
os: "fedora:39"
453+
- py-version: "3.13"
454+
os: "fedora:42"
455+
env:
456+
PYTHON_CMD: python${{ matrix.py-version }}
435457
steps:
436458
- name: Checkout
437459
uses: actions/checkout@v4
438460
with:
439461
ref: ${{needs.setup.outputs.version_tag}}
440462

441-
- name: Ubuntu system setup
442-
if: ${{ matrix.os == 'ubuntu:20.04' || matrix.os == 'ubuntu:22.04' || matrix.os == 'debian:11-slim' }}
443-
run: apt -y update && apt -y upgrade && apt -y install curl libssl-dev python3-pip
463+
- name: Rocky Linux system setup
464+
if: ${{ matrix.os == 'rockylinux:8' }}
465+
run: dnf -y install python38-pip
466+
467+
- name: Debian/Ubuntu system setup
468+
if: ${{ matrix.os == 'debian:11-slim' || matrix.os == 'ubuntu:22.04' }}
469+
run: apt -y update && apt -y install curl libssl-dev python3-pip
444470

445-
- name: Fedora 37 system setup
446-
if: ${{matrix.os == 'fedora:37' || matrix.os == 'fedora:39'}}
447-
run: dnf -y install python3 pip
471+
- name: Fedora system setup
472+
if: ${{ matrix.os == 'fedora:37' || matrix.os == 'fedora:39' || matrix.os == 'fedora:42' }}
473+
run: dnf -y install python3-pip
448474

449475
- name: Pip setup
450476
run: |
451-
${{ matrix.py-cmd }} -m pip install --upgrade pip
452-
${{ matrix.py-cmd }} -m pip uninstall -y meshlib
453-
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt
454-
${{ matrix.py-cmd }} -m pip install pytest
477+
${{ env.PYTHON_CMD }} -m pip install --upgrade pip
478+
${{ env.PYTHON_CMD }} -m pip uninstall -y meshlib
479+
${{ env.PYTHON_CMD }} -m pip install --upgrade -r ./requirements/python.txt
480+
${{ env.PYTHON_CMD }} -m pip install pytest
455481
456482
- name: Download Meshlib wheel from Artifact
457483
uses: actions/download-artifact@v4
@@ -460,11 +486,11 @@ jobs:
460486
merge-multiple: true
461487

462488
- name: Meshlib wheel install
463-
run: ${{ matrix.py-cmd }} -m pip install ${{ matrix.pip-options }} ./meshlib-*.whl
489+
run: ${{ env.PYTHON_CMD }} -m pip install ${{ matrix.pip-options }} ./meshlib-*.whl
464490

465491
- name: Run Python tests
466492
working-directory: test_python
467-
run: ${{ matrix.py-cmd }} -m pytest -s -v
493+
run: ${{ env.PYTHON_CMD }} -m pytest -s -v
468494

469495
windows-pip-test:
470496
needs: [windows-pip-build]

requirements/vcpkg-linux.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ libe57format
2626
libharu
2727
libjpeg-turbo
2828
libzip
29-
opencascade[core]
29+
opencascade-minimal
3030
openctm
3131
openvdb
3232
parallel-hashmap

scripts/build_wheel.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

scripts/wheel/build_wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def build_wheel():
111111

112112
if SYSTEM == "Linux":
113113
# see also: https://github.com/mayeut/pep600_compliance
114-
manylinux_version = "2_31"
114+
manylinux_version = "2_28"
115115

116116
os.chdir(WHEEL_ROOT_DIR)
117117
subprocess.check_call(

scripts/wheel/get_sysconfig_var.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Helper script for retrieving non-system Python distribution info (libpython3 path, pkg-config path, etc.)
4+
"""
5+
import sysconfig
6+
7+
if __name__ == '__main__':
8+
import sys
9+
print(sysconfig.get_config_var(sys.argv[1]))

source/MRIOExtras/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ IF(NOT MRIOEXTRAS_NO_STEP)
117117
ApplicationFramework
118118
DataExchange
119119
)
120-
set(OpenCASCADE_REQUIRED_LIBRARIES TKernel TKBRep TKMath TKMesh TKDESTEP TKSTEP TKXSBase)
120+
set(OpenCASCADE_REQUIRED_LIBRARIES TKernel TKBRep TKMath TKMesh TKDESTEP TKSTEP TKTopAlgo TKXSBase)
121121
IF(MRIOEXTRAS_OPENCASCADE_USE_XDE)
122-
list(APPEND OpenCASCADE_REQUIRED_LIBRARIES TKXDESTEP TKLCAF TKXCAF TKTopAlgo)
122+
list(APPEND OpenCASCADE_REQUIRED_LIBRARIES TKXDESTEP TKLCAF TKXCAF)
123123
ENDIF()
124124
FOREACH(LIBRARY_NAME ${OpenCASCADE_LIBRARIES})
125125
IF(${LIBRARY_NAME} IN_LIST OpenCASCADE_REQUIRED_LIBRARIES)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 17bc7f1638..c4283c3c4d 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -473,6 +473,9 @@ OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
6+
7+
set (OCCT_3RDPARTY_CMAKE_LIST)
8+
9+
+# define CSF variable
10+
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
11+
+
12+
# Tcl (mandatory for Draw Harness)
13+
if (USE_TCL)
14+
message (STATUS "Info: TCL is used by OCCT")
15+
@@ -769,9 +772,6 @@ file(COPY ${CMAKE_SOURCE_DIR}/.clang-format DESTINATION ${CMAKE_SOURCE_DIR})
16+
OCCT_MAKE_OS_WITH_BITNESS()
17+
OCCT_MAKE_COMPILER_SHORT_NAME()
18+
19+
-# define CSF variable
20+
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
21+
-
22+
# do not define INSTALL_DIR_BIN for win.
23+
# Leave library structure for win: <prefix>/win64/vc10/bin(d)
24+
if (NOT DEFINED INSTALL_DIR_BIN)

0 commit comments

Comments
 (0)