背景
上一篇文章中,我提到了三种jiao编译golang程序的方式。其中一种是, 在编译openwrt源代码的时候,加入golang的支持。openwrt-go是个不错的选择。这是一个github上的项目。
地址:《GeertJohan/openwrt-go》
一、下载代码
二、编译前的准备自己先安装好编译openwrt所需的一些依赖,包括build-essential,当然了也可以等到编译出错了才逐个安装。sudo apt-get installgit-core build-essential gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gawk asciidoc libz-dev libssl-dev
上面的不一定齐全。
2. 安装完之后,要配置一下。
新手麻烦自己看官方文档。《OpenWrt编译系统 – 安装》
3. 最关键的是配置关于golang的内容。#安装依赖
sudo apt-get install build-essential asciidoc binutils bzip2 gawk gettext git subversion libssl-dev libncurses5-dev patch unzip zlib1g-dev
#下载代码
git clone https://github.com/GeertJohan/openwrt-go
#切换分支
git checkout add-gccgo-and-libgo
#更新软件包列表
./scripts/feeds update