broughtong / LibMercuryRFID

Library for interacting with the Mercury API RFID Library from Python
MIT License
4 stars 2 forks source link

Troubles compiling on Raspberry Pi Jessie #2

Open eheaton opened 8 years ago

eheaton commented 8 years ago

Hi there - I'm getting the following errors trying to compile this on Debian Jessie. Any ideas what might be causing it?

root@brl-raspi-01:~/LibMercuryRFID# make
gcc -fPIC -Wall -Werror -c -Isrc/lib/mercury/lib/LTK/LTKC/Library -Isrc/lib/mercury/lib/LTK/LTKC/Library/LLRP.org -Isrc/lib/mercury/ src/lib/libmercuryrfid.c -o build/lib/libmercuryrfid.o
src/lib/libmercuryrfid.c: In function ‘writeTagOLD’:
src/lib/libmercuryrfid.c:485:4: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Werror=format=]
    printf("Size of newEpcData %lu\n",sizeof(newEpcData) );
    ^
src/lib/libmercuryrfid.c:486:4: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ [-Werror=format=]
    printf("Size of newEpcData[0] %lu\n", sizeof(newEpcData[0]));
    ^
cc1: all warnings being treated as errors
Makefile:17: recipe for target 'build/lib/libmercuryrfid.o' failed
make: *** [build/lib/libmercuryrfid.o] Error 1

Maybe I'm missing a required dependency?

broughtong commented 8 years ago

Hi Eric,

Doesn't look like a missing dependancy, though I think I know what's causing this. I should be able to have a look at it tomorrow and sort it then :)

eheaton commented 8 years ago

Great, thanks!

eheaton commented 8 years ago

Hey @broughtong - Not sure if this is along the lines of what you were thinking, but we commented out the 2 lines that were throwing the error, and now we're seeing this issue (while running make by itself):

gcc -shared -Wall -Wl,-soname,libmercuryrfid.so.1 build/lib/libmercuryrfid.o build/lib/enums.o build/lib/queue.o -o build/lib/libmercuryrfid.so.1.0  -Isrc/lib/mercury/lib/LTK/LTKC/Library -Isrc/lib/mercury/lib/LTK/LTKC/Library/LLRP.org -Isrc/lib/mercury/ lib/libmercuryapi.so.1 -lpthread lib/libltkc.so.1 lib/libltkctm.so.1
lib/libmercuryapi.so.1: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'build/lib/libmercuryrfid.so.1.0' failed
make: *** [build/lib/libmercuryrfid.so.1.0] Error 1

Hope this helps. Thanks again for checking it out.

broughtong commented 8 years ago

Had a quick play around today, looks like this is caused by the .so.1 file being precompiled for x86 architecture, and the Raspberry Pi being ARM HF based is expecting it in a different format. What the Raspberry Pi needs to work is this file being compiled on the right architecture. I'm not sure how far I can go directly due to Licensing from ThingMagic, although if not i'll try put together a guide on how to do this on other architectures. Assuming their library itself works on ARM, this should be relatively straightforward.

eheaton commented 8 years ago

Thanks for the update George. If you could put together a guide, that'd be fantastic!

broughtong commented 8 years ago

Ok give this a try on the Raspberry Pi:

  1. Download the MercuryAPI directly from their website.
  2. Go into c/src/api
  3. Run make
  4. If its successful copy over the libmercuryapi.so.1and overwrite the existing one its having trouble with
  5. You may also need to grab the other 2 files as well, which will be in c/src/api/lib/LTK/LTKC/Library for libltkc.so.1 and same again but LTKC/Library/LLRP.org/libltkctm.so.1
  6. Copy these into LibMercuryRFID/lib
  7. Try re-make

I have a little trouble compiling the MercuryAPI due to problems with their code from variables being set but not used, although this is from a version from a few months ago so may be fixed by now. I just opened the makefile and removed '-wall'.

Give that a try a let me know how you get on!!

broughtong commented 8 years ago

I'll try see what I can do licensing wise for the future in terms of compilation of their source if this does turn out to fix the problem. Alternatively I could just compile an ARM version myself and upload that

gr87971 commented 7 years ago

Did anyone succeed making the Mercury API for Raspberry PI? Please, share it. I have followed the steps above but I got many errors. Thanks,