徐德意博客


  • 首页

  • 归档

Mac交叉编译linux go-sqlite3错误

发表于 2019-02-25

交叉编译配置

1
2
3
4
export CGO_ENABLED=1
export GOOS=linux
export GOARCH=amd64
go build -o ./bin/example ./cmd/

错误详情

1
2
3
4
5
6
7
8
9
10
11
12
13
sqlite3-binding.c:32753:42: error: use of undeclared identifier 'pread64'
sqlite3-binding.c:32771:42: error: use of undeclared identifier 'pwrite64'
sqlite3-binding.c:32903:22: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
sqlite3-binding.c:32912:22: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
sqlite3-binding.c:32939:20: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
sqlite3-binding.c:32956:16: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
sqlite3-binding.c:14066:38: note: expanded from macro 'ArraySize'
sqlite3-binding.c:32960:14: error: invalid application of 'sizeof' to an incomplete type 'struct unix_syscall []'
sqlite3-binding.c:14066:38: note: expanded from macro 'ArraySize'
sqlite3-binding.c:35613:11: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
sqlite3-binding.c:32757:49: note: expanded from macro 'osPread64'
sqlite3-binding.c:35725:17: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
sqlite3-binding.c:32775:57: note: expanded from macro 'osPwrite64'

问题

Mac未安装linux的交叉编译器。解决方法,安装linux的交叉编译器

下载地址

Compiling for Linux 32 and Linux 64 on MacOS X

修改交叉编译配置

1
2
3
4
5
export CGO_ENABLED=1
export GOOS=linux
export GOARCH=amd64
export CC=/usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-gcc
go build -o ./bin/example ./cmd/

Hello World

发表于 2018-12-29

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

徐德意

2 日志
© 2019 徐德意
由 Hexo 强力驱动
|
主题 — NexT.Muse v5.1.4