Commit 1db7c25
Set SOVERSION 1 for Apple builds to match Linux library versioning (#28101)
### Description
Include Apple in the existing `SOVERSION 1` block by changing the CMake
condition from `if(NOT APPLE AND NOT WIN32)` to `if(NOT WIN32)`.
**Before:** macOS install name is `@rpath/libonnxruntime.1.20.0.dylib` —
dependents pinned to exact version.
**After:** macOS install name is `@rpath/libonnxruntime.1.dylib` —
dependents only require major version, matching Linux
`libonnxruntime.so.1`.
The actual library file remains `libonnxruntime.<VERSION>.dylib`, so
existing packaging scripts (`copy_strip_binary.sh`,
`mac-cpu-packaging-steps.yml`, `js/node/CMakeLists.txt`) are unaffected.
CMake creates the intermediate `libonnxruntime.1.dylib` symlink
automatically.
### Motivation and Context
On macOS, linking against onnxruntime embeds the full-versioned install
name, causing `dlopen` failures when a different patch version is
installed:
```
dlopen(dependent.dylib, 0x0001): Library not loaded: @rpath/libonnxruntime.1.20.0.dylib
```
Linux already avoids this via `SOVERSION 1`. The exclusion of Apple from
that code path appears unintentional.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tianleiwu <30328909+tianleiwu@users.noreply.github.com>1 parent 7fdc60e commit 1db7c25
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| |||
0 commit comments