Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Run on Windows 7 x 64 #1063

Closed
KiddoV opened this issue Jan 7, 2022 · 23 comments · Fixed by leaanthony/winc#5
Closed

Unable to Run on Windows 7 x 64 #1063

KiddoV opened this issue Jan 7, 2022 · 23 comments · Fixed by leaanthony/winc#5
Assignees
Labels
Bug Something isn't working

Comments

@KiddoV
Copy link
Contributor

KiddoV commented Jan 7, 2022

Description
Hello, I am new to Wails. Pretty cool project!
I have a problem compiling the app on Windows 7 using wails dev command.

Error Output

PS C:\Projects\GO Source Code Files\Web-Applications\Wails\test-app> wails dev
←[0;93mWails CLI←[0m ←[0;31mv2.0.0-beta.27←[0m


←[0;92mExecuting: go mod tidy←[0m
←[0;92mExecuting: wails generate module←[0m
Building application for development...
No Install command. Skipping.
No Build command. Skipping.
Generating bundle assets: Done.
Compiling application: Done.

←[0;92mWatching (sub)/directory: C:\Projects\GO Source Code Files\Web-Applications\Wails\test-app←[0m
←[0;92mUsing Dev Server URL: http://localhost:34115←[0m
←[0;92mUsing reload debounce setting of 100 milliseconds←[0m
INF | Serving assets from disk: C:\Projects\GO Source Code Files\Web-Applications\Wails\test-app\frontend\src
DEB | WebView2 Runtime Version '97.0.1072.55' installed. Minimum version required: 91.0.992.28.
←[0;92mAdded new directory to watcher: C:\Projects\GO Source Code Files\Web-Applications\Wails\test-app\frontend\wailsjs\go←[0m
DEB | [DevWebServer] Serving application at http://localhost:34115
panic: Failed to load shcore.dll: The specified module could not be found.

goroutine 1 [running, locked to thread]:
syscall.(*LazyProc).mustFind(...)
        C:/Program Files/Go/src/syscall/dll_windows.go:323
syscall.(*LazyProc).Call(0xc00011c5d0, {0xc000023760, 0x4, 0x4})
        C:/Program Files/Go/src/syscall/dll_windows.go:339 +0x65
github.com/leaanthony/winc/w32.GetDPIForMonitor(...)
        C:/Users/VH/go/pkg/mod/github.com/leaanthony/winc@v0.0.0-20211202091710-9931d43181ff/w32/shcore.go:15
github.com/leaanthony/winc.(*ControlBase).GetWindowDPI(0xc000222440)
        C:/Users/VH/go/pkg/mod/github.com/leaanthony/winc@v0.0.0-20211202091710-9931d43181ff/controlbase.go:104 +0xd5
github.com/leaanthony/winc.(*ControlBase).scaleWithWindowDPI(0xc000204180, 0x2d0, 0x23a)
        C:/Users/VH/go/pkg/mod/github.com/leaanthony/winc@v0.0.0-20211202091710-9931d43181ff/controlbase.go:466 +0x25
github.com/leaanthony/winc.(*ControlBase).SetSize(0xc000204180, 0x0, 0x0)
        C:/Users/VH/go/pkg/mod/github.com/leaanthony/winc@v0.0.0-20211202091710-9931d43181ff/controlbase.go:184 +0x5a
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.NewWindow({0x0, 0x0}, 0xc00018a0e0)
        C:/Users/VH/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.27/internal/frontend/desktop/windows/window.go:56 +0x199
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).Run(0xc000182630, {0xa173e0, 0xc0001deea0})
        C:/Users/VH/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.27/internal/frontend/desktop/windows/frontend.go:108 +0x78
github.com/wailsapp/wails/v2/internal/frontend/devserver.(*DevWebServer).Run(0xc00018e580, {0xa173e0, 0xc0001deea0})
        C:/Users/VH/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.27/internal/frontend/devserver/devserver.go:139 +0x638
github.com/wailsapp/wails/v2/internal/appng.(*App).Run(0xc00005a320)
        C:/Users/VH/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.27/internal/appng/app_dev.go:47 +0x31
github.com/wailsapp/wails/v2.Run(0xc00003e000)
        C:/Users/VH/go/pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.27/wails.go:24 +0x49
main.main()
        C:/Projects/GO Source Code Files/Web-Applications/Wails/test-app/main.go:26 +0x385
←[0;91mError during retrieving assetdir: Get "http://localhost:34115/wails/assetdir": dial tcp [::1]:34115: connectex: No connection could be made because the target machine actively refused it.←[0m
←[0;91mReloading couldn't be triggered: Please specify -assetdir or -reloaddirs←[0m

Expected behaviour
App should run normally.

System Details

PS C:\Projects\GO Source Code Files\Web-Applications\Wails\test-app> wails doctor
←[0;93mWails CLI←[0m ←[0;31mv2.0.0-beta.27←[0m


Scanning system - Please wait (this may take a long time)...Done.

System
------
OS:             Windows 7 Professional
Version:         (Build: 7601)
ID:
Go Version:     go1.17.6
Platform:       windows
Architecture:   amd64

Dependency      Package Name    Status          Version
----------      ------------    ------          -------
WebView2        N/A             Installed       97.0.1072.55
npm             N/A             Installed       6.14.4
*upx            N/A             Available

* - Optional Dependency

Diagnosis
---------
Your system is ready for Wails development!
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/


←[0;93m
If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
←[0m

I might have missed something, this is new to me. Please let me know!
Thank you!

@KiddoV KiddoV added the Bug Something isn't working label Jan 7, 2022
@taigrr
Copy link

taigrr commented Jan 8, 2022

According to here and here, Windows 7 doesn't support HiDPI like Windows 8.1+ does.

Windows 7 does have extended support available until 2023 so we may decide to use add build tags to remove the shcore.dll requirement as it's still a vaild target to support.

I don't have a windows 7 machine (only a VM of windows 10) so I wouldn't be able to reproduce. One potential option might be to fetch the .dll for yourself and experiment with dropping it into system32. I doubt it'll work though.

Note, I'm not endorsing this link, a better place to get it would be from a system you trust's system32 folder and copying it over.

If copying the dll works, you can bundle the .dll into your program using go embed and drop it into place before initializing the Wails app. Would require administrator privileges the first time though. Also, don't release the app anywhere with the dll. Only use this for internal projects (which I'm assuming is your intent if you're using Windows 7).

@KiddoV
Copy link
Contributor Author

KiddoV commented Jan 9, 2022

If I can't develop app on Windows 7. Can I run Wails exe file on it? I tried the starter app followed Wails official documents, built the exe file. The app is running fine on Windows 10, but it is not running on Windows 7. When I click the app.exe, it doesn't do anything (not even pop up any error messages). My Windows 7 machine already has Webview2 runtime installed.
Is Wails not support Windows 7 at all?

@taigrr
Copy link

taigrr commented Jan 9, 2022

@KiddoV no, wails currently requires a library (dll) that was introduced in Windows 8.1. Windows 7 is not currently supported (as of this PR). However, I've done some more research into this for you so I could get some better background ready before we rope in @leaanthony .

Looking through your stacktrace, the reason Wails doesn't support Windows 7 is because the underlying GUI library makes use of shcore.dll. You can see this here: modshcore = syscall.NewLazyDLL("shcore.dll"). This is used later to get the Monitor's DPI (as I said earlier) and then size the windows properly.

@leaanthony did not write winc, he forked it from tadvi/winc. However, I think we might be able to do something to fix it. Some documentation on the environment is available here.

I mentioned earlier, I do not own a Windows 7 machine to test this out, but if you can work with me to test, I can throw a patch together for you. Can you message me on the Gophers Slack? My handle is the same there as on github.

@taigrr
Copy link

taigrr commented Jan 9, 2022

The trouble I'm having is some really confusing, conflicting documentation from the folks over at Microsoft.

According to the Documentation for GetDpiForSystem(), the minimum supported client is Windows 10:

Minimum supported client Windows 10, version 1607 [desktop apps only]

However, the documentation page titled High DPI Desktop Application Development on Windows claims the following:

DPI Awareness Mode Windows Version Introduced Application's view of DPI Behavior on DPI change
Unaware N/A All displays are 96 DPI Bitmap-stretching (blurry)
System Vista All displays have the same DPI (the DPI of the primary display at the time the current user session was started) Bitmap-stretching (blurry)
Per-Monitor 8.1 The DPI of the display that the application window is primarily located on Top-level HWND is notified of DPI changeNo DPI scaling of any UI elements.
Per-Monitor V2 Windows 10 Creators Update (1703) The DPI of the display that the application window is primarily located on Top-level and child HWNDs are notified of DPI changeAutomatic DPI scaling of:Non-client areaTheme-drawn bitmaps in common controls (comctl32 V6)Dialogs (CreateDialog)

Similarly, the documentation for SetProcessDPIAware shows the following:

Minimum supported client Windows Vista [desktop apps only]

So, we should be able to call this function, and the minimum requirement was likely updated in error.

To further back this up, rw-designer has an article from 2007 (!) describing how to use the user32.dll library. So the documentation is almost definitely wrong.

I've created a fork of winc and submitted a Pull Request to include the call to the function that gets the DPI.

@leaanthony
Copy link
Member

Am OK accepting PRs for Windows < 10 support but will not be supporting it. Any bugs raised against windows < 10 will have a won't fix label but I won't close so someone else can deal with it. That's the best I can do considering my bandwidth.

@taigrr
Copy link

taigrr commented Jan 9, 2022

@leaanthony that's totally reasonable in my opinion.

@taigrr
Copy link

taigrr commented Jan 9, 2022

@KiddoV Can you please try to compile for windows 7 with the following change in your go.mod:

replace github.com/leaanthony/winc v0.0.0-20211202091710-9931d43181ff => github.com/taigrr/winc v0.0.0-20220109082143-3fb8dfab74d2

If it is successful, I will note it in the PR I submitted and hopefully we can get it merged.

@taigrr
Copy link

taigrr commented Jan 9, 2022

@leaanthony this got auto-closed, can we reopen until it's confirmed fixed? Also, the go.mod file still needs to be updated

@leaanthony
Copy link
Member

It doesn't fix. Commented on the PR

@leaanthony leaanthony reopened this Jan 9, 2022
@taigrr
Copy link

taigrr commented Jan 9, 2022

@KiddoV update: try the following in your go.mod:

replace github.com/leaanthony/winc v0.0.0-20211202091710-9931d43181ff => github.com/leaanthony/winc latest

@KiddoV
Copy link
Contributor Author

KiddoV commented Jan 9, 2022

Thank you for all the support, I will try it on Monday when I get back to work.

@leaanthony
Copy link
Member

The patch doesn't currently compile @KiddoV - we'll need to wait for it to be updated. Thanks

@leaanthony
Copy link
Member

I'm closing this as I'm not officially supporting it as previously mentioned but happy for the conversation and PRs to continue.

@KiddoV
Copy link
Contributor Author

KiddoV commented Jan 10, 2022

@leaanthony I got this ERR:
ERROR: :25:2: require github.com/leaanthony/winc: version "latest" invalid: must be of the form v1.2.3
when I change github.com/leaanthony/winc v0.0.0-20211202091710-9931d43181ff => github.com/leaanthony/winc latest

@leaanthony
Copy link
Member

Yes. Read 2 comments above. We'll need to wait for a fix to continue.

@taigrr
Copy link

taigrr commented Jan 11, 2022

@KiddoV I know I said I can't guarantee I could patch it, but I felt bad giving you hope it might work. It is also somewhat embarrassing submitting broken patches.

I've acquired a windows 7 and windows 10 machine. I will get this working this weekend.

In the meantime, can you try wails v1? I think that will work and it's a good stopgap until I have a working patch.

@leaanthony can you go ahead and assign the issue to me? I won't send another pr until I have screenshots of it working on both 7 and 10.

@KiddoV
Copy link
Contributor Author

KiddoV commented Jan 11, 2022

@taigrr Thank you. Will be waiting!

@taigrr
Copy link

taigrr commented Jan 17, 2022

@KiddoV once leaanthony/winc#11 is merged, you should be good to go.

@leaanthony
Copy link
Member

Merged!

stffabi added a commit to stffabi/wails that referenced this issue Jan 17, 2022
stffabi added a commit to stffabi/wails that referenced this issue Jan 17, 2022
@KiddoV
Copy link
Contributor Author

KiddoV commented Jan 17, 2022

@taigrr @leaanthony thank you both, it works on Windows 7 now. Yayy!

@taigrr
Copy link

taigrr commented Jan 17, 2022

No problem, hopefully you don't run into future problems, please keep in mind it's unsupported. Might add a warning to the readme saying as much as well.

MikeSchaap pushed a commit to MikeSchaap/wails that referenced this issue Jan 23, 2022
@dgc1
Copy link

dgc1 commented Jan 4, 2024

I found a project to solve the problem that Windows7 can run :https://github.com/fire988/FakeShcore
But I don't have a win7 sys to try. it used 2 dll to solve the system api dependency :shcore.dll、FakeShcore.dll

@leaanthony
Copy link
Member

I found a project to solve the problem that Windows7 can run :https://github.com/fire988/FakeShcore
But I don't have a win7 sys to try. it used 2 dll to solve the system api dependency :shcore.dll、FakeShcore.dll

Yeah I don't recommend running 3rd party dlls like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants