Icon and version info is not displayed in exe after successful build

What is the problem you are having with rclone?

I'm compiling rclone without problems, I followed all the steps and instructions to compile with Go, but when my compilation ends, it never adds the rclone icon to the executable, or the file information.
I'm compiling a version because I made some modifications to meet my needs.

Run the command 'rclone version' and share the full output of the command.

rclone v1.59.2-DEV

  • os/version: Microsoft Windows 10 Home 20H2 (64 bit)
  • os/kernel: 10.0.19042.2006 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.19.1
  • go/linking: static
  • go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Google Drive

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

go build -trimpath -ldflags -s -tags cmount

The rclone config contents with secrets removed.

any

A log from the command with the -vv flag

2022/09/27 02:58:06 DEBUG : rclone: Version "v1.59.2-DEV" starting with parameters ["rclone" "-vv"]
Usage:
  rclone [flags]
  rclone [command]

Available Commands:
  about           Get quota information from the remote.
  authorize       Remote authorization.
  backend         Run a backend-specific command.
  bisync          Perform bidirectonal synchronization between two paths.
  cat             Concatenates any files and sends them to stdout.
  check           Checks the files in the source and destination match.
  checksum        Checks the files in the source against a SUM file.
  cleanup         Clean up the remote if possible.
  completion      Generate the autocompletion script for the specified shell
  config          Enter an interactive configuration session.
  copy            Copy files from source to dest, skipping identical files.
  copyto          Copy files from source to dest, skipping identical files.
  copyurl         Copy url content to dest.
  cryptcheck      Cryptcheck checks the integrity of a crypted remote.
  cryptdecode     Cryptdecode returns unencrypted file names.
  dedupe          Interactively find duplicate filenames and delete/rename them.
  delete          Remove the files in path.
  deletefile      Remove a single file from remote.
  genautocomplete Output completion script for a given shell.
  gendocs         Output markdown docs for rclone to the directory supplied.
  hashsum         Produces a hashsum file for all the objects in the path.
  help            Show help for rclone commands, flags and backends.
  link            Generate public link to file/folder.
  listremotes     List all the remotes in the config file.
  ls              List the objects in the path with size and path.
  lsd             List all directories/containers/buckets in the path.
  lsf             List directories and objects in remote:path formatted for parsing.
  lsjson          List directories and objects in the path in JSON format.
  lsl             List the objects in path with modification time, size and path.
  md5sum          Produces an md5sum file for all the objects in the path.
  mkdir           Make the path if it doesn't already exist.
  mount           Mount the remote as file system on a mountpoint.
  move            Move files from source to dest.
  moveto          Move file or directory from source to dest.
  ncdu            Explore a remote with a text based user interface.
  obscure         Obscure password for use in the rclone config file.
  purge           Remove the path and all of its contents.
  rc              Run a command against a running rclone.
  rcat            Copies standard input to file on remote.
  rcd             Run rclone listening to remote control commands only.
  rmdir           Remove the empty directory at path.
  rmdirs          Remove empty directories under the path.
  selfupdate      Update the rclone binary.
  serve           Serve a remote over a protocol.
  settier         Changes storage class/tier of objects in remote.
  sha1sum         Produces an sha1sum file for all the objects in the path.
  size            Prints the total size and number of objects in remote:path.
  sync            Make source and dest identical, modifying destination only.
  test            Run a test command
  touch           Create new file or change file modification time.
  tree            List the contents of the remote in a tree like fashion.
  version         Show the version number.

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.

hello and welcome to the forum,

you seem to have compiled v1.59.2-DEV and ran a command rclone -vv

rclone -vv is not a valid, need a command such as
rclone listremotes

edit: i see i misunderstood the issue, and albertony offered a solution.

The resource information is applied by the Makefile build script (used for the official builds), which is using the third party command-line tool goversioninfo and generation of .syso files from cross-compile.go.

Oh, and I see this is actually documented:

Instead of executing the go build command directly, you can run it via the Makefile, which also sets version information and copies the resulting rclone executable into your GOPATH bin folder ($(go env GOPATH)/bin, which corresponds to ~/go/bin/rclone by default):

make

See: https://rclone.org/install/#install-from-source

1 Like
admin@DESKTOP-C934DP1 MINGW64 ~/rclone
$ make
go build -v --ldflags "-s -X github.com/rclone/rclone/fs.Version=v1.60.0-beta.6464.7fbc928a1"
mkdir -p `go env GOPATH`/bin/
cp -av rclone`go env GOEXE` `go env GOPATH`/bin/rclone`go env GOEXE`.new
'rclone.exe' -> 'C:\Users\admin\go/bin/rclone.exe.new'
mv -v `go env GOPATH`/bin/rclone`go env GOEXE`.new `go env GOPATH`/bin/rclone`go env GOEXE`
renamed 'C:\Users\admin\go/bin/rclone.exe.new' -> 'C:\Users\admin\go/bin/rclone.exe'

admin@DESKTOP-C934DP1 MINGW64 ~/rclone

I'm trying with Msys2 Mingw64
using:

mingw-w64-x86_64-go

mingw-w64-x86_64-toolchain

CPATH=C:\Program Files (x86)\WinFsp\inc\fuse

$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\admin\AppData\Local\go-build
set GOENV=C:\Users\admin\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\admin\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\admin\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\msys64\mingw64\lib\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\msys64\mingw64\lib\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.18
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\msys64\home\admin\rclone\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\msys64\tmp\go-build444387845=
/tmp/go-build -gno-record-gcc-switches

