Commit 6121abf
js: point GenAI at ORT via ORT_LIB_PATH; drop the unversioned dylib alias
onnxruntime-genai's InitApi() (built with dlopen on macOS-non-framework and
Linux, per its CMakeLists) honors the ORT_LIB_PATH env var: it dlopens that exact
file before its hardcoded unversioned libonnxruntime.{dylib,so} fallback. Set it
in the JS addon loader to the ORT we ship, so the package no longer needs the
unversioned alias purely for GenAI:
- detail/native.ts: applyOrtLibPath() sets ORT_LIB_PATH (only if unset) to the
resolved ORT in the prebuilds dir, or the configured libraryPath, before the
addon -- and thus GenAI's lazy InitApi -- loads. No-op on Windows (ORT is linked
directly, no dlopen). ortCandidateBasenames now prefers the versioned soname.
- install-native.cjs: rename the extracted unversioned ORT to the versioned soname
(libonnxruntime.1.dylib / .so.1) that libfoundry_local records, instead of
symlinking and keeping both -- one file, no symlink.
- copy-native.mjs: dev staging copies the versioned soname only, matching ship.
macOS CI (js_test_osx_arm64) runs npm ci (install-native postinstall) + vitest
with FOUNDRY_TEST_DATA_DIR set, so the real-model path that loads GenAI exercises
this end to end. The C++ build keeps its own ORT symlink for the C++ test harness,
which does not set ORT_LIB_PATH.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 11fd9e4 commit 6121abf
3 files changed
Lines changed: 63 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
67 | 65 | | |
68 | 66 | | |
69 | | - | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
74 | | - | |
| 71 | + | |
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
235 | 238 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 239 | + | |
| 240 | + | |
247 | 241 | | |
248 | 242 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
260 | 254 | | |
261 | 255 | | |
262 | 256 | | |
| |||
269 | 263 | | |
270 | 264 | | |
271 | 265 | | |
272 | | - | |
| 266 | + | |
273 | 267 | | |
274 | 268 | | |
275 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| |||
284 | 286 | | |
285 | 287 | | |
286 | 288 | | |
287 | | - | |
288 | | - | |
289 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
290 | 293 | | |
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
294 | | - | |
| 297 | + | |
295 | 298 | | |
296 | 299 | | |
297 | | - | |
| 300 | + | |
298 | 301 | | |
299 | 302 | | |
300 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
301 | 327 | | |
302 | 328 | | |
303 | 329 | | |
| |||
377 | 403 | | |
378 | 404 | | |
379 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
380 | 409 | | |
381 | 410 | | |
382 | 411 | | |
| |||
0 commit comments