增加 易百纳 EB-RV1126-DC 201 NATS 集成说明.
Signed-off-by: rick.chan <cy@haoan119.com>
This commit is contained in:
parent
0d83b653a6
commit
ab020839e6
|
@ -0,0 +1,131 @@
|
|||
# 易百纳 EB-RV1126-DC 201 NATS 集成说明
|
||||
|
||||
## 依赖
|
||||
|
||||
- CMake 3.13
|
||||
- nats.c-v3.6.1
|
||||
- protobuf-3.6.0
|
||||
- protobuf-c-1.3.2
|
||||
|
||||
nats.c-v3.6.1 的编译需要使用 CMake 3.13 版本,实际上 3.10.2 以上版本都支持,就是修改 CmakeList.txt 中的 cmake_minimum_required 的话会导致后续配置 buildroot 比较麻烦(tar 包的校验值会发生变化),因此如果 Host 为 Ubuntu 且 CMake 版本低于 3.13 的话,建议先 apt 卸载 CMake,然后:、
|
||||
|
||||
```bash
|
||||
snap install cmake --classic
|
||||
```
|
||||
|
||||
buildroot 中的 protobuf-c 为 1.3.0 版本,该版本配合 protobuf-3.6.0 会产生编译错误,需要手动修改为 protobuf-c-1.3.2。
|
||||
|
||||
protobuf-c.mk 中修改 PROTOBUF_C_VERSION
|
||||
|
||||
```mk
|
||||
PROTOBUF_C_VERSION = v1.3.2
|
||||
```
|
||||
|
||||
protobuf-c.hash 中增加:
|
||||
|
||||
```hash
|
||||
sha256 53f251f14c597bdb087aecf0b63630f434d73f5a10fc1ac545073597535b9e74 protobuf-c-v1.3.2.tar.gz
|
||||
```
|
||||
|
||||
## Buildroot 集成 nats.c
|
||||
|
||||
在 buildroot 的 package 目录中增加 nats-c 文件夹,添加:
|
||||
|
||||
- Config.in
|
||||
- nats-c.hash
|
||||
- protobuf-c.mk
|
||||
|
||||
Config.in 内容如下:
|
||||
|
||||
```config
|
||||
config BR2_PACKAGE_NATS_C
|
||||
bool "nats-c"
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
# host-nats-c only builds on certain architectures
|
||||
depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
|
||||
depends on BR2_HOST_GCC_AT_LEAST_4_8 # host-nats-c
|
||||
help
|
||||
Runtime libraries to use NATS from C/C++.
|
||||
|
||||
comment "nats-c needs a toolchain w/ C++, threads, host gcc >= 4.8"
|
||||
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
|
||||
|| !BR2_HOST_GCC_AT_LEAST_4_8
|
||||
depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
|
||||
```
|
||||
|
||||
nats-c.hash 内容如下:
|
||||
|
||||
```hash
|
||||
# Locally calculated
|
||||
sha256 4b60fd25bbb04dbc82ea09cd9e1df4f975f68e1b2e4293078ae14e01218a22bf nats.c-3.6.1.tar.gz
|
||||
```
|
||||
|
||||
protobuf-c.mk 内容如下:
|
||||
|
||||
```
|
||||
################################################################################
|
||||
#
|
||||
# nats-c
|
||||
#
|
||||
################################################################################
|
||||
|
||||
NATS_C_VERSION = 3.6.1
|
||||
NATS_C_SOURCE = nats.c-$(NATS_C_VERSION).tar.gz
|
||||
NATS_C_SITE = https://github.com/nats-io/nats.c/archive/refs/tags/v$(NATS_C_VERSION)
|
||||
NATS_C_DEPENDENCIES = host-protobuf-c
|
||||
HOST_NATS_C_DEPENDENCIES = host-protobuf-c host-pkgconf
|
||||
NATS_C_MAKE = $(MAKE1)
|
||||
NATS_C_INSTALL_STAGING = YES
|
||||
NATS_C_LICENSE = BSD-2-Clause
|
||||
NATS_C_LICENSE_FILES = LICENSE
|
||||
NATS_C_AUTORECONF = YES
|
||||
HOST_NATS_C_AUTORECONF = YES
|
||||
|
||||
$(eval $(cmake-package))
|
||||
$(eval $(host-cmake-package))
|
||||
```
|
||||
|
||||
之后在 buildroot 中使能 nats-c,savedefconfig,最后 build buildroot 即可。
|
||||
|
||||
## Host 端
|
||||
|
||||
使用 Host 软件包管理器卸载 libprotobuf-dev、libprotobuf-c-dev 等。
|
||||
|
||||
将 protobuf-3.6.0、protobuf-c-1.3.2、nats.c-3.6.1 从 buildroot 的 dl 文件夹中拷贝出来备用。
|
||||
|
||||
进入 protobuf-3.6.0,执行:
|
||||
|
||||
```
|
||||
./autogen.sh
|
||||
./configure
|
||||
make -jN
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
```
|
||||
|
||||
进入 protobuf-c-1.3.2,执行:
|
||||
|
||||
```
|
||||
./autogen.sh
|
||||
./configure
|
||||
make -jN
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
```
|
||||
|
||||
进入 nats.c-3.6.1,执行:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make -jN
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
```
|
||||
|
||||
## NATS-Server
|
||||
|
||||
下载 ARMv7 的二进制包解压后在 EB-RV1126-DC 201 上直接运行即可。
|
||||
|
Loading…
Reference in New Issue