Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The framework [.../onnxruntime.framework] is a framework of static libraries, and will not be copied to the app #21450

Closed
rolfbjarne opened this issue Oct 16, 2024 · 8 comments · Fixed by #21492
Assignees
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@rolfbjarne
Copy link
Member

From @fdevillard on Mon, 14 Oct 2024 15:55:14 GMT

Describe the bug

I've created a toy MAUI project and everything build and run well until I add and use the following dependencies:

    <PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.19.2" />
    <PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.19.2" />

Whenever I try to use a resource from the dependency, the app crashes (exception below).

The build generates the following warning that I assume is directly related:

warning MT7091: The framework obj/Debug/net8.0-ios/iossimulator-arm64/onnxruntime.xcframework.zip/onnxruntime.xcframework/ios-arm64_x86_64-simulator/onnxruntime.framework is a framework of static libraries, and will not be copied to the app.

I don't understand why, and I'm running out of ideas to fix this.

Thank you in advance for any help 🙌

(Note: this was first briefly mentioned here dotnet/sdk#36527)

To Reproduce

I've created repo with the code: https://github.com/fdevillard/maui-onnx-crash

To reproduce:

  • run the app
  • click/press the "click me" button

Expected: "model loaded" is rendered in the button, showing the it has indeed been loaded

Behavior: the app crashes.

Exceptions

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Microsoft.ML.OnnxRuntime.NativeMethods' threw an exception.

 ---> System.DllNotFoundException: __Internal
   at Microsoft.ML.OnnxRuntime.NativeMethods..cctor()
   --- End of inner exception stack trace ---

   at Microsoft.ML.OnnxRuntime.SessionOptions..ctor()

Further technical details

  • Include the output of dotnet --info: 8.0.403
  • The IDE: VSCode 1.94.2
  • macOS: 14.7
  • iPhone simulator: version 16, iOS 18

Copied from original issue dotnet/sdk#44161

@rolfbjarne
Copy link
Member Author

From @nagilson on Tue, 15 Oct 2024 20:08:10 GMT

Not sure if this should be directed towards Maui or the Runtime team, but probably Maui?

@rolfbjarne
Copy link
Member Author

From @marcpopMSFT on Tue, 15 Oct 2024 20:15:00 GMT

@Redth @jonathanpeppers should this go to the Maui team and which repo should we route it to? That MT error code I think is from the simulator, right?

@rolfbjarne
Copy link
Member Author

From @jonathanpeppers on Tue, 15 Oct 2024 20:41:15 GMT

Do we have a way to move this to https://github.com/xamarin/xamarin-macios?

@rolfbjarne
Copy link
Member Author

From @nagilson on Tue, 15 Oct 2024 20:50:31 GMT

You cant unless you use some sort of bot to duplicate the issue.

@rolfbjarne
Copy link
Member Author

From @jonathanpeppers on Tue, 15 Oct 2024 21:11:00 GMT

Maybe @dalexsoto @rolfbjarne have a github issue mover tool to move it?

@rolfbjarne
Copy link
Member Author

Can you try adding this package, and see if that fixes it?

<PackageReference Include="Microsoft.ML.OnnxRuntime.Extensions.Dummy" Version="0.10.0-beta" />

@rolfbjarne rolfbjarne added this to the Future milestone Oct 17, 2024
@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Oct 17, 2024
@fdevillard
Copy link

Thank you for your help, it's really appreciated 🙌

I've tried this dependency (at 0.10.0-beta) as well as the latest version (0.12.0), and I still have the same symptoms / behavior.

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Oct 18, 2024
@rolfbjarne
Copy link
Member Author

I can reproduce a problem, but strangely it's not the problem you're seeing.

The problem I'm seeing is effectively a duplicate of #21294 - so hopefully this will be fixed once #21294 is fixed as well.

@rolfbjarne rolfbjarne self-assigned this Oct 22, 2024
@rolfbjarne rolfbjarne added bug If an issue is a bug or a pull request a bug fix and removed need-attention An issue requires our attention/response labels Oct 22, 2024
rolfbjarne added a commit that referenced this issue Oct 22, 2024
…rojects and as NativeReference items. Fixes #21294.

Now it's possible to reference a compressed xcframework like this:

```xml
<NativeReference Include="path/to/myframework.xcframework.zip" />
```

This makes it easier to work with xcframeworks on Windows, because
xcframeworks can contain symlinks, and by zipping them up the whole symlink
problem is avoided.

Turns out there's already a NuGet that adds a .xcframework.zip file as a
NativeReference (Microsoft.ML.OnnxRuntime), so this makes that NuGet work.

Fixes #21294.
Fixes #21450.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
2 participants