openwrt19安装gcc到SD卡,以LinkIt Smart 7688为例
首先下载gcc安装包到SD卡或者/tmp:
opkg download gcc
然后,编辑/etc/opkg.conf文件,设置一个SD卡的路径(如图):
然后,安装gcc到SD卡:
opkg install gcc_7.4.0-5_mipsel_24kc.ipk -d sd01
然后这里需要配置一下环境变量,PATH和LD_LIBRARY_PATH(如图):
export LD_LIBRARY_PATH="/mnt/sd01/usr:/mnt/sd01/usr/lib:/mnt/sd01/usr/lib/gcc/mipsel-openwrt-linux-musl/7.4.0:/mnt/sd01/usr/include"
export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/mnt/sd01/usr:/mnt/sd01/usr/bin:/mnt/sd01/usr/include"
然后再测试一下gcc能否运行:
最后,测试一下编译运行hello world
这里发现一个问题:gcc找不到对应的头文件(如图)
这里我也比较奇怪,我已经改了对应的环境变量了。。
最后没办法,我把函数库头文件从/mnt/sd01/usr/include 复制到 /mnt/sd01/usr/lib/gcc/mipsel-openwrt-linux-musl/7.4.0/include 。这里如果有重复的文件,我是选择跳过,而不是覆盖。
最后编译hello world 成功:




Comments
Post a Comment