Skip to content

building xamarin-android fails on Ubuntu 16.04 (System.DllNotFoundException: lib64/libzip.so) #4100

Closed

Description

@janusw

Steps to Reproduce

  1. git clone https://github.com/xamarin/xamarin-android.git
  2. cd xamarin-android
  3. make prepare
  4. make

Expected Behavior

make should run through without errors.

Actual Behavior

The build process fails after a while. There are several warnings here and there, but the first actual error seems to be:

AfterBuild:
  CheckApiCompatibility for ApiLevel: v10.0
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018: The "CheckApiCompatibility" task failed unexpectedly. [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018: System.DllNotFoundException: lib64/libzip.so assembly:<unknown assembly> type:<unknown type> member:(null) [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at (wrapper managed-to-native) Xamarin.Tools.Zip.Native.zip_open(intptr,Xamarin.Tools.Zip.OpenFlags,Xamarin.Tools.Zip.ErrorCode&) [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Tools.Zip.Native.zip_open (System.String path, Xamarin.Tools.Zip.OpenFlags flags, Xamarin.Tools.Zip.ErrorCode& errorp) [0x00007] in /Users/runner/runners/2.160.0/work/1/s/Native.cs:84  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.Open (System.String path, Xamarin.Tools.Zip.OpenFlags flags) [0x00009] in /Users/runner/runners/2.160.0/work/1/s/ZipArchive.cs:158  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.Open (System.String path, System.IO.FileMode mode, System.String defaultExtractionDir, System.Boolean strictConsistencyChecks, Xamarin.Tools.Zip.IPlatformOptions options) [0x0005a] in /Users/runner/runners/2.160.0/work/1/s/ZipArchive.cs:229  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Android.Tools.BootstrapTasks.CheckApiCompatibility.Execute () [0x00169] in /home/janus/github/xamarin-android/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs:98  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <b695b16788dd418cbe8b4d98f7a92ff3>:0  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <b695b16788dd418cbe8b4d98f7a92ff3>:0  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
Done Building Project "/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj" (default targets) -- FAILED.

Version Information

  • xamarin-android version: master as of 2020-01-08 (commit 9530fd0)
  • OS: Ubuntu Linux 16.04 (xenial)
  • Mono version: 6.4.0.198
  • msbuild version: Microsoft (R)-Build-Engine, Version 16.3.0-ci für Mono

Log File

If necessary I can attach the full build log or provide further information. Please let me know what exactly is needed ...

Activity

  1. janusw commented on Jan 8, 2020

    @janusw
    ContributorAuthor

    Note: make prepare has been failing on Ubunt 16.04 until recently, but works now (after #4082 has been fixed).

  2. janusw commented on Jan 8, 2020

    @janusw
    ContributorAuthor

    libzip.so exists on my system in the following paths:

    /home/janus/android-toolchain/jdk/jre/lib/amd64/libzip.so
    /opt/android-studio/jre/jre/lib/amd64/libzip.so
    /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libzip.so
    /usr/lib/x86_64-linux-gnu/libzip.so
    

    Apart from those, it also exists twice in the xamarin-android build directory:

    /home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so
    /home/janus/github/xamarin-android/bin/BuildDebug/libzip.so
    

    The first of those two is the the only instance where it lives inside a lib64 directory, as indicated in the error.

    Thus I would conclude that the file is present. I'm not sure why it isn't found.

  3. added this to the Under Consideration milestone on Jan 9, 2020
  4. dellis1972 commented on Jan 9, 2020

    @dellis1972
    Contributor

    I'll try to repo this issue on a Linux VM I have.
    In the mean time it might be useful to get some diagnostics from mono as to where it is trying to load the libzip.so file from.

    When doing the make step can you try the following

    MONO_LOG_LEVEL=debug make
    

    this will produce a HUGE amount of data. But around where the error is raised you might be able to see where mono is searching for the native library.

  5. added
    need-info
    on Jan 9, 2020
  6. janusw commented on Jan 9, 2020

    @janusw
    ContributorAuthor

    When doing the make step can you try the following

    MONO_LOG_LEVEL=debug make
    

    this will produce a HUGE amount of data. But around where the error is raised you might be able to see where mono is searching for the native library.

    Thanks for the hint, and here you go:

    AfterBuild:
      CheckApiCompatibility for ApiLevel: v10.0
    Mono: AOT NOT FOUND: (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr).
    Mono: DllImport attempting to load: 'lib64/libzip.so'.
    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport unable to load library 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport attempting to load: '__Internal'.
    Mono: DllImport loaded library '(null)'.
    Mono: DllImport searching in: '__Internal' ('(null)').
    Mono: Searching for 'SetDllDirectory'.
    Mono: Probing 'SetDllDirectory'.
    Mono: Could not find 'SetDllDirectory' due to '/usr/bin/mono: undefined symbol: SetDllDirectory'.
    Mono: Probing 'SetDllDirectoryA'.
    Mono: Could not find 'SetDllDirectoryA' due to '/usr/bin/mono: undefined symbol: SetDllDirectoryA'.
    Mono: Probing 'SetDllDirectory'.
    Mono: Could not find 'SetDllDirectory' due to '/usr/bin/mono: undefined symbol: SetDllDirectory'.
    Mono: Probing 'SetDllDirectoryA'.
    Mono: Could not find 'SetDllDirectoryA' due to '/usr/bin/mono: undefined symbol: SetDllDirectoryA'.
    Mono: AOT: FOUND method System.DateTime:.ctor (int,int,int,int,int,int,int,System.DateTimeKind) [0x7fa81db16a70 - 0x7fa81db16c04 0x7fa81e047e37]
    Mono: DllImport attempting to load: 'lib64/libzip.so'.
    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport error loading library 'lib64/libzip.so': 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: DllImport unable to load library 'lib64/libzip.so: cannot open shared object file: No such file or directory'.
    Mono: AOT: FOUND method System.DllNotFoundException:.ctor () [0x7fa81db1fea0 - 0x7fa81db1fedc 0x7fa81e048276]
    Mono: AOT: FOUND method System.TypeLoadException:.ctor (string) [0x7fa81dbf9510 - 0x7fa81dbf954f 0x7fa81e04bea0]
    Mono: AOT NOT FOUND: (wrapper managed-to-native) object:__icall_wrapper_mono_string_new_wrapper_internal (intptr).
    Mono: mono_w32handle_ref_core: ref Event handle 0x1c4cc38, ref: 1 -> 2
    Mono: ves_icall_System_Threading_Events_SetEvent_internal: setting Event handle 0x1c4cc38
    Mono: mono_w32handle_unref_core: unref Event handle 0x1c4cc38, ref: 2 -> 1 destroy: false
    Mono: mono_w32handle_lock_handles: Locked all handles
    Mono: mono_w32handle_lock_handles: Locked all handles
    Mono: mono_w32handle_lock_handles: Locked all handles
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_timedwait_signal: waiting for global
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_lock_handles: Locked all handles
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_timedwait_signal: waiting for global
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_lock_handles: Locked all handles
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_timedwait_signal: waiting for global
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x4 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_timedwait_signal: waiting for global
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_test_capabilities: testing 0x3 against 0x8 (0)
    Mono: mono_w32handle_timedwait_signal: waiting for global
    Mono: AOT: FOUND method System.Exception:ToString () [0x7fa81dbeb0b0 - 0x7fa81dbeb0e4 0x7fa81e04b7b6]
    Mono: AOT: FOUND method System.Exception:ToString (bool,bool) [0x7fa81dbeb0f0 - 0x7fa81dbeb2e9 0x7fa81e04b7ba]
    Mono: AOT: FOUND method System.TypeLoadException:get_Message () [0x7fa81dbf95a0 - 0x7fa81dbf95d2 0x7fa81e04bea2]
    Mono: AOT: FOUND method System.TypeLoadException:SetMessageField () [0x7fa81dbf95e0 - 0x7fa81dbf9719 0x7fa81e04bea3]
    Mono: AOT: FOUND method System.Exception:GetClassName () [0x7fa81dbeacb0 - 0x7fa81dbead18 0x7fa81e04b784]
    Mono: AOT: FOUND method System.Exception:GetStackTrace (bool) [0x7fa81dbeae60 - 0x7fa81dbeaeed 0x7fa81e04b79b]
    Mono: AOT: FOUND method System.Environment:GetStackTrace (System.Exception,bool) [0x7fa81dc03890 - 0x7fa81dc03935 0x7fa81e04c25c]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:.ctor (System.Exception,bool) [0x7fa81df656e0 - 0x7fa81df65720 0x7fa81e05ff36]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:.ctor (System.Exception,int,bool) [0x7fa81df65760 - 0x7fa81df6585d 0x7fa81e05ff38]
    Mono: AOT NOT FOUND: (wrapper managed-to-native) System.Diagnostics.StackTrace:get_trace (System.Exception,int,bool).
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:ToString (System.Diagnostics.StackTrace/TraceFormat) [0x7fa81df669f0 - 0x7fa81df66a1e 0x7fa81e05ff99]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:ToString () [0x7fa81df66870 - 0x7fa81df669ef 0x7fa81e05ff94]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:AddFrames (System.Text.StringBuilder,bool,bool&) [0x7fa81df65cd0 - 0x7fa81df661a8 0x7fa81e05ff53]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:get_FrameCount () [0x7fa81df65980 - 0x7fa81df659a9 0x7fa81e05ff3f]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:GetFrame (int) [0x7fa81df659b0 - 0x7fa81df65a23 0x7fa81e05ff40]
    Mono: AOT: FOUND method System.Diagnostics.StackFrame:GetMethod () [0x7fa81df651b0 - 0x7fa81df651c4 0x7fa81e05ff13]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:GetFullNameForStackTrace (System.Text.StringBuilder,System.Reflection.MethodBase,bool,bool&,bool&) [0x7fa81df661b0 - 0x7fa81df66622 0x7fa81e05ff6e]
    Mono: AOT: FOUND method System.Reflection.CustomAttributeExtensions:IsDefined (System.Reflection.MemberInfo,System.Type) [0x7fa81de0bef0 - 0x7fa81de0bf28 0x7fa81e059311]
    Mono: AOT: FOUND method System.Attribute:IsDefined (System.Reflection.MemberInfo,System.Type) [0x7fa81dbde730 - 0x7fa81dbde76d 0x7fa81e04b361]
    Mono: AOT: FOUND method System.Attribute:IsDefined (System.Reflection.MemberInfo,System.Type,bool) [0x7fa81dbde770 - 0x7fa81dbde94a 0x7fa81e04b362]
    Mono: AOT: FOUND method System.Reflection.MethodInfo:get_MemberType () [0x7fa81de00230 - 0x7fa81de0023e 0x7fa81e058e40]
    Mono: AOT: FOUND method System.Reflection.ParameterInfo:get_Name () [0x7fa81de01a20 - 0x7fa81de01a34 0x7fa81e058f71]
    Mono: AOT: FOUND method System.Diagnostics.StackFrame:GetILOffset () [0x7fa81df65190 - 0x7fa81df651a4 0x7fa81e05ff12]
    Mono: AOT: FOUND method System.Text.StringBuilder:AppendFormat (string,object) [0x7fa81dc9d230 - 0x7fa81dc9d2d1 0x7fa81e04fdd6]
    Mono: AOT: FOUND method System.Number:TryInt32ToHexStr (int,char,int,System.Span`1<char>,int&) [0x7fa81db58740 - 0x7fa81db588c3 0x7fa81e049037]
    Mono: AOT: FOUND method System.Diagnostics.StackFrame:GetSecureFileName () [0x7fa81df650f0 - 0x7fa81df6518b 0x7fa81e05ff0e]
    Mono: AOT: FOUND method System.Diagnostics.StackFrame:GetFileName () [0x7fa81df650d0 - 0x7fa81df650e4 0x7fa81e05ff0d]
    Mono: AOT: FOUND method System.Diagnostics.StackFrame:GetFileLineNumber () [0x7fa81df65090 - 0x7fa81df650a4 0x7fa81e05ff0b]
    Mono: AOT: FOUND method System.Reflection.RuntimeMethodInfo:get_Module () [0x7fa81de16850 - 0x7fa81de1687a 0x7fa81e05968a]
    Mono: AOT: FOUND method System.Reflection.RuntimeMethodInfo:GetRuntimeModule () [0x7fa81de16b00 - 0x7fa81de16b75 0x7fa81e05969c]
    Mono: AOT: FOUND method System.Reflection.RuntimeModule:get_ModuleVersionId () [0x7fa81de19890 - 0x7fa81de198ef 0x7fa81e059758]
    Mono: AOT: FOUND method System.Reflection.RuntimeModule:GetModuleVersionId () [0x7fa81de1a980 - 0x7fa81de1aa43 0x7fa81e05979b]
    Mono: AOT NOT FOUND: (wrapper managed-to-native) System.Reflection.RuntimeModule:GetGuidInternal (intptr,byte[]).
    Mono: AOT: FOUND method System.Guid:.ctor (byte[]) [0x7fa81db36dd0 - 0x7fa81db36eaf 0x7fa81e048857]
    Mono: AOT: FOUND method System.Guid:.ctor (System.ReadOnlySpan`1<byte>) [0x7fa81db36eb0 - 0x7fa81db3717c 0x7fa81e04885b]
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:GetAotId () [0x7fa81df65be0 - 0x7fa81df65ccb 0x7fa81e05ff47]
    Mono: AOT: FOUND method System.Reflection.RuntimeAssembly:GetAotId () [0x7fa81de13750 - 0x7fa81de1379d 0x7fa81e0595b7]
    Mono: AOT NOT FOUND: (wrapper managed-to-native) System.Reflection.RuntimeAssembly:GetAotIdInternal (byte[]).
    Mono: AOT: FOUND method System.Diagnostics.StackTrace:ConvertAsyncStateMachineMethod (System.Reflection.MethodBase&,System.Type&) [0x7fa81df66630 - 0x7fa81df6686f 0x7fa81e05ff89]
    Mono: AOT: FOUND method System.Reflection.CustomAttributeExtensions:GetCustomAttributes<T> (System.Reflection.MemberInfo) [0x7fa81de0bc50 - 0x7fa81de0bcab 0x7fa81e059309]
    Mono: AOT: FOUND method System.Reflection.CustomAttributeExtensions:GetCustomAttributes (System.Reflection.MemberInfo,System.Type) [0x7fa81de0bb10 - 0x7fa81de0bb44 0x7fa81e059305]
    Mono: AOT: FOUND method System.Attribute:GetCustomAttributes (System.Reflection.MemberInfo,System.Type) [0x7fa81dbde320 - 0x7fa81dbde359 0x7fa81e04b345]
    Mono: AOT: FOUND method System.Reflection.RuntimeMethodInfo:GetCustomAttributes (System.Type,bool) [0x7fa81de176a0 - 0x7fa81de176de 0x7fa81e0596cb]
    Mono: AOT: FOUND method System.Runtime.CompilerServices.AsyncStateMachineAttribute:.ctor (System.Type) [0x7fa81dddc0b0 - 0x7fa81dddc0e9 0x7fa81e0581ad]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018: The "CheckApiCompatibility" task failed unexpectedly. [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018: System.DllNotFoundException: lib64/libzip.so assembly:<unknown assembly> type:<unknown type> member:(null) [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at (wrapper managed-to-native) Xamarin.Tools.Zip.Native.zip_open(intptr,Xamarin.Tools.Zip.OpenFlags,Xamarin.Tools.Zip.ErrorCode&) [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Tools.Zip.Native.zip_open (System.String path, Xamarin.Tools.Zip.OpenFlags flags, Xamarin.Tools.Zip.ErrorCode& errorp) [0x00007] in /Users/runner/runners/2.160.0/work/1/s/Native.cs:84  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.Open (System.String path, Xamarin.Tools.Zip.OpenFlags flags) [0x00009] in /Users/runner/runners/2.160.0/work/1/s/ZipArchive.cs:158  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Tools.Zip.ZipArchive.Open (System.String path, System.IO.FileMode mode, System.String defaultExtractionDir, System.Boolean strictConsistencyChecks, Xamarin.Tools.Zip.IPlatformOptions options) [0x0005a] in /Users/runner/runners/2.160.0/work/1/s/ZipArchive.cs:229  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Xamarin.Android.Tools.BootstrapTasks.CheckApiCompatibility.Execute () [0x00169] in /home/janus/github/xamarin-android/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs:98  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <b695b16788dd418cbe8b4d98f7a92ff3>:0  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    /home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.targets(175,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <b695b16788dd418cbe8b4d98f7a92ff3>:0  [/home/janus/github/xamarin-android/src/Mono.Android/Mono.Android.csproj]
    
  7. janusw commented on Jan 9, 2020

    @janusw
    ContributorAuthor

    Taking a closer look at this log snippet, the first relevant error seems to be:

    Mono: DllImport error loading library '/home/janus/github/xamarin-android/bin/BuildDebug/lib64/libzip.so': 'libcrypto.so.1.1: cannot open shared object file: No such file or directory'.
    

    The only libcrypto.so* on my entire system is ...

    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
    

    ... and there is no libcryto in the build folder.

    Apart from this, there is also a second error that might be relevant:

    Mono: DllImport error loading library '/usr/lib/lib64/libzip.so': '/usr/lib/lib64/libzip.so: cannot open shared object file: No such file or directory'.
    

    There is no folder /usr/lib/lib64 on Ubuntu 16.04.

  8. dellis1972 commented on Jan 10, 2020

    @dellis1972
    Contributor

    I just tried to repo this on Ubuntu 18.04 and did not get the same issue.
    You are running on a 64 bit machine right?

    I also have /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 on my machine.

    So the other thing to do is the check all its dependencies are installed, can you check the results of the following.

    ldd bin/BuildDebug/lib64/libzip.so
    

    you should get something like

    linux-vdso.so.1 (0x00007ffec453e000)
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f98454ff000)
    	libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f98452ef000)
    	libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f9844e24000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9844a33000)
    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f984482f000)
    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9844610000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007f984593c000)
    

    It will let you know if any of those are missing. It might also be worth checking the 32 bit version too

    ldd bin/BuildDebug/libzip.so
    
  9. janusw commented on Jan 10, 2020

    @janusw
    ContributorAuthor

    I just tried to repo this on Ubuntu 18.04 and did not get the same issue.

    Are you saying that you can build xamarin-android on bionic without errors? Or that you get different errors?

    You are running on a 64 bit machine right?

    Yes, x86_64-linux-gnu.

    ldd bin/BuildDebug/lib64/libzip.so

    	linux-vdso.so.1 =>  (0x00007ffd757ca000)
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007feba7463000)
    	libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007feba7253000)
    	libcrypto.so.1.1 => not found
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feba6e89000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007feba789d000)
    

    ldd bin/BuildDebug/libzip.so

    	linux-gate.so.1 =>  (0xf7f27000)
    	libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7ec6000)
    	libcrypto.so.1.1 => not found
    	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7d10000)
    	/lib/ld-linux.so.2 (0xf7f29000)
    

    Apparently both have a wrong reference to libcrypto.so.1.1. My system only has libcrypto.so.1.0.0.

    Note that my Ubuntu-provided libzip has no reference to libcrypto at all:

    $ ldd /usr/lib/x86_64-linux-gnu/libzip.so
    	linux-vdso.so.1 =>  (0x00007ffd785c5000)
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1af39c9000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1af35ff000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007f1af3df6000)
    
    
  10. dellis1972 commented on Jan 10, 2020

    @dellis1972
    Contributor

    I managed to build the entire repo without any issues (apart from missing java in my PATH).
    ok so its definitely libcrypto.so. Which is odd because I have that 1.1 version of that installed.
    Do you need to run sudo apt-get update and sudo apt-get upgrade ?

  11. janusw commented on Jan 10, 2020

    @janusw
    ContributorAuthor

    I managed to build the entire repo without any issues (apart from missing java in my PATH).

    Good to know. Maybe I should just update from 16.04 to 18.04, in order to make my life easier. OTOH Ubuntu 16.04 will still be supported for more than a year, so it would be great if xamarin-android could be convinced to build on that system.

    ok so its definitely libcrypto.so. Which is odd because I have that 1.1 version of that installed.

    What's so odd about that? You have 18.04 with libcryto 1.1 and the build succeeds, while I have 16.04 with libcrypto 1.0 and the build fails (since xamarin-android seems to expect version 1.1?).

    Do you need to run sudo apt-get update and sudo apt-get upgrade ?

    No, all packages are up to date.

  12. janusw commented on Jan 10, 2020

    @janusw
    ContributorAuthor

    Investigating a bit further:

    • on Ubuntu 16.04, libcrypto.so.1.0.0 comes from the package libssl1.0.0
    • on Ubuntu 18.04, libcrypto.so.1.1 comes from the package libssl1.1

    Since xamarin-android currently seems to require libssl1.1, that probably should be checked in make prepare at least. Or maybe one can even make the build work with libssl1.0.0 as well?

  13. grendello commented on Jan 10, 2020

    @grendello
    Contributor

    Since libzip.so comes from the nuget, we must simply link libcrypto statically into it and make sure that libzip.so dynamically references only libc. This will make the library the most compatible with any distro that has the same libc version.

  14. janusw commented on Jan 11, 2020

    @janusw
    ContributorAuthor

    Since libzip.so comes from the nuget

    This one? https://www.nuget.org/packages/libzip/

    we must simply link libcrypto statically into it and make sure that libzip.so dynamically references only libc.

    As an alternative, how about relying on Ubuntu's libzip.so? (On Ubuntu 16.04, apt has the package libzip4 in version 1.0.1; on 18.04, the version is 1.1.2.) This will also make sure that all dynamical references are present.

  15. grendello commented on Jan 13, 2020

    @grendello
    Contributor

    @janusw we used to rely on the OS copy of libzip but it poses a number of problems. First, we can't rely on libzip.so being there - it would exist only if the user installed the development packages. Second, only the latest distributions have libzip.so.5, the older ones have libzip.so.4 and dealing with this is way too involved to justify. Linking libcrypto statically into libzip (or even dropping encryption support completely, perhaps) is the easiest way to deal with it.

  16. dellis1972 commented on Jan 13, 2020

    @dellis1972
    Contributor

    I created a new issue on our LibZipSharp repo so track this issue. This is because we ship libzip as part of the LibZipSharp Nuget Package. We will close that upstream issue once we have published a new version, then use this issue to track upgrading the Nuget Package within Xamarin.Android.

    dotnet/android-libzipsharp#42

  17. dellis1972 commented on Jan 13, 2020

    @dellis1972
    Contributor
  18. janusw commented on Jan 13, 2020

    @janusw
    ContributorAuthor

    @janusw we used to rely on the OS copy of libzip but it poses a number of problems. First, we can't rely on libzip.so being there - it would exist only if the user installed the development packages.

    Well, it seems like make prepare currently does include a check for exactly that (libzip-dev). This is the output I see on Ubuntu 16.04:

    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Ensuring all required programs are installed
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    
    TODO: Implement 'package refresh' mode where we reinstall packages/programs forcibly
          From: Xamarin.Android.Prepare.OS+<EnsureDependencies>d__110.MoveNext at /home/janus/github/xamarin-android/build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs(263,4)
    Checking autoconf             [FOUND 2.69]
    Checking autotools-dev        [FOUND 20150820.1]
    Checking automake             [FOUND 1.15]
    Checking cmake                [FOUND 3.5.1]
    Checking build-essential      [FOUND 12.1ubuntu2]
    Checking curl                 [FOUND 7.47.0]
    Checking gcc                  [FOUND 5.4.0]
    Checking g++                  [FOUND 5.4.0]
    Checking g++-mingw-w64        [FOUND 5.3.1-8ubuntu3+17]
    Checking gcc-mingw-w64        [FOUND 5.3.1-8ubuntu3+17]
    Checking git                  [FOUND 2.7.4]
    Checking libncurses5-dev      [FOUND 6.0+20160213-1ubuntu1]
    Checking libtool              [FOUND 0.0.0]
    Checking libz-mingw-w64-dev   [FOUND 1.2.8+dfsg-2]
    Checking libzip-dev           [FOUND 1.0.1-0ubuntu1]
    Checking linux-libc-dev       [FOUND 4.4.0-171.2004.4.0-171.200]
    Checking make                 [FOUND 4.1]
    Checking ninja-build          [FOUND 1.5.1]
    Checking p7zip-full           [FOUND 9.20]
    Checking sqlite3              [FOUND 3.11.0]
    Checking vim-common           [FOUND 2:7.4.1689-3ubuntu1.3]
    Checking zlib1g-dev           [FOUND 1:1.2.8.dfsg-2ubuntu4.11:1.2.8.dfsg-2ubuntu4.1]
    Checking linux-libc-dev:i386  [FOUND 4.4.0-171.200]
    Checking zlib1g-dev:i386      [FOUND 1:1.2.8.dfsg-2ubuntu4.1]
    Checking libx32tinfo-dev      [FOUND 6.0+20160213-1ubuntu1]
    

    So, if you guys decide that depending on LibZipSharp instead of the system libzip is the way to go, then I guess this check could be removed? Or is there another reason why it is required?

  19. dellis1972 commented on Jan 13, 2020

    @dellis1972
    Contributor

    libzip-dev was being referenced because we used to build libzip.so as part of the Xamarin.android repo. However we recently moved all of that over to the LibZipSharp Repo and Nuget Package so the other projects can make use of it. This is just left over from the old process, it will be removed in the near future.

  20. grendello commented on Jan 14, 2020

    @grendello
    Contributor

    #4122 removes dependency on libzip-dev for Linux distros based on Debian

  21. janusw commented on Jan 16, 2020

    @janusw
    ContributorAuthor

    #4122 removes dependency on libzip-dev for Linux distros based on Debian

    Thanks!

    Since dotnet/android-libzipsharp#44 has been merged already, I guess we're now waiting for dotnet/android-libzipsharp#45, so that we have a new release of LibZipSharp, which can be used in xamarin-android ...

  22. added a commit that references this issue on Jan 20, 2020
    e8d1ca8
  23. added a commit that references this issue on Jan 21, 2020
    3ae6f25
  24. removed
    need-info
    on Mar 17, 2020
  25. ghost locked as resolved and limited conversation to collaborators on Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions