I'm using the compiled rclone you provided and can run in openwrt, but I'm using the code provided on github to compile the rlcone on ubuntu and can run on ubuntu, but not on openwrt, how can I solve this problem?
Check this article out - see GOOS and GOARCH
The executable file you provided can be executed on both ubunt and openwrt and is the same file. I compile files that run on ubuntu but not on openwrt, it's all linux, it's not cross platform. If it's cross-platform, your single file can't support both ubuntu and rclone, right?
Only if your ubuntu server and your openwrt server are the same architecture - eg both i386 processors.
What error do you get when you run the code on openwrt?
ubuntu and openwrt are x64 sysytem,they are build in VM.error is "bash:not found 'rclone' "
Many openwrt systems are not x86.
Linux OpenWrt 4.14.167 #0 Wed Jan 29 16:05:35 2020 mips GNU/Linux
That's my TP-Link A7 router; it's "mips", not "x86"
If you're getting "not found" at run time then this would imply the wrong architecture.
This page describes how to compile for standard mips machines: https://github.com/golang/go/wiki/GoMips
The magic appears to be
GOOS=linux GOARCH=mips GOMIPS=softfloat
Have you tried disabling CGO? like:
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build
By default on Linux the binary is built with the glibc dynamically linked. But the glibc is not available on a busybox type linux (like Openwrt)
thanks ,you answer has reslove my question,thank you very much
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.