C code compiles on Virtual Machine with Ubuntu 18.04, not on Crouton: Struct redef error

47 Views Asked by At

I have a SDK for a camera that works without issue on Ubuntu 18.04 that I run through a virtual machine. I'm trying to get the camera to work on my chromebook, so I installed crouton. When I attempt to replicate the process on crouton, however, I receive error upon running make:

error: redefinition of 'struct sched_param'

Using same version of gcc in both cases.

1

There are 1 best solutions below

0
On

There isn't much information in your question (Which sources are you trying to compile? What is a minimal reproducer?), but the fix is probably along these lines. One of the source files uses

#include <linux/sched.h>

And you need to replace that with

#include <sched.h>

and make sure that you build with -D_GNU_SOURCE. I suspect you are trying to compile an older piece of code, and such mixed kernel/glibc header inclusions typically need to be cleaned up for old code.