Skip to content

Instantly share code, notes, and snippets.

@cxfksword
Created June 1, 2017 05:34
Show Gist options
  • Save cxfksword/65225dfc54a8053791ea77be0ec9a32b to your computer and use it in GitHub Desktop.
Save cxfksword/65225dfc54a8053791ea77be0ec9a32b to your computer and use it in GitHub Desktop.
xgo交叉编译说明
#!/bin/bash
apt-get install -y libpcap0.8-dev
mkdir -p /libpcap
apt-get download libpcap0.8-dev
dpkg -x libpcap0.8-dev_*_amd64.deb /libpcap/amd64
rm libpcap0.8-dev*.deb
[ ! -f WpdPack_4_1_2.zip ] && wget https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip
unzip WpdPack_4_1_2.zip -d /libpcap/win
[ ! -f wpcap.dll ] && wget https://github.com/cxfksword/beats/raw/master/dev-tools/packer/docker/xgo-image/beats-builder/wpcap.dll
cp wpcap.dll /libpcap/win/
apt-get install mingw-w64-tools
cd /libpcap/win
gendef /libpcap/win/wpcap.dll
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib /libpcap/win/WpdPack/Lib/x64/libwpcap.a --input-def wpcap.def
#!/bin/bash
rm -rf /deps
TARGETS=linux/amd64 /build.sh github.com/cxfksword/beats/packetbeat
rm -rf /deps
TARGETS=windows/amd64 /build.sh github.com/cxfksword/beats/packetbeat
#!/bin/bash
# 下载镜像xgo-latest
# 添加镜像到docker列表
# 安装go
# 登陆docker
docker run -it --entrypoint /bin/bash -v /go/src/:/go/src -v /build:/build karalabe/xgo-latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment