ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

Not found e_sqlite3.dylib in ios-arm64 #590

Closed elagunas closed 3 months ago

elagunas commented 3 months ago

When we try to publish a maui application for ios platform with the next command:

dotnet publish -f net8.0-ios -c Release -r ios-arm64 -p:ArchiveOnBuild=true -p:CodesignKey="$(APPLE_CERTIFICATE_SIGNING_IDENTITY)"

Publication not works, because it doesn't found e_sqlite3.dylib in an obj subdirectory.

When the target platform, is android is not problem.

What version of SQLitePCLRaw are you using?

2.1.8

If you are using one of the SQLitePCLRaw bundle packages, which one?

<PackageReference Include="SQLitePCLRaw.core" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
 <PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.ios" Version="2.1.8" />

What platform are you running on? What operating system? Which version? What CPU?

macOS-13

What target framework are you building for?

ios-arm64

Are you on .NET Framework or the newer stuff (.NET Core, .NET 5+, etc)?

.NET 8

Are you using the command line, or an IDE? Which IDE? Which version of that IDE?

I reproduce the error in bash task with azure devops and a in a macbook.

Is this problem something that just started happening? For example, were things working well for you and then you updated something and then the problem showed up? What changed?

We try with different version an the result is the same

What is the exact error message you are seeing when the problem happens?

error: /Applications/Xcode_15.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: obj/Release/net8.0-ios/ios-arm64/nativelibraries//libe_sqlite3.dylib.tmp (No such file or directory)

Are you using PackageReference or packages.config?

PackageReference

If you are using mobile platforms, are you on classic/legacy Xamarin or on .NET 6 and higher?

Maui .net 8

ericsink commented 3 months ago

My first guess: Try removing all the SQLitePCLRaw packages except SQLitePCLRaw.bundle_green.

You have a bunch of different packages, and not all of them are compatible with your current target. This usually happens when folks migrate from packages.config, which didn't do transitive dependencies.

elagunas commented 3 months ago

Hello Eric, I've tried these scenarios:

Only with bundle_green

<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />

Both Core and bundle_green

<PackageReference Include="SQLitePCLRaw.core" Version="2.1.8" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />

Remove both and try only with sqlite-net-pcl, that has a dependecy with bundle_green

<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />

The error is the same:

error: /Applications/Xcode_15.1.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: obj/Release/net8.0-ios/ios-arm64/nativelibraries//libe_sqlite3.dylib.tmp (No such file or directory)

ericsink commented 3 months ago

There's something weird going on. When using bundle_green with iOS, e_sqlite3 is not in play. And even if it were, it would be a static lib, not a dylib.

Have you tried doing a complete purge of your obj and bin folders and then a full rebuild?

Is there some other package in your project with a dependency on SQLitePCLRaw?

elagunas commented 3 months ago

Finally, the problem was in another dependency https://www.nuget.org/packages/SQLiteNetExtensions/ that use a SQLitePCLRaw older version and generate the problem.

Thanks a lot for the support Eric