Reverse engineering things is part of the fun in working with Linux. Irritation and frustation are the work-hazards in these environments. I encountered such a 'fun' situation when trying to compile a PCSC app for smart card reader communication in Mac OS X.
The normal libraries linked with apps for smartcard communication are the pthread and the pcsclite libraries. All is well with pthread library being present in /usr/lib directory. But, I cudnt find the pcsclite library which will normally be available in /usr/local/lib in other linux distributions. I 'grep'ed from root to bottom and got only binary files' links.
There started my reverse-lookup work. After much search, I fell upon the otool command. On running this command with the pre-existing pcsctest tool, i fell upon the following..
/usr/bin/pcsctest:
/System/Library/Frameworks/PCSC.framework/Versions/A/PCSC
(compatibility version 1.0.0, current version 31.0.0)
/usr/lib/libSystem.B.dylib (compatibility version
1.0.0, current version 88.0.0)
Using this as a backbone, I compiled my utility as follows
gcc -o lint pcscutil.c
-I /System/Library/Frameworks/PCSC.framework/Headers/
-lpthread
-L/System/Library/Frameworks/PCSC.framework/Versions/A/
-framework PCSC
Voila!! it compiled!!!. What was the problem in the first place? All SCard command for the pcsc apps are defined in the pcsclite library. Here in Mac OS, they have been put into the PCSC framework and hence needs to be linked as "-framework" and not as a library. THAT is the secret!!!
PS: I used pcsc daemon version 1.1.2, which comes bundled with the Mac OS X (10.4 darwin).
No comments:
Post a Comment