Ensure macOS build includes the required runtime library#382
Conversation
|
Thanks a lot for the PR! osx-universal is a universal library that bundles both osx-arm64 and osx-x64. The alternative would be to include osx-arm64 and osx-x64 and at runtime (in Unity) figure out which mac architecture to use. What errors do you see with the universal library? |
|
Thank you for the review. I built the application on a MacBook Pro (M2 Max, Apple silicon) and when I ran it, I got the following error: The build target architecture is set to Intel 64-bit + Apple silicon. Based on the error message, I think that when running on Apple silicon hardware, the runtime selects the arm64 library, but since it is not bundled in the build, it fails and results in this error. |
|
You are right! Could you remove completely the line and then also modify here libraryFileNames.Add("libllamalib_osx-x64_acc.dylib");
libraryFileNames.Add("libllamalib_osx-x64_no-acc.dylib");
libraryFileNames.Add("libllamalib_osx-arm64_acc.dylib");
libraryFileNames.Add("libllamalib_osx-arm64_no-acc.dylib");I will then test it as soon as possible, merge it, and create a new release! |
|
Thank you for the review! |
|
Awesome, thank you! |
|
Merged it for the upcoming patch release, thank you for the fix! |
|
Thank you for merging it! |
Hello,
I always find LLMUnity extremely easy to use and really appreciate your work.
I created this PR because when I build for macOS and launch the app, it fails with an error and does not run.
I believe the cause is a mismatch between the libraries bundled at build time and the library selected at runtime.
Specifically, the following code specifies the runtime library to load:
https://github.com/undreamai/LLMUnity/blob/main/Runtime/LlamaLib/LlamaLib.cs#L684-L687
(it uses osx-arm64 for Apple Silicon and osx-x64 for Intel)
However, the build-time library selection below bundles osx-universal, which leads to the mismatch:
https://github.com/undreamai/LLMUnity/blob/main/Runtime/LLMBuilder.cs#L210-L212
To address this, I added osx-arm64 and osx-x64 to the list of libraries bundled during the build. Since this is an additive change, I believe the only side effect is an increase in the macOS build size.
I would be grateful if you could consider merging it.
Thank you and best regards.