Help with esp32 build on linux

I have a project which I can’t get to compile. It fails trying to find “linux/can.h” . linux/can.h is in /usr/include on my system. Trouble is if I add libs_extr_dirs = /usr/include to platformio.ini, I get a lot more errors of different files missing?

… which project that compiles for ESP32 attempts to include a native linux file? It seems to me that either the code is extremely wrong or it’s trying to build a source file it’s not supposed to build (missing source filters in a library or project, or missing lib_ignore entirely).

Can you upload the project in question?

Thanks, my platformio.ini

The library https://github.com/thomasonw/NMEA2000_socketCAN is meant to only be compilable on Linux (primarily Raspberry Pi). How does that enter an ESP32 project?

Also referencing the project against all-master branches of the platform and Arduino-ESP32 is unstable and should at least be pinned to a commit if absolutely needed. Prefer stable versions.

OK, thanks.
platform and platform_packages settings comes from espressif’s suggested config.
NMEA2000_socketCAN should compile though.

Strongly disagreeing with Espressif here. Stable should be used instead of bleeding-edge, easily breakable stuff.

How? ESP-IDF doesn’t implement /dev/can0 and socket(PF_CAN, SOCK_RAW, CAN_RAW); (source) which is what this library is using. I would have expected using a library such as arduino-CAN to facilitate speaking to the ESP32’s CAN controller (and even then, it needs an external transceiver as the PHY).

Or, directly interacting with the TWAI driver as if it were ESP-IDF (esp-idf/examples/peripherals/twai/twai_network at release/v4.4 · espressif/esp-idf · GitHub). (“Since V4.x release of esp-idf, the can bus peripheral is now called the TWAI (Two-Wire Automotive Interface) by Espressif. It’s still the same peripheral”)

Good point, I know PF_CAN is the next problem. I will try arduino-CAN
thanks for the help.