Mac交叉编译linux文件错误

1,084 阅读1分钟

1.错误重现:

error: use of undeclared identifier 'pread64'
error: use of undeclared identifier 'pwrite64'
error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
note: expanded from macro 'ArraySize'
error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
note: expanded from macro 'ArraySize'
warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
note: expanded from macro 'osPread64'
warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
note: expanded from macro 'osPwrite64'

交叉编译报错一般是由于环境缺失造成的,所以补全后即可顺利编译。

2.安装针对mac编译linux的Gcc编译器

3.指定编译参数:

export CC=/usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-gcc