Commit f68990e
[ci] static-link libstdc++/libgcc into MATLAB MEX, leave Octave dynamic
MATLAB R2024a ships a bundled libstdc++.so.6 that's older than the
ubuntu-22.04 / windows-latest runner toolchains. A dynamically-linked
MEX from those runners fails to load with:
Invalid MEX-file ... siamex.mexa64: libstdc++.so.6: version
`GLIBCXX_3.4.29' not found
Fix: pass -static-libstdc++ -static-libgcc (Linux GCC) and /MT (MSVC)
to the siamize_mex link line so the MEX brings its own C++ runtime.
This is gated on SIAMIZE_STATIC_LINK (default ON, same flag the CLI
binary already uses) so users can opt out if they need to.
Important: this is MATLAB-only. The Octave MEX must stay dynamically
linked against libstdc++. Statically embedding a second libstdc++
inside a MEX loaded by an Octave process that already has one
dynamically loaded causes ABI conflicts (std::cout, type_info,
exception state) and SIGABRT on first siamex() call. Verified locally:
adding -static-libstdc++ to mkoctfile LDFLAGS made octave-cli core
dump on siamex() entry; reverting restored normal operation and the
30/30 siamize.m unit tests still pass.
MATLAB doesn't hit the same problem in practice because its bundled
libstdc++ is genuinely too old -- the static MEX has no "real" stdc++
to fight with, only a stub that lacks the needed GLIBCXX symbols.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 19ecec7 commit f68990e
1 file changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
310 | 328 | | |
311 | 329 | | |
312 | 330 | | |
| |||
365 | 383 | | |
366 | 384 | | |
367 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
368 | 395 | | |
369 | 396 | | |
370 | 397 | | |
| |||
0 commit comments