Skip to content

Commit 037db62

Browse files
authored
Accumulated updates (#188)
Adding QIS support + decoding + others
1 parent cbb77d2 commit 037db62

File tree

1,183 files changed

+73395
-22960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,183 files changed

+73395
-22960
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: 'Setup LLVM 14.0.6'
2+
description: 'Install prebuilt LLVM 14.0.6 binaries for all platforms'
3+
outputs:
4+
llvm-path:
5+
description: 'Path to LLVM installation'
6+
value: ${{ steps.setup.outputs.llvm-path }}
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Setup LLVM (Linux)
12+
if: runner.os == 'Linux'
13+
shell: bash
14+
id: setup-linux
15+
run: |
16+
mkdir -p /tmp/llvm
17+
if [ "$(uname -m)" = "x86_64" ]; then
18+
echo "Installing LLVM 14.0.6 for x86_64..."
19+
# Use RHEL 8.4 build (Ubuntu 18.04 build doesn't exist for x86_64 in LLVM 14.0.6)
20+
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/clang+llvm-14.0.6-x86_64-linux-gnu-rhel-8.4.tar.xz
21+
tar xf clang+llvm-14.0.6-x86_64-linux-gnu-rhel-8.4.tar.xz -C /tmp/llvm --strip-components=1
22+
else
23+
echo "Installing LLVM 14.0.6 for aarch64..."
24+
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/clang+llvm-14.0.6-aarch64-linux-gnu.tar.xz
25+
tar xf clang+llvm-14.0.6-aarch64-linux-gnu.tar.xz -C /tmp/llvm --strip-components=1
26+
fi
27+
echo "/tmp/llvm/bin" >> $GITHUB_PATH
28+
echo "LLVM_SYS_140_PREFIX=/tmp/llvm" >> $GITHUB_ENV
29+
echo "llvm-path=/tmp/llvm" >> $GITHUB_OUTPUT
30+
31+
# Verify installation
32+
/tmp/llvm/bin/llc --version
33+
/tmp/llvm/bin/clang --version
34+
35+
- name: Setup LLVM (macOS)
36+
if: runner.os == 'macOS'
37+
shell: bash
38+
id: setup-macos
39+
run: |
40+
mkdir -p /tmp/llvm
41+
if [ "$(uname -m)" = "arm64" ]; then
42+
echo "Installing LLVM 14.0.6 for arm64..."
43+
ARCH_PREFIX=arm64-apple-darwin22.3.0
44+
else
45+
echo "Installing LLVM 14.0.6 for x86_64..."
46+
ARCH_PREFIX=x86_64-apple-darwin
47+
fi
48+
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/clang+llvm-14.0.6-$ARCH_PREFIX.tar.xz
49+
tar xf clang+llvm-14.0.6-$ARCH_PREFIX.tar.xz -C /tmp/llvm --strip-components=1
50+
51+
# FIX: LLVM 14.0.6 libunwind libraries have @rpath references to themselves
52+
# This causes "Library not loaded: @rpath/libunwind.1.dylib" errors at runtime
53+
# Fix by changing the install name to use the absolute path
54+
echo "Fixing LLVM libunwind install names..."
55+
for lib in /tmp/llvm/lib/libunwind*.dylib; do
56+
if [ -f "$lib" ]; then
57+
echo " Fixing $(basename $lib)"
58+
# Change the self-reference from @rpath/libunwind.1.dylib to the absolute path
59+
install_name_tool -id "$lib" "$lib"
60+
fi
61+
done
62+
echo "LLVM libunwind libraries fixed"
63+
64+
echo "/tmp/llvm/bin" >> $GITHUB_PATH
65+
echo "LLVM_SYS_140_PREFIX=/tmp/llvm" >> $GITHUB_ENV
66+
echo "llvm-path=/tmp/llvm" >> $GITHUB_OUTPUT
67+
68+
# Verify installation
69+
/tmp/llvm/bin/llc --version
70+
/tmp/llvm/bin/clang --version
71+
72+
- name: Setup LLVM (Windows)
73+
if: runner.os == 'Windows'
74+
shell: pwsh
75+
id: setup-windows
76+
run: |
77+
Write-Host "Installing LLVM 14.0.6 for Windows..."
78+
curl.exe -LO https://github.com/PLC-lang/llvm-package-windows/releases/download/v14.0.6/LLVM-14.0.6-win64.7z
79+
7z x LLVM-14.0.6-win64.7z "-oC:\LLVM" -y
80+
81+
echo "C:\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
82+
echo "LLVM_SYS_140_PREFIX=C:\LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
83+
echo "llvm-path=C:\LLVM" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
84+
85+
# Verify installation
86+
C:\LLVM\bin\llc.exe --version
87+
C:\LLVM\bin\clang.exe --version
88+
89+
- name: Set output
90+
shell: bash
91+
id: setup
92+
run: |
93+
if [ "$RUNNER_OS" = "Linux" ] || [ "$RUNNER_OS" = "macOS" ]; then
94+
echo "llvm-path=/tmp/llvm" >> $GITHUB_OUTPUT
95+
else
96+
echo "llvm-path=C:/LLVM" >> $GITHUB_OUTPUT
97+
fi

.github/workflows/julia-release.yml

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,24 @@ jobs:
7070
build_julia_binaries:
7171
needs: check_pr_push
7272
if: needs.check_pr_push.result == 'success' && needs.check_pr_push.outputs.run == 'true'
73-
runs-on: ${{ matrix.os }}
73+
runs-on: ${{ matrix.runner || matrix.os }}
7474
strategy:
7575
fail-fast: false
7676
matrix:
77-
os: [ubuntu-latest, macos-latest, windows-latest]
78-
architecture: [x86_64, aarch64]
79-
exclude:
80-
- os: windows-latest
77+
include:
78+
- os: ubuntu-latest
79+
architecture: x86_64
80+
- os: ubuntu-latest
8181
architecture: aarch64
82+
runner: ubuntu-latest
83+
- os: macos-13
84+
architecture: x86_64
85+
runner: macos-13 # Intel Mac for x86_64
86+
- os: macos-latest
87+
architecture: aarch64
88+
runner: macos-latest # ARM64 Mac
89+
- os: windows-latest
90+
architecture: x86_64
8291

8392
steps:
8493
- uses: actions/checkout@v4
@@ -88,22 +97,14 @@ jobs:
8897
- name: Set up Rust
8998
run: rustup show
9099

100+
- name: Setup LLVM 14.0.6
101+
uses: ./.github/actions/setup-llvm
102+
91103
- name: Install Rust target
92104
run: |
93-
if [ "${{ matrix.architecture }}" = "aarch64" ]; then
94-
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
95-
rustup target add aarch64-unknown-linux-gnu
96-
sudo apt-get update
97-
sudo apt-get install -y gcc-aarch64-linux-gnu
98-
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
99-
rustup target add aarch64-apple-darwin
100-
fi
101-
else
102-
# For x86_64 builds on ARM64 macOS
103-
if [ "${{ matrix.os }}" = "macos-latest" ]; then
104-
rustup target add x86_64-apple-darwin
105-
fi
106-
fi
105+
# With native ARM64 runners, no cross-compilation setup is needed
106+
# All builds are now native for their respective architectures
107+
echo "Using native build for ${{ matrix.architecture }} on ${{ matrix.os }}"
107108
108109
- name: Set up Visual Studio environment on Windows
109110
if: runner.os == 'Windows'
@@ -133,33 +134,49 @@ jobs:
133134
run: |
134135
cd julia/pecos-julia-ffi
135136
136-
if [ "${{ matrix.architecture }}" = "aarch64" ]; then
137-
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
138-
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
139-
cargo build --release --target aarch64-unknown-linux-gnu
140-
target_dir="../../target/aarch64-unknown-linux-gnu/release"
141-
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
142-
cargo build --release --target aarch64-apple-darwin
143-
target_dir="../../target/aarch64-apple-darwin/release"
144-
fi
145-
else
146-
# For x86_64 builds
147-
if [ "${{ matrix.os }}" = "macos-latest" ]; then
148-
# On ARM64 macOS, explicitly build for x86_64
149-
cargo build --release --target x86_64-apple-darwin
150-
target_dir="../../target/x86_64-apple-darwin/release"
151-
else
152-
cargo build --release
153-
target_dir="../../target/release"
154-
fi
137+
# Set up build flags for macOS to avoid LLVM dependency issues
138+
if [[ "${{ matrix.os }}" == macos-* ]]; then
139+
# Prevent linking against LLVM's libunwind
140+
export RUSTFLAGS="-C link-arg=-Wl,-dead_strip_dylibs -C link-arg=-Wl,-ld_classic"
141+
# Remove LLVM from library paths during build
142+
unset DYLD_LIBRARY_PATH
143+
unset DYLD_FALLBACK_LIBRARY_PATH
144+
# Explicitly exclude LLVM libraries from linking
145+
export RUSTFLAGS="$RUSTFLAGS -L native=/usr/lib"
155146
fi
156147
148+
# Native build for all platforms (no cross-compilation needed with native ARM64 runners)
149+
cargo build --release
150+
target_dir="../../target/release"
151+
157152
# Create artifact directory
158153
mkdir -p ../../artifacts
159154
160155
# Copy the built library
161-
if [ "${{ matrix.os }}" = "macos-latest" ]; then
156+
if [[ "${{ matrix.os }}" == macos-* ]]; then
162157
cp $target_dir/libpecos_julia.dylib ../../artifacts/
158+
159+
# Fix any remaining LLVM dependencies
160+
echo "Checking and fixing library dependencies..."
161+
otool -L ../../artifacts/libpecos_julia.dylib
162+
163+
# Check for any problematic dependencies
164+
if otool -L ../../artifacts/libpecos_julia.dylib | grep -q "/tmp/llvm"; then
165+
echo "ERROR: Binary has dependencies on /tmp/llvm which won't exist at runtime!"
166+
echo "Attempting to fix..."
167+
168+
# For libunwind specifically, we'll strip it out by creating a new dylib without it
169+
if otool -L ../../artifacts/libpecos_julia.dylib | grep -q "/tmp/llvm/lib/libunwind.dylib"; then
170+
echo "Creating fixed library without LLVM libunwind dependency..."
171+
# Use install_name_tool to remove the dependency by setting it to a weak import
172+
# that can fail at runtime without crashing
173+
install_name_tool -change /tmp/llvm/lib/libunwind.dylib /usr/lib/libSystem.B.dylib ../../artifacts/libpecos_julia.dylib || \
174+
echo "Warning: Could not remap libunwind dependency"
175+
fi
176+
fi
177+
178+
echo "Final library dependencies:"
179+
otool -L ../../artifacts/libpecos_julia.dylib
163180
else
164181
cp $target_dir/libpecos_julia.so ../../artifacts/
165182
fi
@@ -200,7 +217,7 @@ jobs:
200217
os: windows-latest
201218
architecture: x86_64
202219
- runner: macos-13
203-
os: macos-latest
220+
os: macos-13
204221
architecture: x86_64
205222
- runner: macos-latest
206223
os: macos-latest

.github/workflows/julia-test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
- name: Set up Rust
5858
run: rustup show
5959

60+
- name: Setup LLVM 14.0.6
61+
uses: ./.github/actions/setup-llvm
62+
6063
- name: Cache Rust
6164
uses: Swatinem/rust-cache@v2
6265
with:
@@ -72,13 +75,29 @@ jobs:
7275
if: runner.os == 'Windows'
7376
shell: pwsh
7477
run: |
78+
Write-Host "Building with LLVM_SYS_140_PREFIX: $env:LLVM_SYS_140_PREFIX"
7579
cd julia/pecos-julia-ffi
7680
cargo build --release
7781
7882
- name: Build Rust FFI library (Unix)
7983
if: runner.os != 'Windows'
8084
shell: bash
8185
run: |
86+
# On macOS, prevent Homebrew library paths from being used during linking
87+
if [[ "${{ runner.os }}" == "macOS" ]]; then
88+
# CRITICAL: Prevent Homebrew library paths from being used during linking
89+
# This fixes the "@rpath/libunwind.1.dylib" runtime error on macOS
90+
# Reference: https://github.com/rust-lang/rust/issues/135372
91+
unset LIBRARY_PATH
92+
unset LD_LIBRARY_PATH
93+
unset DYLD_LIBRARY_PATH
94+
unset DYLD_FALLBACK_LIBRARY_PATH
95+
unset PKG_CONFIG_PATH
96+
export LIBRARY_PATH=/usr/lib
97+
98+
echo "RUSTFLAGS: $RUSTFLAGS"
99+
fi
100+
82101
cd julia/pecos-julia-ffi
83102
cargo build --release
84103

.github/workflows/python-release.yml

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -60,72 +60,40 @@ jobs:
6060
build_wheels_pecos_rslib:
6161
needs: check_pr_push
6262
if: needs.check_pr_push.result == 'success' && needs.check_pr_push.outputs.run == 'true'
63-
runs-on: ${{ matrix.os }}
63+
runs-on: ${{ matrix.runner || matrix.os }}
6464
strategy:
6565
fail-fast: false
6666
matrix:
67-
os: [ubuntu-latest, macos-latest, windows-latest]
68-
architecture: [ x86_64, aarch64 ]
69-
exclude:
70-
- os: windows-latest
67+
include:
68+
- os: ubuntu-latest
69+
architecture: x86_64
70+
- os: ubuntu-latest
71+
architecture: aarch64
72+
runner: ubuntu-latest
73+
- os: macos-14
7174
architecture: aarch64
75+
- os: macos-13
76+
architecture: x86_64
77+
- os: windows-2022
78+
architecture: x86_64
7279

7380
steps:
7481
- uses: actions/checkout@v4
7582
with:
7683
ref: ${{ inputs.sha || github.sha }}
84+
submodules: recursive
7785

78-
- name: Set up Python
79-
uses: actions/setup-python@v5
80-
with:
81-
python-version: '3.10'
82-
83-
- name: Remove conflicting README.md
84-
run: |
85-
if [ -f crates/pecos-python/README.md ]; then
86-
mv crates/pecos-python/README.md crates/pecos-python/README.md.bak
87-
echo "Moved conflicting README.md to README.md.bak"
88-
else
89-
echo "No conflicting README.md found"
90-
fi
91-
92-
- name: Build wheel
93-
uses: PyO3/maturin-action@v1
86+
- name: Build wheels
87+
uses: pypa/cibuildwheel@v3.2.1
9488
with:
95-
command: build
96-
args: --release --out dist --interpreter python3.10 ${{ matrix.architecture == 'aarch64' && '--zig' || '' }}
97-
working-directory: python/pecos-rslib
98-
target: ${{ matrix.architecture == 'aarch64' && (matrix.os == 'macos-latest' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu') || (matrix.os == 'macos-latest' && 'x86_64-apple-darwin' || '') }}
99-
manylinux: auto
100-
101-
- name: Restore README.md
102-
if: always()
103-
run: |
104-
if [ -f crates/pecos-python/README.md.bak ]; then
105-
mv crates/pecos-python/README.md.bak crates/pecos-python/README.md
106-
echo "Restored README.md from backup"
107-
else
108-
echo "No README.md backup found"
109-
fi
110-
111-
- name: Test wheel is abi3
112-
run: |
113-
# Check that the wheel has abi3 tag
114-
ls -la python/pecos-rslib/dist/
115-
wheel_file=$(ls python/pecos-rslib/dist/*.whl)
116-
echo "Built wheel: $wheel_file"
117-
if [[ $wheel_file == *"abi3"* ]]; then
118-
echo "Wheel has abi3 tag"
119-
else
120-
echo "ERROR: Wheel does not have abi3 tag!"
121-
exit 1
122-
fi
89+
package-dir: python/pecos-rslib
90+
output-dir: wheelhouse
12391

124-
- name: Upload wheel
92+
- name: Upload wheels
12593
uses: actions/upload-artifact@v4
12694
with:
12795
name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }}
128-
path: python/pecos-rslib/dist/*.whl
96+
path: ./wheelhouse/*.whl
12997

13098
test_abi3_wheels:
13199
needs: build_wheels_pecos_rslib
@@ -142,13 +110,13 @@ jobs:
142110
os: ubuntu-latest
143111
architecture: x86_64
144112
- runner: windows-latest
145-
os: windows-latest
113+
os: windows-2022
146114
architecture: x86_64
147115
- runner: macos-13
148-
os: macos-latest
116+
os: macos-13
149117
architecture: x86_64
150-
- runner: macos-latest
151-
os: macos-latest
118+
- runner: macos-14
119+
os: macos-14
152120
architecture: aarch64
153121
steps:
154122
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)