The binary compiled on windows is twice as large as the official download

What is the problem you are having with rclone?

I tried to compile the rclone binary on windows by myself, and then found that the size of the compiled file was 84M, while the same file I downloaded on github was only 40M. I use the same version of the source code on github.

I want to get a binary file of the same size as the official compilation. What should I do?

What is your rclone version (output from rclone version)

rclone-v1.53.3-windows-amd64

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows10 64 bit

go1.15.5
mingw-w64
winfsp-1.8.20304.msi

The command you were trying to run (eg rclone copy /tmp remote:tmp)

go build -tags cmount

Try adding --ldflags "-s" to the build command. That's what's in the Makefile.

e.g. on my Linux machine without:

% go build -v               
% ls -l rclone
-rwxr-xr-x 1 sweh sweh 65440464 Dec 19 12:30 rclone*

But with:

% go build -v --ldflags "-s" 
% ls -l rclone
-rwxr-xr-x 1 sweh sweh 47655672 Dec 19 12:30 rclone

Although I dunno if that also applies to Windows!

Yes, seems to help:

% GOOS=windows go build                  
% ls -l rclone.exe     
-rwxr-xr-x 1 sweh sweh 53147136 Dec 19 12:36 rclone.exe*

% GOOS=windows go build --ldflags "-s"   
% ls -l rclone.exe                    
-rwxr-xr-x 1 sweh sweh 39093760 Dec 19 12:36 rclone.exe*
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.