Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for build errors #96

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fixes for build errors #96

wants to merge 4 commits into from

Conversation

ribalda
Copy link

@ribalda ribalda commented Sep 18, 2018

No description provided.

SloCompTech
SloCompTech previously approved these changes Sep 19, 2018
Copy link
Contributor

@SloCompTech SloCompTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built library and found out that mentioned warnings, errors are fixed in this pull request.

@@ -9,5 +9,9 @@
#cmakedefine HAVE_BYTESWAP_H @_HAVE_BYTESWAP_H@
#cmakedefine HAVE_COREFOUNDATION_COREFOUNDATION_H @_HAVE_COREFOUNDATION_COREFOUNDATION_H@

#ifdef HAVE_ENDIAN_H
#define _DEFAULT_SOURCE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this macro and why is it necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is needed to since glib 2.19, otherwise we get a implicit declaration function

(Sorry I did not get any notification of this...)

@@ -1,4 +1,6 @@
set(EXAMPLES-SOURCES
felica-lite-dump
felica-read-ndef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace is different for these lines compared to other lines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

ribalda and others added 4 commits April 15, 2020 15:24
felica-lite-dump, felica-read-ndef and mifare-ultralightc-diversify were
present on autoconf but not on cmake

Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Fixes warning:

Scanning dependencies of target freefare
[  1%] Building C object libfreefare/CMakeFiles/freefare.dir/felica.c.o
/tmp/libfreefare/libfreefare/felica.c: In function ‘felica_tag_new’:
/tmp/libfreefare/libfreefare/felica.c:50:16: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
     if ((tag = malloc(sizeof(struct felica_tag)))) {
                ^~~~~~
/tmp/libfreefare/libfreefare/felica.c:50:16: warning: incompatible implicit declaration of built-in function ‘malloc’
/tmp/libfreefare/libfreefare/felica.c:50:16: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
/tmp/libfreefare/libfreefare/felica.c:26:1:
+#include <stdlib.h>

/tmp/libfreefare/libfreefare/felica.c:50:16:
     if ((tag = malloc(sizeof(struct felica_tag)))) {
                ^~~~~~
/tmp/libfreefare/libfreefare/felica.c: In function ‘felica_tag_free’:
/tmp/libfreefare/libfreefare/felica.c:64:5: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
     free(tag);
     ^~~~
/tmp/libfreefare/libfreefare/felica.c:64:5: warning: incompatible implicit declaration of built-in function ‘free’
/tmp/libfreefare/libfreefare/felica.c:64:5: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’

Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
From man be32toh:

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       htobe16(),  htole16(),  be16toh(),  le16toh(),  htobe32(),  htole32(),  be32toh(),   le32toh(),
       htobe64(), htole64(), be64toh(), le64toh():
           Since glibc 2.19:
               _DEFAULT_SOURCE
           In glibc up to and including 2.19:
               _BSD_SOURCE

Fixes build error:

[ 59%] Building C object examples/CMakeFiles/felica-read-ndef.dir/felica-read-ndef.c.o
/tmp/libfreefare/examples/felica-read-ndef.c: In function ‘main’:
/tmp/libfreefare/examples/felica-read-ndef.c:113:21: warning: implicit declaration of function ‘be32toh’ [-Wimplicit-function-declaration]
    payload_length = be32toh(*(uint32_t *)(ndef_record + 2));
                     ^~~~~~~
[ 61%] Linking C executable felica-read-ndef
/usr/bin/ld: CMakeFiles/felica-read-ndef.dir/felica-read-ndef.c.o: in function `main':
felica-read-ndef.c:(.text+0x319): undefined reference to `be32toh'
collect2: error: ld returned 1 exit status

Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants