#author("2019-10-31T13:48:58+08:00","default:Admin","Admin") OpenWRT

这里有些步骤不需要做。不过我也不知道哪步是不需要的

安装

&ref(): File not found: "OpenWRT_Mosquitto.png" at page "+OpenWRT+MQTT";

在OpenWrt上使用Mosquitto http://blog.sina.com.cn/s/blog_673cc3340102xh5k.html

测试是否安装成功的订阅命令

root@OpenWrt:/etc/mosquitto# mosquitto_sub -h 192.168.0.103 -p 61613 -u admin -P password -t lights/bedroom
root@OpenWrt:/etc# mosquitto_pub -h 192.168.0.103 -p 61613 -u admin -P password -t lights/bedroom -m "sssss"

开发编译

gcc -o mosquitto_client_sub mydrv_app.c -lmosquitto

应用程序的编译 openwrt/trunk/ 目录下,依次输入下列命令进行编译:

make package/mydrv_app/compile V=99
make package/mydrv_app/install V=99
make package/index V=99

编译没有出现 Error 即表示完成,编译后的固件存放在目录:

openwrt/trunk/bin/ramips/packages/base

https://blog.csdn.net/sg656720274/article/details/54344867

Package mydrv_app is missing dependencies for the following libraries:
libcrypto.so.1.0.0
librt.so.1
libssl.so.1.0.0

https://blog.csdn.net/uniom/article/details/54092570

https://blog.csdn.net/a_tu_/article/details/51509474

第一步

把/lib/i386-linux-gnu/libc.so.6这个文件拷贝到/home/user/attitude/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib这里。其中attitude是我的配置的Openwrt的编译环境。

cp /lib/i386-linux-gnu/libc.so.6 /home/user/attitude/staging_dir/target-mips_r2_uClibc-0.9.33.2/usr/lib

第二步

在你写的代码文件夹下(我写的是个helloworld)下的Makefile里 增加:DEPENDS:=+libc  就是在

define Package/helloworld  
        SECTION:=utils  
        CATEGORY:=Utilities  
        TITLE:=Helloworld -- prints a snarky message  
        DEPENDS:=+libc
endef

这个define下面。

第三步

也是在Makefile里增加:

define Package/helloworld/install  
        $(INSTALL_DIR) $(1)/bin  
        $(CP) /lib/i386-linux-gnu/libc.so.6 $(1)/bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/  
endef

这里多了一行$(CP)的代码。

第四步

在/home/user/attitude/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo下的libc.provides文件里增加两行:

/lib/i386-linux-gnu/libc.so.6
libc.so.6

这样子就解决了

有可能碰到的问题

编译openwrt遇打包时候遇缺少库

http://blog.ich8.com/post/4256>

解决openwrt ipk missing dependencies libpthread librt

https://blog.csdn.net/gubenpeiyuan/article/details/8437640

&ref(): File not found: "OpenWRT_编译错误1.png" at page "+OpenWRT+MQTT";

你试试加这2 个参数看看   --force-depends  --force-overwrite

Syntax error: “(” unexpected 是什么原因?

  • 编译工具不对
  • 型转化的warning没有解决

编译错误

/usr/sbin/snsh: line 1: syntax error: unexpected ";"

换行加";"可以解决

/lib/libmosquitto.so.1' is not an ELF executable for MIPS

main.o: error adding symbols: File in wrong format

ipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: main.o: Relocations in generic ELF (EM: 3)
/work/openwrt/trunk/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.8.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: main.o: Relocations in generic ELF (EM: 3)
main.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[3]: *** [snsh] Error 1
make[3]: Leaving directory `/work/openwrt/trunk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/snsh'
make[2]: *** [/work/openwrt/trunk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/snsh/.built] Error 2
make[2]: Leaving directory `/work/openwrt/trunk/package/snsh'
make[1]: *** [package/snsh/compile] Error 2
make[1]: Leaving directory `/work/openwrt/trunk'
make: *** [package/snsh/compile] 错误 2


★月額105円~/容量最大30GB/機能満載! ロリポップ!レンタルサーバー ★

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:34:57 (1627d)

G|Cg|C@Amazon Yahoo yV

z[y[W yVoC[UNLIMITȂ1~] COiq COsیI