LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   .so library usage in Android Library (https://www.linuxquestions.org/questions/linux-software-2/so-library-usage-in-android-library-4175526726/)

burhaneyuboglu 11-28-2014 03:56 AM

.so library usage in Android Library
 
I want to use .so file in my Android Library, however when I try to use DLLImport, it gives that error:

libcyusb.so is not a valid elf.

As I understand, I should compile my libcyusb which should work on Android OS. Which command should I use in Makefile?

schneidz 11-28-2014 10:33 PM

what does
Code:

file libcyusb.so
output ?

burhaneyuboglu 11-29-2014 10:05 AM

libcyusb.so's output? It's a library which is written to wrap libusb library.

schneidz 11-30-2014 04:09 PM

please run the file command on your file to see what it really is. e.g.:
Code:

[schneidz@hyper ~]$ file /usr/lib/libXext.so.6.4.0
/usr/lib/libXext.so.6.4.0: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, stripped

i suspect that it is not really a shared object (you mention windows dll in your original post) or somehow corrupted ?

burhaneyuboglu 12-02-2014 03:32 AM

Yes you're right, the output is "linker to libusb.so.1".

When I file libusb.so.1, its output is ELF 64-bit shared object. As far as I know, I can not use directly libcyusb.so.1 because its suffix is .1.
So, how can I use libcyusb.so?

schneidz 12-02-2014 09:15 AM

i am not familiar with what you are trying to do but suffixes usually dont matter in linux. as long as the file is what it is expecting you can rename it to supercalifragilisticexpialidocious (what error are you getting ?).

also usually symbolic-links work as long as they refer to the correct item (thats kinda' the point of symbolic-links). but for the sake of crossing out variables maybe you can try importing the so.

burhaneyuboglu 12-02-2014 09:22 AM

I'm trying to use .so file in the Xamarin, that's why I use DLLImport statements. I'm trying to add native library in Android Library in Xamarin and also use this Android Library in Android Application Project in Xamarin.

Now, I import the .so file, not create any .so.1, .so.2 files.

g++ -fPIC -o lib/libcyusb.o -c lib/libcyusb.c
g++ -shared -o libcyusb.so lib/libcyusb.o

Those commands are true?
Now, the output of libcyusb.so :

libcyusb.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=eea583b4963ed7b949715e43f88714b58af23725, not stripped

Can I use it in Android Library in Xamarin?

burhaneyuboglu 12-02-2014 09:39 AM

Now, I used, it again gives the same error:

not a valid ELF executable

Is there problem with libcyusb.so? For example, 64 bit or x86-64?

schneidz 12-02-2014 05:55 PM

not sure. this sounds like a very specific problem to the ximiran program you mention. also the dll makes me think is supposed to run on windows ? you mite need to contract them for support.


All times are GMT -5. The time now is 10:00 PM.