clinuxcan-bussocketcan

Why isn't j1939.h include in the Ubuntu 18.04 Linux Kernel?


I am trying to use CAN J1939 standard on an embedded Linux system running Ubuntu 18.04, kernel 5.4.0-52-generic.

This elinux page indicates that j1939.h "got in the mainline kernel since v5.4". And kernel.org's documentation for j1939 implies that it is in the main kernel.

Lastly, I do have can-utils installed.

When I compile a cpp file with #include <linux/can/j1939.h>, I get a no such file or directory error.

I've gone through linux/can directory to confirm and j1939.h is not there. Is there any reason why my v5.4 kernel wouldn't have j1939.h? How can I best use j1939.h in my program?


Solution

  • You need development packages for these headers. You can search for which package you need on the Ubuntu Packages site. I.e. in this case packages containing j1939.h. You're probably looking for linux-libc-dev or linux-headers-5.4.0-26.