DanEngelbrecht / golongtail

Command line front end for longtail synchronization tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recent windows executable not recognized as valid application

peterlindgren opened this issue · comments

Hi,

I tried to build and run fcaf8c3 on Windows today and found that the resulting executable is somehow identified as invalid by windows:

image

Strangely enough, building it with -ldflags="-s -w" does result in the executable running as normal, as far as I can tell!

I started bisecting the git history and found that in commit f00d07a the updated lib longtaillib\longtail\liblongtail_win32_x64.a appears to be where the problem started. If I soft reset to the parent of the previous mentioned commit and only discard the lib it builds and runs just fine. (NOTE: When I say "runs just fine" I mean I can run longtail.exe -h without the error popup)

System info:
System type 64-bit operating system, x64-based processor
Windows 10 Enterprise
Version 1909
OS build 18363.1977

I have not tested on any other machine yet... Getting MingW and Go to work on Windows is pain.

-Peter

That seems weird. I'm unable to reproduce this but did not succeed.
I did a clean repo clone, dir:
git checkout fcaf8c34037578a7b0f86
cd cmd\longtail
go build -ldflags="-s -w" .
.\longtail.exe -h

And got the expected help output.

Am I missundertanding something?

(I'm running on Windows 10.0.19044 - not sure if that matters)

It's without the ldflags that I'm seeing the issue, here's my output:

D:\work>git clone https://github.com/DanEngelbrecht/golongtail.git golangtailtest
Cloning into 'golangtailtest'...
remote: Enumerating objects: 4611, done.
remote: Counting objects: 100% (440/440), done.
remote: Compressing objects: 100% (133/133), done.
remote: Total 4611 (delta 283), reused 413 (delta 272), pack-reused 4171
Receiving objects: 100% (4611/4611), 208.28 MiB | 5.58 MiB/s, done.
Resolving deltas: 100% (2806/2806), done.

D:\work>cd golangtailtest

D:\work\golangtailtest>cd cmd\longtail

D:\work\golangtailtest\cmd\longtail>go build .

D:\work\golangtailtest\cmd\longtail>longtail.exe
Access is denied.

D:\work\golangtailtest\cmd\longtail>go build -ldflags="-s -w" .

D:\work\golangtailtest\cmd\longtail>longtail.exe
longtail.exe: error: expected one of "upsync",  "downsync",  "get",  "validate-version",  "print-version",  ...```

Sorry, I can't reproduce this at either main HEAD or at fcaf8c3, even tried your exact steps.
I'm currently on golang 1.19 and GCC 11.2.0 on my local computer if that might give any clues.

Okay, thanks for testing it. I've tried with golang 1.19, 1.18, 1.17 and GCC 10.3.0 (TDM-GCC-64). Either it's the versions there or something else wonky with my setup (anti-virus?). I'll see about testing a newer GCC version.

I finally got around to testing this with golang 1.19.1 and GCC 11.2.0 (MingW64-WinLibs-11.2.0) and works!

Thanks for testing on your side and reporting versions.