<div dir="ltr">When I add libcyusb.so, I got this error: "libcyusb.so is not a valid ELF executable"<div><br></div><div>I checked the library, libcyusb.so is not ELF, it is a linker, however libcyusb.so.1 is ELF 64 bit sharerd object. How can add libcyusb.so.1? Because android accepts lib prefix and so suffix.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-28 12:32 GMT+02:00 Burhan Eyuboglu <span dir="ltr"><<a href="mailto:burhaneyuboglu@gmail.com" target="_blank">burhaneyuboglu@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Now, I can add .so file into the csproj. However, a new error occured:<br></div>libcyusb.so is not a valid ELF. <br><br></div>I think while building libcyusb in linux, I should add Android as target OS. Is that true? If it is, how can I add it to the makefile? Do you know the commands for it?<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2014-11-26 19:36 GMT+02:00 Rafael Teixeira <span dir="ltr"><<a href="mailto:monoman@gmail.com" target="_blank">monoman@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think you'll need to add it to the application. I'm not sure Android will let you install the native lib in any valid place afterwards, like extracting it from an embedded resource and writing to a file, but I might be wrong... Wait for the experts to chime in...<div><div><br><br><div class="gmail_quote">On Wed Nov 26 2014 at 3:05:25 PM Burhan Eyuboglu <<a href="mailto:burhaneyuboglu@gmail.com" target="_blank">burhaneyuboglu@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is <AndroidNativeLibrary> valid for adding .so file to AndroidLibraryProject? I m not trying to add it to AndroidApplication<span></span><br><br>26 Kasım 2014 Çarşamba tarihinde, Rafael Teixeira <<a href="mailto:monoman@gmail.com" target="_blank">monoman@gmail.com</a>> yazdı:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It should be <AndroidNativeLibrary Include="Resources\lib\armeabi-v7a\libcyusb.so" />, that is what Jonathan meant by choosing the action (you can change it on the properties window when selecting the item in the solution explorer), also it is not a good thing to put it inside the Resources folder, it is not an embeddable resource, it will be packed in the apk not in the managed dll.<br><br><div class="gmail_quote">On Wed Nov 26 2014 at 2:08:39 PM Burhan Eyuboglu <<a>burhaneyuboglu@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div><br></div><div><br></div><div>I have created a lib file in the resources folder, and armeabi-v7a folder in the lib file and put the libcyusb.so there. When I look at the csproj file, it has changed like that:</div><div><br></div><div><div><ItemGroup></div><div>    <AndroidEmbeddedJavaLibrary Include="Resources\lib\armeabi-v7a\libcyusb.so" /></div></div><div><br></div><div><br></div><div>However, I'm still getting " can not load dll" error:</div><div><br></div><div><div>[monodroid-debug] Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=<a href="http://127.0.0.1:8852" target="_blank">127.0.0.1:8852</a>,server=y,embedding=1</div><div>[libc] WARNING: generic atexit() called from legacy shared library</div><div>[Mono] Image addref mscorlib[0x5ac6bfe0] -> mscorlib.dll[0x5ace0fa0]: 1</div><div>[Mono] AOT module '<a href="http://mscorlib.dll.so" target="_blank">mscorlib.dll.so</a>' not found: Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/<a href="http://mscorlib.dll.so" target="_blank">mscorlib.dll.so</a>" not found</div><div>[Mono] Assembly mscorlib[0x5ac6bfe0] added to domain RootDomain, ref_count=1</div><div>[Mono] Assembly Loader probing location: '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll'.</div><div>[Mono] Image addref LibraryDenemesi[0x5c771638] -> /storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll[0x5bb190f0]: 2</div><div>[Mono] Assembly LibraryDenemesi[0x5c771638] added to domain RootDomain, ref_count=1</div><div>[Mono] AOT module '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/<a href="http://LibraryDenemesi.dll.so" target="_blank">LibraryDenemesi.dll.so</a>' not found: Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/<a href="http://LibraryDenemesi.dll.so" target="_blank">LibraryDenemesi.dll.so</a>" not found</div><div>[Mono] Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll'.</div><div>[Mono] Config attempting to parse: '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/LibraryDenemesi.dll.config'.</div><div>[Mono] Config attempting to parse: '/Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/LibraryDenemesi/LibraryDenemesi.config'.</div><div>[Mono] Image addref CypressLibrary[0x5ac25fb0] -> CypressLibrary.dll[0x5bb1a420]: 1</div><div>[Mono] Assembly CypressLibrary[0x5ac25fb0] added to domain RootDomain, ref_count=1</div><div>[Mono] AOT module '<a href="http://CypressLibrary.dll.so" target="_blank">CypressLibrary.dll.so</a>' not found: Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/<a href="http://CypressLibrary.dll.so" target="_blank">CypressLibrary.dll.so</a>" not found</div><div>[monodroid-gc] GREF GC Threshold: 46800</div><div>[Mono] Image addref Mono.Android[0x5aa93670] -> Mono.Android.dll[0x5ace36c8]: 1</div><div>[Mono] Assembly Mono.Android[0x5aa93670] added to domain RootDomain, ref_count=1</div><div>[Mono] AOT module '<a href="http://Mono.Android.dll.so" target="_blank">Mono.Android.dll.so</a>' not found: Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/<a href="http://Mono.Android.dll.so" target="_blank">Mono.Android.dll.so</a>" not found</div><div>[Mono] Assembly Ref addref Mono.Android[0x5aa93670] -> mscorlib[0x5ac6bfe0]: 2</div><div>[Mono] Image addref System.Core[0x5aceeb28] -> System.Core.dll[0x59bb3240]: 1</div><div>[Mono] Assembly System.Core[0x5aceeb28] added to domain RootDomain, ref_count=1</div><div>[Mono] AOT module '<a href="http://System.Core.dll.so" target="_blank">System.Core.dll.so</a>' not found: Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/<a href="http://System.Core.dll.so" target="_blank">System.Core.dll.so</a>" not found</div><div>[Mono] Assembly Ref addref Mono.Android[0x5aa93670] -> System.Core[0x5aceeb28]: 2</div><div>[Mono] Assembly Ref addref System.Core[0x5aceeb28] -> mscorlib[0x5ac6bfe0]: 3</div><div>[Mono] Assembly Ref addref LibraryDenemesi[0x5c771638] -> Mono.Android[0x5aa93670]: 2</div><div>[Mono] DllImport attempting to load: '__Internal'.</div><div>[Mono] DllImport loaded library '(null)'.</div><div>[Mono] DllImport searching in: '__Internal' ('(null)').</div><div>[Mono] Searching for '_monodroid_gc_wait_for_bridge_processing'.</div><div>[Mono] Probing '_monodroid_gc_wait_for_bridge_processing'.</div><div>[Mono] Found as '_monodroid_gc_wait_for_bridge_processing'.</div><div>[Mono] DllImport searching in: '__Internal' ('(null)').</div><div>[Mono] Searching for '_monodroid_get_identity_hash_code'.</div><div>[Mono] Probing '_monodroid_get_identity_hash_code'.</div><div>[Mono] Found as '_monodroid_get_identity_hash_code'.</div><div>Loaded assembly: MonoDroidConstructors [External]</div><div>[Mono] Assembly Ref addref LibraryDenemesi[0x5c771638] -> mscorlib[0x5ac6bfe0]: 4</div><div>[Mono] DllImport searching in: '__Internal' ('(null)').</div><div>[Mono] Searching for '_monodroid_gref_log_new'.</div><div>[Mono] Probing '_monodroid_gref_log_new'.</div><div>[Mono] Found as '_monodroid_gref_log_new'.</div><div>[Mono] Assembly Loader probing location: '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll'.</div><div>[Mono] Image addref CypressDenemeLibrary[0x5f6dd4f8] -> /storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll[0x5f6dd150]: 2</div><div>[Mono] Assembly CypressDenemeLibrary[0x5f6dd4f8] added to domain RootDomain, ref_count=1</div><div>[Mono] AOT module '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/<a href="http://CypressDenemeLibrary.dll.so" target="_blank">CypressDenemeLibrary.dll.so</a>' not found: Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/<a href="http://CypressDenemeLibrary.dll.so" target="_blank">CypressDenemeLibrary.dll.so</a>" not found</div><div>[Mono] Assembly Loader loaded assembly from location: '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll'.</div><div>[Mono] Config attempting to parse: '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll.config'.</div><div>[Mono] Config attempting to parse: '/Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/builds/install/mono-armv7/etc/mono/assemblies/CypressDenemeLibrary/CypressDenemeLibrary.config'.</div><div>[Mono] Assembly Ref addref LibraryDenemesi[0x5c771638] -> CypressDenemeLibrary[0x5f6dd4f8]: 2</div><div>[Mono] Assembly Ref addref CypressDenemeLibrary[0x5f6dd4f8] -> mscorlib[0x5ac6bfe0]: 5</div><div>[Mono] DllImport attempting to load: 'libcyusb.so'.</div><div>[Mono] DllImport error loading library '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] DllImport unable to load library 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>Loaded assembly: /storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/CypressDenemeLibrary.dll [External]</div><div>[MoreInfoHPW_ViewGroup] Parent view is not a TextView</div><div>[Mono] DllImport searching in: '__Internal' ('(null)').</div><div>[Mono] Searching for '_monodroid_gref_log_delete'.</div><div>[Mono] Probing '_monodroid_gref_log_delete'.</div><div>[Mono] Found as '_monodroid_gref_log_delete'.</div><div>[Mono] DllImport attempting to load: 'libcyusb.so'.</div><div>[Mono] DllImport error loading library '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library '/storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib//storage/emulated/0/Android/data/LibraryDenemesi.LibraryDenemesi/files/.__override__/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] DllImport error loading library 'libcyusb.so': 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] DllImport unable to load library 'Cannot load library: load_library(linker.cpp:746): library "/data/data/LibraryDenemesi.LibraryDenemesi/lib/libcyusb.so" not found'.</div><div>[Mono] Assembly Ref addref CypressDenemeLibrary[0x5f6dd4f8] -> Mono.Android[0x5aa93670]: 3</div><div>[Mono] DllImport attempting to load: '/system/lib/liblog.so'.</div><div>[Mono] DllImport loaded library '/system/lib/liblog.so'.</div><div>[Mono] DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').</div><div>[Mono] Searching for '__android_log_print'.</div><div>[Mono] Probing '__android_log_print'.</div><div>[Mono] Found as '__android_log_print'.</div><div>System.DllNotFoundException: libcyusb.so</div><div>  at (wrapper managed-to-native) DataDeneme:libusb_init ()</div><div>  at LibraryDenemesi.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0004e] in c:\Users\Sercan\Documents\Projects\LibraryDenemesi\LibraryDenemesi\MainActivity.cs:34 </div><div>[libEGL] loaded /system/lib/egl/libEGL_mali.so</div><div>[libEGL] loaded /system/lib/egl/libGLESv1_CM_mali.so</div><div>[libEGL] loaded /system/lib/egl/libGLESv2_mali.so</div><div>[] Device driver API match</div><div>[] Device driver API version: 17</div><div>[] User space API version: 17 </div><div>[] mali: REVISION=Linux-r3p1-01rel1 BUILD_DATE=Fri May 10 18:36:49 KST 2013 </div><div>[OpenGLRenderer] Enabling debug mode 0</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-11-26 12:28 GMT+02:00 Burhan Eyuboglu <span dir="ltr"><<a>burhaneyuboglu@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Jonathan Pryor</b> <span dir="ltr"><<a>jonpryor@vt.edu</a>></span><br>Date: 2014-11-25 17:47 GMT+02:00<br>Subject: Re: [Mono-dev] Using .so file in Android Library Project and then using it in an Android App<br>To: Burhan Eyuboglu <<a>burhaneyuboglu@gmail.com</a>><br><br><br><span>On Nov 25, 2014, at 7:17 AM, Burhan Eyuboglu <<a>burhaneyuboglu@gmail.com</a>> wrote:<br>
> I was trying to import with wrong name : "cylibusb". My library's name is libcyusb.so.<br>
> You said that libcyusb.so should be in the .apk files in the previous mails, however I open the apk files (armeabi-v7a) and copy the libcyusb.so into them and run the application,then it gives same error and when I look at apk files after runining, there is no libcyusb.so in them.<br>
><br>
> How can I put libcyusb.so to the lib/armeabi-v7a?<br>
<br>
</span>You need to add libcyusb.so to your project with a Build action of AndroidNativeLibrary.<br>
<br>
When adding libcyusb.so to your project, it must be located in a directory that matches the ABI, e.g. you should have a native-libs\armeabi-v7a\libcyusb.so file, and add that file to your project with a Build action of AndroidNativeLibrary.<br>
<br>
 - Jon</div><div class="gmail_quote"><br></div><div class="gmail_quote">
<br>
</div></div></div><span style="font-family:arial,sans-serif;font-size:13px">I need .so file with AndroidLibraryProject not with AndroidApplicationProject, and in the AndroidLibraryProject, there is no lib or lib/armeabi-v7a folder. Where can I put libcyusb.so?</span><br></div>
</blockquote></div><br></div>
______________________________<u></u>_________________<br>
Mono-devel-list mailing list<br>
<a>Mono-devel-list@lists.ximian.<u></u>com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_blank">http://lists.ximian.com/<u></u>mailman/listinfo/mono-devel-<u></u>list</a><br>
</blockquote></div>
</blockquote>
</blockquote></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>