You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was having some trouble with compiling the felica-read-ndef example when I ran make, and I also was getting some missing symbol errors [1] when executing mifare-desfire-info after adding a mifare_desfire_read_data call to the example. After a bit of debugging, I think I've found the answer.
felica-read-ndef
Problem
Uses be32toh, but only has conditional includes for sys/endian.h and endian.h. I can't speak to if the examples should be cross platform, but I figure if they're in the repo, probably?
freefare_internal.h uses if !defined(le32toh) && defined(CFSwapInt32LittleToHost) to determine if it needs to define the le32toh macro, but I was checking "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFByteOrder.h" and (on macOS Sierra) it has CF_INLINE uint32_t CFSwapInt32BigToHost(uint32_t arg) {, which appears to be inlining as a function, instead of a macro, and I think that means defined doesn't work on it[2]. I say "appears", "think", etc because I do not know C or libfreefare very well, so there may be gaping holes in my logic or understanding.
Solution
I just reused the same macro that was used to determine if the CoreFoundation header would be included in the first place.
Adds a patch to resolve this upstream issue: nfc-tools/libfreefare#55
This patch can be removed when libfreefare releases a new version with
the associated pull request included.
I was having some trouble with compiling the felica-read-ndef example when I ran
make
, and I also was getting some missing symbol errors [1] when executingmifare-desfire-info
after adding amifare_desfire_read_data
call to the example. After a bit of debugging, I think I've found the answer.felica-read-ndef
Problem
Uses
be32toh
, but only has conditional includes forsys/endian.h
andendian.h
. I can't speak to if the examples should be cross platform, but I figure if they're in the repo, probably?Solution
Symbol not found: _le16toh
Problem
This is a lot like #31 .
freefare_internal.h
usesif !defined(le32toh) && defined(CFSwapInt32LittleToHost)
to determine if it needs to define thele32toh
macro, but I was checking "/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFByteOrder.h" and (on macOS Sierra) it hasCF_INLINE uint32_t CFSwapInt32BigToHost(uint32_t arg) {
, which appears to be inlining as a function, instead of a macro, and I think that meansdefined
doesn't work on it[2]. I say "appears", "think", etc because I do not know C or libfreefare very well, so there may be gaping holes in my logic or understanding.Solution
I just reused the same macro that was used to determine if the CoreFoundation header would be included in the first place.
[1]
[2]https://gcc.gnu.org/onlinedocs/cpp/Defined.html
The text was updated successfully, but these errors were encountered: