我下载了z-stack linux gateway 然后尝试编译到PC机去执行,按照流程,我下载了 protobuf2.6.1版本。protobuf-c1.2.1版本,并且在ubuntu上也安装成功了,使用protoc-c编译了 nwkmgr.proto 文件
开始编译代码,遇到
nwkmgr.pb-c.h:12:3: error: #error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
然后按照指示,更新了 代码目录中的google/protobuc-c/下面的protobuf-c.h头文件。可以又遇到以下问题
/zstackpb/zstack.pb-c.h:11:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
typedef struct _AFAddr AFAddr;
zstackpb/zstack.pb-c.h:498:3: error: unknown type name ‘AFAddr’
AFAddr *dstaddr;
还有一个问题,就是为什么源代码目录中没有zstack.pb-c.c的 zstack.proto和server.pb-c.c的server.proto文件??
peng wang84:
顶上去
Viki Shi:
怀疑是版本问题,建议参考帖子中的版本再测试: e2e.ti.com/…/2150897
Yue TANG:
看看这篇文章有没有帮助
http://sunmaysky.blogspot.hk/2017/03/build-ti-z-stack-linux-home-gateway.html
Build TI Z-Stack Linux Home Gateway reference design for x86 Linux
The following steps show you hot to build TI Z-Stack Linux Home Gateway reference design for x86 Linux.1. Download Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run from www.ti.com/…/z-stack-archive.2. Setup a 32 bit Ubuntu and run Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run to extract Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src3. Revise the build script package_builder_bbb (in red) under “your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\scripts\”…#Target platform: #export TARGET_PLATFORM="BEAGLEBONE_BLACK" export TARGET_PLATFORM="x86"… cd $NPI_SOURCE/Projects/tools/LinuxHost make clean make create_output #make arch-all-armBeagleBone CC_armBeagleBone=$COMPILER |& tee -a $MAKE_LOG_FILE make $BUILD_TYPE |& tee -a $MAKE_LOG_FILE…# *** Copy resources ***********************************************************************************#cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_armBeagleBone_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_servercp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_${PLATFORM_SUBSTRING}_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server4.a Install protobuf by doing the following two apt-get install sudo apt-get install protobuf-c-compiler sudo apt-get install protobuf-compiler4.b Create a new folder "tools" and export TCLIB to it using the following lines: cd ~ mkdir tools export TCLIB=~/tools/5. Switch to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ and run ./build_all6. The output will be at "your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ERROR_out\z-stack_linux_gateway_x86_binaries.tar". The build error is due to the lack of comparison file but the output binaries still work on x86 environment.7. Copy and untar “z-stack_linux_gateway_x86_binaries.tar” to your working directory on x86 (called <target_install>). Please follow the (Z-Stack Linux Gateway User Guide.pdf, Chap 6.3) to start the application. Please note you have to specify x86 when you run zigbeeHAgw like "sudo ./zigbeeHAgw x86"8. If you run it successfully, you will see the results like the following screen shot.
miffy:
可以参考之前的帖子:
blog.csdn.net/…/54375494
peng wang84:
回复 miffy:
并不是这个问题,现在是ztack.pb-c.hztack.pb-c.c这两文件无法在 protobuf-c 1.2.1中编译,其他的都有proto文件,可以使用新版的protobuf-c编译下,但是这个没有提供 proto文件。。。坑爹的TI
miffy:
回复 peng wang84:
不知道你遇到什么编译问题,这两个protobuf生成的文件,我之前是可以编译过去的,虽然没有*.proto我们没办法再次生成这两个文件,但是一般使用是足够了。
peng wang84:
回复 miffy:
先谢谢回复
我这边是这样的情况,protobuf 使用的是 2.6版本protobuf-c是1.2.1版本
然后我这边编译为x86架构,默认不改任何代码,可以编译生成固件,并没有任何问题后面我给nwkmgr.proto添加新内容,就加了一个message。然后重新使用protoc-c–c_out=./ nwkmgr.proto 重新生成了nwkmgr.pb-c.c和h文件,然后扔在目录里面再次编译,这边编译出现错误,提示我这边使用的是新版本的protobuf-c编译的,让我更新一下protobuf-c的头文件,也就是我帖子一开始的问题,然后按照指示,我更换了代码目录里的protobuf-c的头文件,再次编译,然后又开始报错,这次是 zstack.pb-c.c文件报错内容
/zstackpb/zstack.pb-c.h:11:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’typedef struct _AFAddr AFAddr;
peng wang84:
回复 peng wang84:
更新 头文件的时候。lib文件我也一并更新了,然后旧版本的 zstac.pb-c文件就开始报错了
peng wang84:
回复 miffy:
嗯,之前了解过znp-host-framework,但是底层固件使用了ZHA的现成ZCL,而znp-host-framework却没有 ZCL,要去移植过来,由于开发人员太少,所以直接用了gateway的,自己删除了部分其他平台不用的 ,主要坑爹的是手机端已经实现了三个Server的链接和数据交换了,现在没退路了,只能硬着搞了,对的 这个gateway的代码确实调来调去的很复杂,但是不得不说的是,部分代码的逻辑写的很好,就当学习了,而且现在也被精简的差不多了,现在就增加新功能的时候却来这出。。。不服啊 笑哭
TI中文支持网