Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

我编译 ARMv5 版本,但在路由器运行出错(-sh: ./cloudreve: not found),你是怎么解决的? #1

Closed
qian-jiahong opened this issue Dec 21, 2022 · 4 comments

Comments

@qian-jiahong
Copy link

交叉编译参数

export GOOS=linux
export GOARCH=arm
export GOARM=5
export CC=arm-linux-gnueabihf-gcc
export CGO_ENABLED=1
go build

运行:

root@MiWiFi:/opt/usr/cloudreve# ls
cloudreve statics
cloudreve_3.6.2_linux_arm_v5.tar
root@MiWiFi:/opt/usr/cloudreve# ./cloudreve
-sh: ./cloudreve: not found

CGO_ENABLED=0 编译,可以运行,还是出错。提示:go-sqlite3 需要 CGO 才能工作。
有办法解决吗?

@ZxwyWebSite
Copy link
Owner

我的arm版本是在电视盒子上编译的,hi3798mv100,armv7

解决办法:

  1. 在路由器上装环境编译,兼容性最好
  2. 不使用sqlite数据库,使用其它的mysql/mssql/postgres

我这里用的Commit#a11f819版本有个小问题静态文件无法镶入到程序,需要将静态文件放在cloudreve同目录
也可以用我新编译的armv5版整合包

@ZxwyWebSite
Copy link
Owner

还可以尝试安装GCC工具进行交叉编译

我没试过所以无法给出参考
可参考这里:AlistGo/alist#2237

@qian-jiahong
Copy link
Author

qian-jiahong commented Jan 1, 2023

@ZxwyWebSite 谢谢。这个办法能成功编译。

Ubuntu 20 交叉编译成功
下载: armv5l-linux-musleabi-cross.tgzhttps://musl.cc 还有更多
解压到:/usr/local/armv5l-linux-musleabi-cross

设置环境:
export GOOS=linux
export GOARCH=arm
export GOARM=5
export CGO_ENABLED=1

export CC=/usr/local/armv5l-linux-musleabi-cross/bin/armv5l-linux-musleabi-gcc
export CXX=/usr/local/armv5l-linux-musleabi-cross/bin/armv5l-linux-musleabi-c++
export AR=/usr/local/armv5l-linux-musleabi-cross/bin/armv5l-linux-musleabi-ar

编译:
go build -o cloudreve -ldflags "-s -w -L /usr/local/armv5l-linux-musleabi-cross/ '-extldflags=-v -static'"

成功。

@qian-jiahong
Copy link
Author

编译出来,并且能顺利运行。


/ \ | ___ _ _ | | __ _____ _____
/ / | |/ _ | | | |/ _ | '
/ _ \ \ / / _
/ /
| | () | || | (| | | | _/\ V / /
_
/|
|_/ _,|_,|_| _| _/ ___|

V3.6.2 Commit #a11f819 Pro=false

[Info] 2023-01-01 13:49:16 Initializing database connection...
[Info] 2023-01-01 13:49:16 Start initializing database schema...
[Info] 2023-01-01 13:49:17 Admin user name: admin@cloudreve.org
[Info] 2023-01-01 13:49:17 Admin password: zXHWE
[Info] 2023-01-01 13:49:18 Start executing database script "UpgradeTo3.4.0".
[Info] 2023-01-01 13:49:18 Finish initializing database schema.
[Info] 2023-01-01 13:49:18 Initialize task queue with WorkerNum = 10
[Info] 2023-01-01 13:49:18 Initialize crontab jobs...
[Info] 2023-01-01 13:49:18 Folder with name "statics" already exists, it will be used to serve static files.
[Info] 2023-01-01 13:49:18 Current running mode: Master.
[Info] 2023-01-01 13:49:18 Listening to ":5212"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants