找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 22851|回复: 58

使用arm架构编译openwrt,很多问题

  [复制链接]
发表于 2020-11-4 17:43 | 显示全部楼层 |阅读模式
悬赏10恩山币未解决
本帖最后由 欧哈哈哈 于 2023-8-15 23:19 编辑

不知道论坛里的大佬们有没有研究过,用arm架构的设备编译openwrt,比如n1,比如手机。不是不能用action云编译,电脑配置也足够编译,只不过想玩玩,尝试达到N1自己编译自己然后自己升级的目的,可惜半途而废了。
目前根据别人的研究,arm版的ubuntu 22.04的所有编译依赖都安装上了,如下:

  1. sudo apt update -y
  2. sudo apt full-upgrade -y
  3. sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
  4. bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext \
  5.   git gnutls-dev gperf haveged help2man intltool libelf-dev \
  6.   libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 \
  7.   libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool lld llvm lrzsz mkisofs msmtp \
  8.   nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip python3-ply \
  9.   python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig \
  10.   texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
复制代码





但是在编译过程中遇到了非常多问题,我解决了一两个,由于水平实在有限,还是不能编译出包。


  • 编译ucl的时候,提示无法获取到系统架构,这个问题百度了一下解决了,需要在./configure 后加 --build=arm-linux,我的方法是修改tools/ucl/Makefile 中./configure一行。
  • 编译到qemu时,提示 Unsupported CPU = aarch64 。我查了很多,qemu最新的源码可以在arm下编译成功,故替换feeds/packages/utils/qemu 到tools/qemu
  • 换编译新三固件,编译到golang ,提示Makefile:380: *** go-bootstrap cannot be installed on linux/arm64.  Stop.解决方法为apt install golang-go,然后配置文件修改languages-go-configation-external bootstrap go root directroy ,添加/usr/local/go,或者安装后直接编辑config,找到并修改CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT="/usr/bin/go"
  • 编译node时,提示 cc1:error:unrecognized command line option "-m64",makefile 的109行--dest-cpu=$(NODEJS_CPU) \ 换成--dest-cpu=arm64 \
  • naiveproxy报错,删除lean/feeds/helloworld/naiveproxy/src/init_env.sh 的22行: [ "$(uname)" != "Linux" -o "$(uname -m)" != "x86_64" ] && { echo -e "Support Linux AMD64 only."; exit 1; };最新版naiveproxy-92.0.4515.107-1删除这项已经没有用了,仍旧报错:
( cd "/home/123/lede/build_dir/target-x86_64_musl/naiveproxy-92.0.4515.107-1/src" ; . ../init_env.sh "x86_64" "" "" "/home/123/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl" ; export naive_flags+=" ${naive_ccache_flags}" ; mkdir -p "out" ; ./gn/out/gn gen "out/Release" --args="${naive_flags}" --script-executable="python" ; )
bash: ./gn/out/gn: cannot execute binary file: Exec format error


以上问题的部分解决方案感谢@mike22437120 ,最基础的编译已经能通过,另外选的luci等部分问题不好解决,直接取消编译,大部分常用插件编译通过
各位大佬群策群力,如能有大佬根据各种解决方案向lean提交commit以支持arm编译就更好了

230815更新依赖安装

重新clone后全新编译,在刚开始就出错,编译libressl时,编译到libcrypto提示
aes/aes-elf-armv4.S: Assembler messages:
aes/aes-elf-armv4.S:3: Error: unknown pseudo-op: `.code'
aes/aes-elf-armv4.S:72: Error: junk at end of line, first unrecognized character is `@'
一大堆这样的错误。前一段时间编译并没有问题,不知道为啥突然出问题了
210320更新:换回18.04,然后重新打包libressl-3.3.1为3.0.2,替换掉,编译成功。应该是18.04的gcc可用


