Skip to content

Commit cc1788f

Browse files
committed
Fix Linux release ABI baseline
1 parent 6296628 commit cc1788f

2 files changed

Lines changed: 106 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
path: INTERSECT-${{ github.ref_name }}-Windows-x64.zip
4444

4545
build-linux:
46-
runs-on: ubuntu-latest
46+
runs-on: ubuntu-22.04
4747
steps:
4848
- name: Install dependencies
4949
run: |
@@ -64,6 +64,104 @@ jobs:
6464
- name: Build
6565
run: cmake --build build --config Release --target Intersect_All
6666

67+
- name: Audit Linux ABI baseline
68+
shell: bash
69+
run: |
70+
set -euo pipefail
71+
72+
ART_ROOT=build/Intersect_artefacts
73+
if [ -d "$ART_ROOT/Release" ]; then
74+
ART_ROOT="$ART_ROOT/Release"
75+
fi
76+
77+
STANDALONE="$ART_ROOT/Standalone/INTERSECT"
78+
VST3="$ART_ROOT/VST3/INTERSECT.vst3/Contents/x86_64-linux/INTERSECT.so"
79+
MAX_GLIBC="2.35"
80+
81+
ldd --version
82+
83+
find_linked_library() {
84+
local binary="$1"
85+
local soname="$2"
86+
ldd "$binary" | awk -v soname="$soname" '$1 == soname { print $3; exit }'
87+
}
88+
89+
fail_newer_glibc() {
90+
local binary="$1"
91+
local bad_versions=""
92+
local version
93+
94+
while IFS= read -r version; do
95+
if [ "$(printf '%s\n%s\n' "$MAX_GLIBC" "$version" | sort -V | tail -n 1)" != "$MAX_GLIBC" ]; then
96+
bad_versions="${bad_versions}GLIBC_${version}"$'\n'
97+
fi
98+
done < <(readelf --version-info "$binary" | grep -oE 'GLIBC_[0-9]+(\.[0-9]+)+' | sed 's/^GLIBC_//' | sort -Vu)
99+
100+
if [ -n "$bad_versions" ]; then
101+
echo "::error file=$binary::Requires glibc newer than GLIBC_$MAX_GLIBC"
102+
printf '%s' "$bad_versions"
103+
return 1
104+
fi
105+
}
106+
107+
fail_unavailable_symbols() {
108+
local binary="$1"
109+
local soname="$2"
110+
local pattern="$3"
111+
local provider
112+
local symbols
113+
local missing=""
114+
115+
symbols=$(readelf --version-info "$binary" | grep -oE "$pattern" | sort -Vu || true)
116+
if [ -z "$symbols" ]; then
117+
return 0
118+
fi
119+
120+
provider=$(find_linked_library "$binary" "$soname")
121+
if [ -z "$provider" ] || [ ! -f "$provider" ]; then
122+
echo "::error file=$binary::Could not locate $soname via ldd"
123+
return 1
124+
fi
125+
126+
while IFS= read -r symbol; do
127+
if ! grep -Fxq "$symbol" < <(strings "$provider"); then
128+
missing="${missing}${symbol}"$'\n'
129+
fi
130+
done <<< "$symbols"
131+
132+
if [ -n "$missing" ]; then
133+
echo "::error file=$binary::Requires symbols not provided by $provider"
134+
printf '%s' "$missing"
135+
return 1
136+
fi
137+
}
138+
139+
audit_binary() {
140+
local binary="$1"
141+
local ldd_output
142+
143+
echo "Auditing $binary"
144+
test -f "$binary"
145+
if ! ldd_output=$(ldd "$binary" 2>&1); then
146+
echo "$ldd_output"
147+
echo "::error file=$binary::ldd failed"
148+
return 1
149+
fi
150+
151+
echo "$ldd_output"
152+
if echo "$ldd_output" | grep -q 'not found'; then
153+
echo "::error file=$binary::Unresolved shared library dependency"
154+
return 1
155+
fi
156+
157+
fail_newer_glibc "$binary"
158+
fail_unavailable_symbols "$binary" libstdc++.so.6 'GLIBCXX_[0-9]+(\.[0-9]+)+|CXXABI_[0-9]+(\.[0-9]+)+'
159+
fail_unavailable_symbols "$binary" libasound.so.2 'ALSA_[0-9]+(\.[0-9]+)+([a-z0-9]+)?'
160+
}
161+
162+
audit_binary "$STANDALONE"
163+
audit_binary "$VST3"
164+
67165
- name: Package
68166
run: |
69167
ART_ROOT=build/Intersect_artefacts

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ endif()
4949
if(_intersect_ort_supported)
5050
if(INTERSECT_ORT_HEADERS_ROOT STREQUAL "")
5151
include(FetchContent)
52-
# Use the smallest official tarball just for headers. The CPU Linux package
53-
# is ~8 MB and contains the full public include tree shared by every platform.
54-
FetchContent_Declare(onnxruntime_headers
52+
set(_intersect_ort_fetch_args
5553
URL "https://github.com/microsoft/onnxruntime/releases/download/v${INTERSECT_ORT_VERSION}/onnxruntime-linux-x64-${INTERSECT_ORT_VERSION}.tgz"
56-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
5754
)
55+
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
56+
list(APPEND _intersect_ort_fetch_args DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
57+
endif()
58+
# Use the smallest official tarball just for headers. The CPU Linux package
59+
# is ~8 MB and contains the full public include tree shared by every platform.
60+
FetchContent_Declare(onnxruntime_headers ${_intersect_ort_fetch_args})
5861
FetchContent_MakeAvailable(onnxruntime_headers)
5962
set(INTERSECT_ORT_HEADERS_ROOT "${onnxruntime_headers_SOURCE_DIR}")
6063
endif()

0 commit comments

Comments
 (0)