This topic is old, but I found a hacky workaround I would like to share (note: I am no docker expert).
TL;DR: I precompiled the driver on my host build machine and copied the installation to the docker filesystem. This way at least I can combile code inside docker (I have not tried running the driver!).
Code: Select all
# On your local pc where you usually compile the code:
mkdir -p deploy
make DESTDIR=/home/martin/Downloads/peak-linux-driver-8.3/deploy install
# Patch pcanfd.h cannot find sys/time.h when compiling inside the docker container!
# /usr/include/pcanfd.h:124:17: error: field ‘timestamp’ has incomplete type ‘timeval’
diff --git a/usr/include/pcanfd.h b/usr/include/pcanfd.h
index 17f2b2e..9b43db8 100644
@@ -30,6 +30,8 @@
/* enable to define types including array with 0, 1 or more items */
#define __array_of_struct(_n, _x) \
# Manually install to docker for testing:
docker cp deploy/ <CONTAINER ID>:/tmp/
# Inside the docker container: fake install the driver:
cp -r /tmp/deploy/* /
This of course can be automated in your Dockerfile. With this the driver is "pseudo" installed, so that at least I can build code compiling against the includes.
As stated above, hacky workaround, but at least the code compiles.