This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

missing PF_CAN AF_CAN

Other Parts Discussed in Thread: AM3517

Another discussion that will hopefully save someone else some time.

The linux-devkit toolchain in the version 05.02.00.00 SDK has a problem with missing definitions for AF_CAN and PF_CAN.

I'm starting to work with the CAN interface on my am3517 EVM, and trying to use the socketCAN interface to communicate with it.

Building a simple test program to open a socketCAN socket and bind to it, compilation failed due to missing these definitions.

I am building in code composer studio and can see in the includes section in project explorer under my project, all the include paths are in linux-devkit.

find . -name socket.h turns up all of these, which I then grep to see which have socket family definitions:

grep AF_INET usr/include/netlink/socket.h
grep AF_INET usr/include/sys/socket.h
grep AF_INET usr/include/linux/socket.h
grep AF_INET usr/include/bits/socket.h
grep AF_INET usr/include/asm-generic/socket.h
grep AF_INET usr/include/asm/socket.h

only 2 have AF_INET definitions, do they have AF_CAN?

grep AF_CAN usr/include/linux/socket.h
grep AF_CAN usr/include/bits/socket.h

My project includes linux/socket.h but some tricky ifdef'ing apparently prevents it from defining those constants.

And bits/socket.h is missing them.  So it had to be the culprit.

I added the definitions there, and the build worked.