LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-28-2014, 03:56 AM   #1
burhaneyuboglu
LQ Newbie
 
Registered: Oct 2014
Posts: 14

Rep: Reputation: Disabled
.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?
 
Old 11-28-2014, 10:33 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
what does
Code:
file libcyusb.so
output ?
 
Old 11-29-2014, 10:05 AM   #3
burhaneyuboglu
LQ Newbie
 
Registered: Oct 2014
Posts: 14

Original Poster
Rep: Reputation: Disabled
libcyusb.so's output? It's a library which is written to wrap libusb library.
 
Old 11-30-2014, 04:09 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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 ?
 
Old 12-02-2014, 03:32 AM   #5
burhaneyuboglu
LQ Newbie
 
Registered: Oct 2014
Posts: 14

Original Poster
Rep: Reputation: Disabled
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?
 
Old 12-02-2014, 09:15 AM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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.
 
Old 12-02-2014, 09:22 AM   #7
burhaneyuboglu
LQ Newbie
 
Registered: Oct 2014
Posts: 14

Original Poster
Rep: Reputation: Disabled
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?
 
Old 12-02-2014, 09:39 AM   #8
burhaneyuboglu
LQ Newbie
 
Registered: Oct 2014
Posts: 14

Original Poster
Rep: Reputation: Disabled
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?
 
Old 12-02-2014, 05:55 PM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Compilation error - GSL library + MPI Benchmark Library = undefined reference quadpixels Programming 5 07-08-2012 03:33 AM
[SOLVED] ./configure problem for libsf library due to apparently missing libdb library. vectrum Linux - Software 6 08-05-2011 02:11 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration