I am trying to cross compile an application using OSX. However, when I compile I get the following...
fatal error: 'linux/types.h' file not found
When I change to sys/types.h and now I get...
error: unknown type name '__s32'
unknown type name '__u8'
unknown type name '__u16'
etc
Can someone help me with how to handle this?
Obviously a Linux-specific header file is not going to be present under MacOS/X, which is not Linux-based.
The easiest work-around for the problem would be to go through your program and replace all the instances of
#include "linux/types.h"
with this:
#include "my_linux_types.h"
... and write a new header file named my_linux_types.h and add it to your project; it would look something like this:
#ifndef my_linux_types_h
#define my_linux_types_h
#ifdef __linux__
# include "linux/types.h"
#else
# include <stdint.h>
typedef int32_t __s32;
typedef uint8_t __u8;
typedef uint16_t __u16;
[... and so on for whatever other types your program uses ...]
#endif
#endif
Those headers are headers that the kernel uses. Probably, the problem is in the implementation and definitions of such header files across platforms (Linux vs Mac OS in our case) The POSIX definitions don't apply to the kernel, but rather to the system calls it exposes to the user space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With