-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys/can: fix compilation issues under native #21388
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
Conversation
|
Unrelated, but while you're working on CAN stuff, these lines can probably go? That doesn't do anything. Lines 357 to 360 in 87352ee
|
|
Super small nitpick: The commit message By the way: I like that you're writing an elaborate commit message for every commit 👍 |
|
I'm not sure if I'm following correctly, but And if I apply the "hack" from the The package is included when RIOT/boards/common/native/Makefile.dep Lines 11 to 13 in 87352ee
|
Yes it does,
That is correct. But an application may be interested in the can header only without That you cannot use the diff --git a/examples/basic/hello-world/Makefile b/examples/basic/hello-world/Makefile
index ad1fa6fdcb..790ab0ee52 100644
--- a/examples/basic/hello-world/Makefile
+++ b/examples/basic/hello-world/Makefile
@@ -15,4 +15,6 @@ DEVELHELP ?= 1
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1
+USEMODULE += can
+
include $(RIOTBASE)/Makefile.include
diff --git a/examples/basic/hello-world/main.c b/examples/basic/hello-world/main.c
index 213128ac64..db17103b17 100644
--- a/examples/basic/hello-world/main.c
+++ b/examples/basic/hello-world/main.c
@@ -21,6 +21,8 @@
#include <stdio.h>
+#include "can/can.h"
+
int main(void)
{
puts("Hello World!");And then |
As @Enoch247 could confirm that the nitty-gritty details will be handled by the underlying FD-CAN implementation on Linux, I added a commit to just define this to So all in all, CAN on |
|
The changes seem reasonable to me, but I'm really neither familiar with the CAN subsystem nor with native, so a Soft-ACK from my side. Perhaps someone else can take a look at it too. |
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.
Looks good. Only one minor nit.
This simply strips the include path to the posix compat headers from the includes, but at the level of the local `Makefile` (so without side effects on other modules/packages). Since libsocketcan is only ever used on native, this should be fine.
Since `can.h` is including `libsocketcan.h` on `native%`, we need to depend on that package. Co-authored-by: crasbe <crasbe@gmail.com>
Drop dead statement
The native CAN implementation relies on the underlying OS to implement CAN, so we can leave handling the nitty-gritty details such as the loop delay to the underlying implementation.
|
Thx :-) |
Contribution description
This fixes two related compilation issues when using the
canmodule under native:can/can.hfrom thecanmodule includeslibsocketcan.hfrom thelibsocketcanpackage onnative%, but does not depend on it. The missing dep is addedlibsocketcanpackage does not compile with theposix_headerspackage is used, as it really needs to include the host headers. TheINCLUDESvariable is stripped of the posix headers include path locally within the package'sMakefile(so with no side-effect on other packages and modules).Testing procedure
Will fail spectacularly on
master, but work fine with this PR.Issues/PRs references
None