or

$ make --warn-undefined-variables
Makefile:3: warning: undefined variable 'BUILD_SOURCEBRANCHNAME'
Makefile:3: warning: undefined variable 'GITHUB_REF'
Makefile:36: warning: undefined variable 'BETA_SUBDIR'
Makefile:49: warning: undefined variable 'BUILDTAGS'
Makefile:49: warning: undefined variable 'BUILD_ARGS'
go build -v --ldflags "-s -X github.com/rclone/rclone/fs.Version=v1.60.0-beta.6464.7fbc928a1"
mkdir -p `go env GOPATH`/bin/
cp -av rclone`go env GOEXE` `go env GOPATH`/bin/rclone`go env GOEXE`.new
'rclone.exe' -> 'C:\Users\admin\go/bin/rclone.exe.new'
mv -v `go env GOPATH`/bin/rclone`go env GOEXE`.new `go env GOPATH`/bin/rclone`go env GOEXE`
renamed 'C:\Users\admin\go/bin/rclone.exe.new' -> 'C:\Users\admin\go/bin/rclone.exe'

Everything work, but version info and rclone.exe icon doesn't

C:\msys64\home\admin\rclone>rclone --version
rclone v1.60.0-beta.6464.7fbc928a1
- os/version: Microsoft Windows 10 Home 20H2 (64 bit)
- os/kernel: 10.0.19042.2006 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.18
- go/linking: dynamic
- go/tags: none

what am I doing wrong? Is there a different command or lib to install to fix this?

How to compile by Msys2 with make correctly to correct the icon and the version in the executable?

Sorry... I, and docs(*), may have misinformed: Plain make does not set resource info. This is, as mentioned, handled by cross-compile.go, but to trigger that one must do something like:

BUILD_FLAGS='-include "^windows/amd64"' make compile_all

Note: I'm not able to test it myself atm, so the above may not work as is, but maybe it gets you on the track until me or someone else can give you more to-the-point advise.. The build.yml, Makefile and cross-compile.go files should also give you the needed pointers.

* EDIT: The docs states that make "sets version information", and by that means it makes changes to the version number reported by rclone version. In my initial quick read I misinterpreted it to mean the Windows executable version info resources.

1 Like

I think I'm forgetting something, it doesn't find the goversioninfo :confused:

$ BUILD_FLAGS='-include "^windows/amd64"' make compile_all
go run bin/cross-compile.go -compile-only -include "^windows/amd64"   v1.60.0-beta.6464.7fbc928a1
2022/09/27 17:05:15 Compiling windows/amd64 into rclone-v1.60.0-beta.6464.7fbc928a1-windows-amd64
2022/09/27 17:05:15 ----------------------------
2022/09/27 17:05:15 Failed to run [goversioninfo -o C:\msys64\home\admin\rclone\resource_windows_amd
64.syso -64 C:\msys64\home\admin\rclone\build\versioninfo_windows_amd64.json]: exec: "goversioninfo"
: executable file not found in %PATH%
2022/09/27 17:05:15 Command output was:
2022/09/27 17:05:15 ----------------------------
2022/09/27 17:05:15 Warning: Windows binaries will not have file information embedded
2022/09/27 17:05:21 Done compiling windows/amd64
2022/09/27 17:05:21 Compiled 1 arches in 6.0495239s

Try make release_dep_windows

$ make release_dep_windows
GOOS="" GOARCH="" go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest

admin@DESKTOP-C934DP1 MINGW64 ~/rclone
$ BUILD_FLAGS='-include "^windows/amd64"' make compile_all
go run bin/cross-compile.go -compile-only -include "^windows/amd64"   v1.60.0-beta.6464.7fbc928a1
2022/09/27 17:14:53 Compiling windows/amd64 into rclone-v1.60.0-beta.6464.7fbc928a1-windows-amd64
2022/09/27 17:14:53 ----------------------------
2022/09/27 17:14:53 Failed to run [goversioninfo -o C:\msys64\home\admin\rclone\resource_windows_amd64.syso -64 C:\msys64\home\admin\rclone\build\versio
ninfo_windows_amd64.json]: exec: "goversioninfo": executable file not found in %PATH%
2022/09/27 17:14:53 Command output was:
2022/09/27 17:14:53 ----------------------------
2022/09/27 17:14:53 Warning: Windows binaries will not have file information embedded
2022/09/27 17:14:59 Done compiling windows/amd64
2022/09/27 17:14:59 Compiled 1 arches in 5.7625456s

unsuccessfully

I guess you need to make the location of the goversioninfo binary, e.g. ~/go/bin or however you want to refer to it, in $PATH. And, of course, check that the binary is really there.

I installed goversioninfo from the outside, directly on windows by cmd.exe with go, and compiled the exe, I just copied and threw it in the folder as I will demonstrate below, it seems to have worked.

For some reason goversioninfo is not being compiled on Msys2 with mingw64, I saw something on goversioninfo's github about this, but nothing that helped me to solve it.

C:\Users\admin\go\bin\goversioninfo.exe

copied to

C:\msys64\mingw64\bin\goversioninfo.exe

Version and Icon successfully entered with the command:

BUILD_FLAGS='-include "^windows/amd64"' make compile_all

thanks for the amazing support @albertony you helped me a lot.

1 Like

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