我的恩山、我的无线 The best wifi forum is right here.
发表于 2020-11-4 18:02 | 显示全部楼层
直接交叉编译就行了,arm设备编译不慢吗?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-11-4 18:45 | 显示全部楼层
为什么不用不花钱的action呢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-11-4 21:20 | 显示全部楼层
本帖最后由 北方困难群众 于 2020-11-4 21:22 编辑

用得着?图新鲜吧?我电脑编译都嫌弃慢 破手机能有多少性能?没有电脑不是有云编译?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-11-4 21:24 | 显示全部楼层
本帖最后由 xiasenlinmu 于 2020-11-4 21:25 编辑

有可能是国内网络(内网)原因,本地编译需自备全局外网
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-11-4 23:15 | 显示全部楼层
云编译不香吗?电脑编译都要很久,就算手机可以估计一天都编译不完
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-11-17 14:35 | 显示全部楼层
路过,不容易啊,遇到和我一样想法的,我是让 K3 自己编译自己的固件加自动升级版本,没用ubuntu ,用的 debian 可行。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-11-17 16:13 | 显示全部楼层
aarch64实际是armv8就是arm64,你把aarch64改arm64就行了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-10 08:16 来自手机 | 显示全部楼层
ucl通过更新config.guess也能解决,生成patch放在对应目录下。go-bootstrap无法编译,暂时没找到解决办法,不过可以去掉部分依赖的软件包,不编译它就行了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-16 09:46 | 显示全部楼层
我手头上有个华为鲲鹏920CPU的 现在把qemu版本换成高版本的 好像能编译 现在报错还没有解决

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-22 11:16 | 显示全部楼层
进度播报:第一个问题我没遇到过。第二个问题,我用package/utils/qemu里的makefile替代就过去了,对系统目前没有影响。第三个问题是我现在遇到的问题,解决了再回来。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-22 13:24 | 显示全部楼层
本帖最后由 mike22437120 于 2020-12-22 13:27 编辑

问题解决。我用了两种法子 也不知道哪个是正确的。
go-bootstrap cannot be installed on linux/arm64

sudo apt install golang-go
wget https://studygolang.com/dl/golang/go1.13.4.linux-amd64.tar.gz

tar xfz go1.13.4.linux-amd64.tar.gz -C /usr/local

cd /usr/local/go
vim ~/.bashrc

#变量修改为一下配置
  1. export GOROOT=/usr/local/go  
  2. export GOPATH=$PATH:$GOROOT/bin
复制代码

执行命令:
go version
显示go version go1.13.4 linux/arm64

进去openwrt目录
make menuconfig
找到languages-go-configation-external bootstrap go root directroy
括号里面添加/usr/local/go
保存后重新编译
make V=s package/feeds/packages/golang/host/compile

点评

按照以上处理都不得行啊,能否指点如何找到处理方法 1 系统在线安装:apt install -y golang或者snap install go --channel=1.19/stable --classic 2 下载2进制包指定go-bootstrap 系统环境如下: go env GO111MODU  详情 回复 发表于 2023-8-29 16:31
这个办法好像可以,我也过去这一点了,正在继续往后编译,看看是否还有其他问题  详情 回复 发表于 2020-12-22 17:01
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2020-12-22 17:01 | 显示全部楼层
mike22437120 发表于 2020-12-22 13:24
问题解决。我用了两种法子 也不知道哪个是正确的。
go-bootstrap cannot be installed on linux/arm64

这个办法好像可以,我也过去这一点了,正在继续往后编译,看看是否还有其他问题
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-29 18:28 | 显示全部楼层
4,node报错
makefile 的109行
--dest-cpu=$(NODEJS_CPU) \
换成下面的
--dest-cpu=arm64 \

你用的大雕的源,我用的是官方的源,今天用了大雕的源发现了你的问题。 鲲鹏920 -j8编译这个node 7M的IPK用了十几分钟
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-12-30 13:41 | 显示全部楼层
不会  我只会github action功能做云编译  大佬作的源码进行白嫖妓可
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-26 20:14

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表