edge-runtime icon indicating copy to clipboard operation
edge-runtime copied to clipboard

onnx runtime causes mutex lock error on MacOS builds

Open kallebysantos opened this issue 3 months ago • 0 comments

[!NOTE]
Priority VERY LOW: Issue report for future documentation, its doesn't affect docker build.

Expected behaviour

Neither run nor build should result in errors.

To Reproduce

ORT_DYLIB_PATH="..." ./scripts/run.sh

Error

libc++abi: terminating due to uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument

Reason

This issue only affects MacOS builds while using ORT_DYLIB_PATH targeting onnx v1.21+

The error occours during onnx runtime ctor and is explained on this thread at this comment.

On most platforms(except the ones that use libc++), std::mutex's default constructor and destructor are no-op. A mutex can be initialized at compile time, and it does not need to be destroyed. However, all Apple systems are not the case. Original comment

Workarround

In order to run onnx on macOS, a possible workarround is to firstcargo build without supply ORT_DYLIB_PATH and thencargo run with the dylib.

kallebysantos avatar Sep 22 '25 09:09 kallebysantos