What is the problem you are having with rclone?
I want to reduce binary size when build from source.
Current i got a 98MB binary when run
go install github.com/rclone/rclone@latest, which is near 2x than official release.
Then i try
cd rclone && make , got a 65MB binary file , which is still a little big.
I found the difference between mine and officical release is
go/linking: dynamic, official release is
Any suggestions are appreciated.
followed document : Install
Run the command 'rclone version' and share the full output of the command.
- os/version: ubuntu 23.04 (64 bit)
- os/kernel: 6.2.0-26-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.7
- go/linking: dynamic
- go/tags: none
by default it contains all debug symbols.
I guess you do not need them in your "release"
go build -ldflags="-s -w"
I just executed these commands, and it seems to have helped a bit.
But file size still remain 63MB. The current official file size is 50MB.
There are some other optimisations included in the official release. Maybe it is good idea to document how to build official release version.
go build -trimpath -ldflags="-s -w"
62 MB after add ‘-trimpath'
Before i post this topic i looked through the official GitHub Action YAML file and didn't find any special tricks.
Maybe i am missed something.
Let's see maybe somebody else can point us into right direction
Thank you very much for your reply !
There are some docs here:
CGO_ENABLED=0 go build -ldflags="-s"
It should get you most of the way there
Note that if you want to reduce binary size further, comment out backends in
backend/all/all.go that you don't need and commands in
This works! binary file size now same as officical.
Thank you !
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.