Commit 597e716
authored
[installer] extra copy of libMonoPosixHelper.dylib for libZipSharp.dll (#5471)
Context: https://github.com/jonathanpeppers/foo/blob/Microsoft.NET.Sdk/foo.csproj
I've been experimenting with trying to multi-target "legacy"
Xamarin.Android and .NET 6 with:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>monoandroid11.0;net6.0-android</TargetFrameworks>
</PropertyGroup>
</Project>
I got this to work fairly well on Windows with some hacks, but it
completely fails on macOS:
error XACML7000: System.DllNotFoundException: Unable to load shared library 'MonoPosixHelper' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libMonoPosixHelper, 1): image not found
error XACML7000: at Mono.Unix.Native.Syscall.lstat(String file_name, Stat& buf)
error XACML7000: at Xamarin.Tools.Zip.Utilities.StatFile(String path, Boolean followSymlinks, Stat& sbuf) in /Users/runner/work/1/s/Utilities.Unix.cs:line 58
error XACML7000: at Xamarin.Tools.Zip.Utilities.GetFileType(String path, Boolean followSymlinks, FilePermissions& fileType) in /Users/runner/work/1/s/Utilities.Unix.cs:line 147
error XACML7000: at Xamarin.Tools.Zip.UnixPlatformServices.IsFileOfType(String path, FilePermissions mode, Boolean& result) in /Users/runner/work/1/s/UnixPlatformServices.cs:line 428
error XACML7000: at Xamarin.Tools.Zip.UnixPlatformServices.IsDirectory(ZipArchive archive, String path, Boolean& result) in /Users/runner/work/1/s/UnixPlatformServices.cs:line 40
error XACML7000: at Xamarin.Tools.Zip.PlatformServices.<>c__DisplayClass9_0.<IsDirectory>b__0(IPlatformServices services) in /Users/runner/work/1/s/PlatformServices.cs:line 73
error XACML7000: at Xamarin.Tools.Zip.PlatformServices.CallServices(Func`2 code) in /Users/runner/work/1/s/PlatformServices.cs:line 165
error XACML7000: at Xamarin.Tools.Zip.PlatformServices.IsDirectory(ZipArchive archive, String path) in /Users/runner/work/1/s/PlatformServices.cs:line 73
error XACML7000: at Xamarin.Tools.Zip.ZipArchive.AddFile(String sourcePath, String archivePath, EntryPermissions permissions, CompressionMethod compressionMethod, Boolean overwriteExisting) in /Users/runner/work/1/s/ZipArchive.cs:line 397
error XACML7000: at Xamarin.Android.Tasks.ZipArchiveEx.AddFiles(String folder, String folderInArchive, CompressionMethod method)
error XACML7000: at Xamarin.Android.Tasks.ZipArchiveEx.AddDirectory(String folder, String folderInArchive, CompressionMethod method)
error XACML7000: at Xamarin.Android.Tasks.CreateManagedLibraryResourceArchive.<>c__DisplayClass39_0.<RunTask>b__0(String f)
error XACML7000: at Xamarin.Android.Tools.Files.ArchiveZipUpdate(String target, Action`1 archiver)
error XACML7000: at Xamarin.Android.Tasks.CreateManagedLibraryResourceArchive.RunTask()
error XACML7000: at Xamarin.Android.Tasks.AndroidTask.Execute()
Comparing a regular .NET 6 build, it works because
`libMonoPosixHelper.dylib` is sitting right next to `libZipSharp.dll`.
Comparing a regular "legacy" Xamarin.Android build, it works because
`libMonoPosixHelper.dylib` is loaded via:
Mono: DllImport loaded library '/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/../lib/libMonoPosixHelper.dylib'
We're *lucky* this works, as it is using a Mono system
`libMonoPosixHelper.dylib` instead of the one from Xamarin.Android.
I could solve the problem locally by running:
cd /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild/Xamarin/Android/lib/host-Darwin/
sudo cp libMonoPosixHelper.dylib ../../
I updated our installer to include the copy of
`libMonoPosixHelper.dylib` that `libZipSharp.dll` expects.1 parent 16e0aa2 commit 597e716
File tree
3 files changed
+8
-11
lines changed- build-tools
- create-packs
- installers
- src/Xamarin.Android.Build.Tasks
3 files changed
+8
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 24 | | |
29 | 25 | | |
30 | 26 | | |
| |||
49 | 45 | | |
50 | 46 | | |
51 | 47 | | |
52 | | - | |
53 | 48 | | |
54 | 49 | | |
55 | 50 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | 51 | | |
63 | 52 | | |
64 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
363 | 365 | | |
364 | 366 | | |
365 | 367 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
370 | 376 | | |
371 | 377 | | |
372 | 378 | | |
| |||
0 commit comments