The Things Network LoRaWAN Stack V3 学习笔记 1.2 源码编译 - 190821
文章目录
- 前言
- 1 依赖包替换
- 2 编译准备
- 3 编译
- 3.1 cli 编译
- 3.2 stack 编译
- 3.3 前端编译
- END
前言
源码编译是重头戏,这节笔记记录如何使用 make 命令编译相关部件。由于部分包在墙外,带来了一点麻烦,还分享一个 GO 翻墙利器。
此前已经分享了一篇相同笔记,但由于时间又过去了半年,部分命令已做了调整,遂更新一篇。
小能手这段时间在学习 The Things Network LoRaWAN Stack V3,从使用和代码等角度对该 Stack 进行了分析,详细可点此查看。
1 依赖包替换
TTN Stack V3 采用了 go moudles 来进行包依赖管理。我们可以看到工程目录下,存在着一个 go.mod,记录了整个工程的依赖包。
我们使用 go mod download 命令,来下载依赖包。
ubuntu@VM-0-6-ubuntu:~/lorawan-stack$ go mod download
go: finding github.com/kamilsk/retry/v4 v4.0.0
go: cloud.google.com/go@v0.36.0: unrecognized import path "cloud.google.com/go" (https fetch: Get https://cloud.google.com/go?go-get=1: dial tcp 172.217.163.238:443: i/o timeout)
go: cloud.google.com/go@v0.34.0: unrecognized import path "cloud.google.com/go" (https fetch: Get https://cloud.google.com/go?go-get=1: dial tcp 172.217.163.238:443: i/o timeout)
go: golang.org/x/sys@v0.0.0-20190209173611-3b5209105503: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/sys@v0.0.0-20180909124046-d0be0721c37e: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/sys@v0.0.0-20181011152604-fa43e7bc11ba: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/genproto@v0.0.0-20190201180003-4b09977fb922: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/genproto@v0.0.0-20181016170114-94acd270e44e: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/sync@v0.0.0-20180314180146-1d60e4601c6f: unrecognized import path "golang.org/x/sync" (https fetch: Get https://golang.org/x/sync?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/sys@v0.0.0-20181030150119-7e31e0c00fa0: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/net@v0.0.0-20181023162649-9b4f9f5ad519: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/net@v0.0.0-20190206173232-65e2d4e15006: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/tools@v0.0.0-20190211224914-44bee7e801e4: unrecognized import path "golang.org/x/tools" (https fetch: Get https://golang.org/x/tools?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: finding gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: golang.org/x/text@v0.3.0: unrecognized import path "golang.org/x/text" (https fetch: Get https://golang.org/x/text?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/sync@v0.0.0-20181108010431-42b317875d0f: unrecognized import path "golang.org/x/sync" (https fetch: Get https://golang.org/x/sync?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/sys@v0.0.0-20180905080454-ebe1bf3edb33: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/appengine@v1.2.0: unrecognized import path "google.golang.org/appengine" (https fetch: Get https://google.golang.org/appengine?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/oauth2@v0.0.0-20190211225200-5f6b76b7c9dd: unrecognized import path "golang.org/x/oauth2" (https fetch: Get https://golang.org/x/oauth2?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/oauth2@v0.0.0-20181017192945-9dcd33a902f4: unrecognized import path "golang.org/x/oauth2" (https fetch: Get https://golang.org/x/oauth2?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: finding github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe
go: golang.org/x/image@v0.0.0-20190209060608-ef4a1470e0dc: unrecognized import path "golang.org/x/image" (https fetch: Get https://golang.org/x/image?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/net@v0.0.0-20180906233101-161cd47e91fd: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/net@v0.0.0-20181017193950-04a2e542c03f: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/crypto@v0.0.0-20180904163835-0709b304e793: unrecognized import path "golang.org/x/crypto" (https fetch: Get https://golang.org/x/crypto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/crypto@v0.0.0-20190211182817-74369b46fc67: unrecognized import path "golang.org/x/crypto" (https fetch: Get https://golang.org/x/crypto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/crypto@v0.0.0-20181015023909-0c41d7ab0a0e: unrecognized import path "golang.org/x/crypto" (https fetch: Get https://golang.org/x/crypto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/grpc@v1.15.0: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/grpc@v1.18.0: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/time@v0.0.0-20180412165947-fbb02b2291d2: unrecognized import path "golang.org/x/time" (https fetch: Get https://golang.org/x/time?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/api@v0.0.0-20181017004218-3f6e8463aa1d: unrecognized import path "google.golang.org/api" (https fetch: Get https://google.golang.org/api?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: error loading module requirements
果然被墙。这里分享一个利器 https://goproxy.io/
# Enable the go modules feature
export GO111MODULE=on
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io
设置了 go 代理之后,所有包就很顺畅地下载下来了。
2 编译准备
ubuntu@VM-0-6-ubuntu:~/lorawan-stack$ make init
make[1]: Entering directory '/home/ubuntu/lorawan-stack'
GO111MODULE=on go run github.com/magefile/mage -compile .mage/run
lorawan-stack Installing git hook: pre-commit
lorawan-stack Installing git hook: pre-push
lorawan-stack Installing git hook: commit-msg
lorawan-stack Initializing go
make[2]: Entering directory '/home/ubuntu/lorawan-stack'
lorawan-stack Installing go dependencies
make[2]: Leaving directory '/home/ubuntu/lorawan-stack'
lorawan-stack Initializing js
make[2]: Entering directory '/home/ubuntu/lorawan-stack'
lorawan-stack Installing js dev dependencies
+ yarn@1.12.3
added 1 package and audited 1 package in 3.241s
found 0 vulnerabilitiesmake[2]: Leaving directory '/home/ubuntu/lorawan-stack'
make[2]: Entering directory '/home/ubuntu/lorawan-stack'
lorawan-stack Installing js dev dependencies
lorawan-stack Fetching JS SDK dependencies
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.13.0", while you're on "1.12.3".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Done in 24.55s.
make[2]: Leaving directory '/home/ubuntu/lorawan-stack'
make[2]: Entering directory '/home/ubuntu/lorawan-stack'
lorawan-stack Building JS SDK files
yarn run v1.12.3
$ babel src -d dist --no-emoji --no-progress --quiet
Done in 2.68s.
make[2]: Leaving directory '/home/ubuntu/lorawan-stack'
make[2]: Entering directory '/home/ubuntu/lorawan-stack'
lorawan-stack Installing js dev dependencies
lorawan-stack Installing js dependencies
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 77.69s.
make[2]: Leaving directory '/home/ubuntu/lorawan-stack'
lorawan-stack Generating certificates
2019/03/11 16:47:50 wrote cert.pem
2019/03/11 16:47:50 wrote key.pem
make[1]: Leaving directory '/home/ubuntu/lorawan-stack'
3 编译
For development/testing purposes we suggest either running required binaries via go run (e.g. go run ./cmd/ttn-lw-cli from repository root for CLI), or using go build directly. Note, that the frontend (if used) needs to be built via ./mage js:build before go build or go run commands are run.
这块命令现在官方做了比较大的精简,目前已经不用再去运行一些依赖命令,直接可以 build。
3.1 cli 编译
这个命令行工具是和 Stack 的各组件进行交互的必要工具。
go build ./cmd/ttn-lw-cli/
3.2 stack 编译
go build ./cmd/ttn-lw-stack/
小能手使用一个弱爆了虚机进行编译,竟然出错,因此下一篇还额外分享了一个交叉编译的方式,即在 MAC 上为 Linux 编译程序。就当是体验 GO 的一大特色。
3.3 前端编译
./mage js:build
详细的可以见 2.7 编译运行 Web 前端。
END
The Things Network LoRaWAN Stack V3 学习笔记 1.2 源码编译 - 190821相关推荐
- The Things Network LoRaWAN Stack V3 学习笔记 1.2 源码编译
前言 源码编译是重头戏,这节笔记记录如何使用 make 命令编译相关部件.由于部分包在墙外,带来了一点麻烦,还分享一个 replace 方式来翻墙的办法. 小能手这段时间在学习 The Things ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.5 LoRa节点配置接入
前言 网关接入之后,再让节点接入.本篇笔记重点记录一些小坑,注意跳过. 小能手这段时间在学习 The Things Network LoRaWAN Stack V3,从使用和代码等角度对该 Stack ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.2 使用 CLI 进行 OAuth 登录
前言 在上一篇笔记中已经将 Stack 运行起来了,现在可以着手用 CLI 来做一些测试,第一步是要先登录账户. 小能手这段时间在学习 The Things Network LoRaWAN Stack ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.3 使用 CLI 在 Stack 上创建 DEMO 应用
前言 前两篇笔记将 Stack 跑起来并且登录上去,那接下来就可以创建应用,再之后让网关和节点连接上来. 本节记录如何使用 CLI 工具在 Stack 上创建 DEMO 应用. 可参考官方的 guid ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.1 运行准备
前言 https://github.com/TheThingsNetwork/lorawan-stack/blob/master/doc/gettingstarted.md 这篇笔记记录了 stack ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.7 编译运行 Web 前端
文章目录 前言 1 Stack 前端简介 Console OAuth 2 编译 Stack 前端 3 总体操作流程 4 部署在CVM上的操作 END 前言 此前一直使用命令行来测试,最近 Stack ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.7.1 Web 前端开发调试
文章目录 前言 1 官方介绍 2 本地实践 2.1 脚本准备 2.2 操作步骤 END 前言 上一篇研究了如果编译运行 Web 前端,这一篇研究如何在开发模式下调试 Web 前端. 小能手这段时间在学 ...
- The Things Network LoRaWAN Stack V3 学习笔记 2.1.1 使用 CockroachDB Shell 操作 Identity Server
前言 由于 OAUTH 命令进行了更新,导致我把一条旧的命令配置进了 Identity Server.所以本节琢磨下如何使用 cockroachdb 修改 Identity Server. 相关 sh ...
- The Things Network LoRaWAN Stack V3 学习笔记
The Things Network 是 LoRaWAN 行业里非常著名的 Network Server 提供方,尤其是开发者社区运营得非常好,吸引了很多开发者来使用他们的平台.接触的许多国外的厂家, ...
最新文章
- 关于dns域名轮询监控的疑问
- 74HC595驱动程序
- 鸟哥的Linux私房菜(基础篇)-第四章、安装 CentOS 5.x 与多重开机小技巧
- mybatis mysql Dao_Dao模式创建mybatis项目过程
- SQLite3中的数据类型
- [LeetCode] Plus One 加一运算
- 常见数据库url和driver
- vim使用方法的总结摘自鸟哥的私房菜
- json获取key对应的值java_java 获取json字符串中key对应的值
- 绝对经典英语学习资料
- Leetcode 5053. 地图分析 (150周赛)
- dma读nand_使用DMA方式读取spi flash问题求助
- Spark:reduceByKey与groupByKey进行对比
- 如何利用爬虫工具实现竞品价格监控
- springboot 集成redission分布式锁
- STM32——快速识别芯片引脚数
- 各种屏幕录像软件使用教程及效果对比
- 关于OracleClient的链接问题
- 一阶RC和二阶RC低通滤波器
- Webview唠唠嗑
热门文章
- 如何用公式编辑器打绝对值符号?
- 报错为method does not override method from its superclass解决方案
- C# 异步委托 BeginInvoke EndInvoke
- css module
- c++20 module
- ObjectArx块操作封装
- C / C++ 中的计时函数: clock()
- c语言文件fwrite,C语言中的文件写函数fwrite的问题,如何解决?
- 67行代码实现:模拟手机九宫格输入法
- 海尔微型计算机硬盘如何拆卸,海尔a62的详细拆机步骤【图文教程】