SqlCipher4Unity3D icon indicating copy to clipboard operation
SqlCipher4Unity3D copied to clipboard

Build for Apple Silicon (M1) -> sqlcipher.dll not found

Open DanielTizon opened this issue 3 years ago • 10 comments

Hi,

I'm getting sqlcipher.dll not found error when I build my app in Unity Editor (2021.1.23f1), using scripting backend "Mono", and selecting Architecture "Intel 64-Bit + Apple Silicon".

If you select Architecture "Intel 64-Bit", it works. But new Apple Macs are going to use M1 chipsets, so it would be nice to be able to build for this architecture,

Thanks!

DanielTizon avatar Oct 01 '21 06:10 DanielTizon

Thank you about your feedback. I am also eager to supply that platform build. But I don't have mac machine for that. I noticed someone is using github's workflow action for multi platform library. but I need to investing about that

netpyoung avatar Oct 08 '21 11:10 netpyoung

@DanielTizon Hi I built library for apple silicon(arm) using github action.

But as I mensioned, I don't have that machine. so Could you test that bundle using this?

netpyoung avatar Oct 26 '21 15:10 netpyoung

Yes, I will test it and tell you if it is working now,

Thanks!

DanielTizon avatar Oct 26 '21 19:10 DanielTizon

@netpyoung I'm trying test it, I just replaced macOS folder of plugins folder, but I am getting this error message when building:

Plugin 'sqlcipher.bundle' is used from several locations:
 Assets/SqlCipher4Unity3D/Plugins/macOS/arm64/sqlcipher.bundle would be copied to <PluginPath>/sqlcipher.bundle
 Assets/SqlCipher4Unity3D/Plugins/macOS/x86_64/sqlcipher.bundle would be copied to <PluginPath>/sqlcipher.bundle
 Assets/SqlCipher4Unity3D/Plugins/macOS/lipo/sqlcipher.bundle would be copied to <PluginPath>/sqlcipher.bundle
Please fix plugin settings and try again.'

DanielTizon avatar Oct 27 '21 19:10 DanielTizon

Well it seems problem to place duplicate bundle. lipo/sqlcipher.buldle itself contains x86_64 and arm64 both.

So Would you replace put lipo/sqlcipher.bulde to macOS/sqlcipher.bundle then remove other bundles?

netpyoung avatar Oct 27 '21 23:10 netpyoung

Hey netpyyoung,

I already tried it, and I am getting now this error:

Building /home/user/Downloads/game/mac/game.app/Contents/Frameworks/libmonobdwgc-2.0.dylib failed with output:
The properties of source file /home/user/Unity/Hub/Editor/2021.2.0f1/Editor/Data/PlaybackEngines/MacStandaloneSupport/Variations/macos_x64ARM64_player_nondevelopment_mono/UnityPlayer.app/Contents/Frameworks/libmonobdwgc-2.0.dylib could not be retrieved: No such file or directory

Building /home/user/Downloads/game/mac/game.app/Contents/Resources/unity default resources failed with output:
The properties of source file /home/user/Unity/Hub/Editor/2021.2.0f1/Editor/Data/PlaybackEngines/MacStandaloneSupport/Variations/macos_x64ARM64_player_nondevelopment_mono/UnityPlayer.app/Contents/Resources/unity default resources could not be retrieved: No such file or directory

Building /home/user/Downloads/game/mac/game.app/Contents/Frameworks/UnityPlayer.dylib failed with output:
System.ArgumentException: Copy() called on path that doesnt exist: /home/user/Unity/Hub/Editor/2021.2.0f1/Editor/Data/PlaybackEngines/MacStandaloneSupport/Variations/macos_x64ARM64_player_nondevelopment_mono/UnityPlayer.app/Contents/Frameworks/UnityPlayer.dylib
   at NiceIO.NPath.CopyWithDeterminedDestination(NPath destination, Func`2 fileFilter)
   at NiceIO.NPath.Copy(NPath dest, Func`2 fileFilter)
   at NiceIO.NPath.Copy(NPath dest)
   at MacOSCodeSignDylibCopy.Run(CSharpActionContext ctx, SignFlags signFlags)

DanielTizon avatar Nov 02 '21 09:11 DanielTizon

well. It seems like Unity Editor on Silicon does not stable. It looks like there are some issues on silicon

So In my opinion, It should be tested after they release suitable for handling this dylib.

netpyoung avatar Nov 04 '21 03:11 netpyoung

Hello @netpyoung ,

just to let you know that I tested your https://github.com/netpyoung/prebuilt-libsqlcipher/releases/download/v0.0.1/macos_ios_tvos.zip with Unity 2022.1.2f1 and it works! What I did:

  • I uninstalled SqlCipher4Unity3D from Unity Package Manager
  • I downloaded SqlCipher4Unity3D-1.3.0.unitypackage and opened it in my project
  • I removed content of SqlCipher4Unity3D/Plugins/macOS and copied there macOS/arm64 folder with sqlcipher.bundle from macos_ios_tvos.zip
  • I started the project and DllNotFoundException: sqlcipher assembly:<unknown assembly> type:<unknown type> member:(null) is gone and all works again

Would it be possible to bring this lib for Apple Silicon to the new release of SqlCipher4Unity3D so I can go back to UPM version?

Thank you very much!

nevadzask avatar Jun 01 '22 17:06 nevadzask

@nevadzask thank you for reporting that.

I'm not sure libsqlcipher's version problem or caused by https://github.com/netpyoung/prebuilt-libsqlcipher/pull/1 .

  • v0.0.1 used VERSION=v4.4.3 for sqlcipher but SqlCipher4Unity3D's release 1.3.0 used VERSION=v4.5.0.
  • v0.0.1 used CoreFoundation but PR instead used Foundation .

Would it be possible to bring this lib for Apple Silicon to the new release of SqlCipher4Unity3D so I can go back to UPM version?

well.... i used lipo command to compress all libs into one bundles. as I mentioned v0.0.1 used VERSION=v4.4.3 so It may cause some other issues.

netpyoung avatar Jun 03 '22 03:06 netpyoung