-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/cbor: fix compilation with newlib #7783
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could better model this. As a (pseudo-)module (e. g. posix_time
) for instance.
sys/cbor/Makefile
Outdated
@@ -2,6 +2,8 @@ MODULE = cbor | |||
|
|||
ifneq ($(shell uname -s),Darwin) | |||
CFLAGS += -D_XOPEN_SOURCE=600 | |||
else | |||
CFLAGS += -D_GNU_SOURCE=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why non-Darvin only? Is OSX not using newlib for cross-compiling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is not a OS X related issue, but gcc-arm-none-eabi libc (and maybe also avr-gcc, cannot test because my compiler is broken).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But uname - s
returns info about the host system, not the toolchain in use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, let me check why it works then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non darwin guard was to prevent multiple definition: e867d83e
However the test only made sense for native.
I also had the problem with arm-gcc 4.9.4
, but not with 6.3.1 anymore.
The new GNU_SOURCE you set is only done for Darwin (it is an ifneq). So it does not fixes linux + arm-gcc 4.9.4.
As far as I understand this is not a POSIX function but a GNU extension, thus, I don't think this should be a POSIX pseudo module. |
At least the latest POSIX spec defines it |
Well, the conclusion of my tests are:
I pushed a fixup which defines |
Does it work if you define |
@gebart not sure... From the glibc doc (couldn't find anything for newlib with my quick search):
|
Hmm... I suppose I should remove the merge commit is it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, please rebase so that the merge commit disappears.
(and squash your own ;-)) |
Squashed and rearranged commits. |
Go! |
Please provide backport ;-) |
Backport provided and already merged in #7819 |
Fixes #7411 and maybe #7287.
In some arm-none-eabi-gcc libc
strptime
in<time.h>
is guarded by__GNU_VISIBLE
define, which is defined while setting the define_GNU_SOURCE
, otherwisestrptime
is not defined and thus any usage of it fails to compile.This is the case in cbor, which doesn't include
<time.h>
explicitly, as well as setting the define_GNU_SOURCE
is missing.This PR fixes that.