Skip to content

Run in Virtual Box / Virtualization / VM #272

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

Closed
joeblew99 opened this issue Sep 26, 2019 · 9 comments
Closed

Run in Virtual Box / Virtualization / VM #272

joeblew99 opened this issue Sep 26, 2019 · 9 comments
Labels
duplicate question User questions

Comments

@joeblew99
Copy link

joeblew99 commented Sep 26, 2019

This runs fine chewing up 50% of the CPU, but it runs.

package main

import (
	"runtime"
	"github.com/go-gl/glfw/v3.2/glfw"
)

func init() {
	// This is needed to arrange that main() runs on main thread.
	// See documentation for functions that are only allowed to be called from the main thread.
	runtime.LockOSThread()
}

func main() {
	err := glfw.Init()
	if err != nil {
		panic(err)
	}
	defer glfw.Terminate()

	window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil)
	if err != nil {
		panic(err)
	}

	window.MakeContextCurrent()

	for !window.ShouldClose() {
		// Do OpenGL stuff.
		window.SwapBuffers()
		glfw.PollEvents()
	}
}

But stocks example does not:

C:\Users\windows\go\src\github.com\go-flutter-desktop\examples\stocks>hover run
hover: Downloading engine for platform windows-x64 at version b863200c37...
hover: Download completed in 7.26s�[2K
hover: Downloading artifacts at version b863200c37...
hover: Download completed in 3.82s�[2K
hover: Cleaning the build directory
hover: Bundling flutter app
Downloading Material fonts...                                       0.9s
Downloading Gradle Wrapper...                                       0.2s
Downloading package sky_engine...                                   0.7s
Downloading common tools...                                         2.4s
Downloading common tools...                                         2.0s
Downloading windows-x64 tools...                                    3.6s
Running "flutter pub get" in stocks...                             29.5s
hover: Compiling 'go-flutter' and plugins
go: downloading github.com/go-flutter-desktop/go-flutter v0.30.0
go: extracting github.com/go-flutter-desktop/go-flutter v0.30.0
go: downloading github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1
go: downloading github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
go: extracting github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1
go: extracting github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
go: finding github.com/go-flutter-desktop/go-flutter v0.30.0
go: finding github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
go: finding github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1
runtime/cgo
github.com/go-flutter-desktop/go-flutter/embedder
github.com/go-flutter-desktop/go-flutter/internal/execpath
github.com/go-gl/gl/v3.3-core/gl
github.com/go-gl/glfw/v3.2/glfw
github.com/go-flutter-desktop/go-flutter/internal/opengl
github.com/go-flutter-desktop/go-flutter/internal/priorityqueue
github.com/go-flutter-desktop/go-flutter/internal/tasker
github.com/go-flutter-desktop/go-flutter/plugin
github.com/go-flutter-desktop/go-flutter
github.com/go-flutter-desktop/examples/stocks/desktop/cmd
hover: Successfully compiled
hover: build finished, starting app...
hover: Running stocks in debug mode

creating glfw window: VersionUnavailable: WGL: Failed to create OpenGL context
hover: app 'stocks' exited with error: exit status 1

I used scoop to install gcc and everything else needed.

# Stuff i need

# RUN THIS in powershell

# https://github.com/lukesampson/scoop
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

scoop update

# multiple connections for scoop
scoop install aria2

# git
scoop install git
scoop install which

# openssh
scoop install openssh
[environment]::setenvironmentvariable(‘GIT_SSH’, (resolve-path (scoop which ssh)), ‘USER’)

# vscode
scoop bucket add extras
scoop install vscode
# tell vscode where git is:
which git
# then File > Preferences > Settings, and under User Settings add: "git.path”: “c:\\the\\path\\to\\git”
# restart and then do: code .

# go
# https://github.com/golang/go/wiki/windows-scoop-install-go-cli
scoop install go 

# protoc
scoop install protobuf


### ALL below is ONLY needed for compiling inside the Windows VM itself !!

# glfw
# Do we need it ?
scoop install gcc

# dart
# Do we need it ?
#scoop install dart-dev

# flutter
# NOT needed. hover does it.
scoop install flutter

@vjeson
Copy link

vjeson commented Sep 26, 2019

same issuse,because the vm display driver does not support opengl

@joeblew99
Copy link
Author

@vjeson
But when i run the opengl main.go test the display window opens. Sure its using a ton of CPU but it works.
But when i run the Stocks example i get the display driver error.

@joeblew99

This comment has been minimized.

@pchampio

This comment has been minimized.

@pchampio
Copy link
Member

pchampio commented Sep 26, 2019

Using the latest hover build tool, can you run hover run --opengl=none?
And please read the flag documentation (hover build --help)

@pchampio pchampio changed the title stocks example does not run in Windows ( in Virtual Box) Run in Virtual Box / Virtualization / VM Sep 26, 2019
@pchampio pchampio added the question User questions label Sep 26, 2019
@joeblew99
Copy link
Author

joeblew99 commented Sep 26, 2019

@Drakirus thanks for the feedback !

Both of these work.

hover run --opengl=none

hover build windows --opengl=none

i assume it is using flutters skia software renderer ?

Note that there is weird rendering happening whenever the mouse is over the top of the Stocks window.

VirtualBox_windows10_26_09_2019_23_15_51
VirtualBox_windows10_26_09_2019_23_18_22

@pchampio
Copy link
Member

i assume it is using flutters skia software renderer ?

Read the flag documentation:

--opengl string  The OpenGL version specified here is only relevant for external texture plugin (i.e. video_plugin).
                 If 'none' is provided, texture won't be supported. Note: the Flutter Engine still needs a OpenGL compatible context. (default "3.3")

If it's not enough: #248 (comment)

@TheSeriousProgrammer
Copy link

TheSeriousProgrammer commented Jan 22, 2021

I am testing in a Windows 10 VM

I ran hover build with no opengl flag , yet I got the same error
How do i fix it?

HOVER DOCTOR VERBOSE:

$ hover doctor -v
22:52:27 doctor.go:40: hover: Hover version v0.46.1 running on windows
22:52:27 doctor.go:42: hover: Sharing packaging tools
22:52:27 doctor.go:55: hover: darwin-bundle is supported
22:52:27 packaging.go:85: hover: Packaging darwin-dmg is not supported on windows
22:52:27 packaging.go:86: hover: To still package darwin-dmg on windows you need to run hover with the `--docker` flag.
22:52:27 packaging.go:85: hover: Packaging darwin-pkg is not supported on windows
22:52:27 packaging.go:86: hover: To still package darwin-pkg on windows you need to run hover with the `--docker` flag.
22:52:27 packaging.go:85: hover: Packaging linux-appimage is not supported on windows
22:52:27 packaging.go:86: hover: To still package linux-appimage on windows you need to run hover with the `--docker` flag.
22:52:27 packaging.go:85: hover: Packaging linux-deb is not supported on windows
22:52:27 packaging.go:86: hover: To still package linux-deb on windows you need to run hover with the `--docker` flag.
22:52:27 packaging.go:85: hover: Packaging linux-pkg is not supported on windows
22:52:27 packaging.go:86: hover: To still package linux-pkg on windows you need to run hover with the `--docker` flag.
22:52:27 packaging.go:85: hover: Packaging linux-rpm is not supported on windows
22:52:27 packaging.go:86: hover: To still package linux-rpm on windows you need to run hover with the `--docker` flag.
22:52:27 packaging.go:85: hover: Packaging linux-snap is not supported on windows
22:52:27 packaging.go:86: hover: To still package linux-snap on windows you need to run hover with the `--docker` flag.
22:52:27 doctor.go:55: hover: windows-msi is supported
22:52:27 doctor.go:58: hover:
22:52:27 doctor.go:60: hover: Sharing flutter version
Flutter 1.25.0-8.3.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5d36f2e7f5 (8 days ago) • 2021-01-14 15:57:49 -0800
Engine • revision 7a8f8ca02c
Tools • Dart 2.12.0 (build 2.12.0-133.7.beta)

HOVER RUN VERBOSE

$ hover run --opengl=none -v
22:53:30 cache.go:211: hover: Using engine from cache
22:53:30 build.go:414: hover: Cleaning the build directory
22:53:32 build.go:459: hover: Bundling flutter app
22:53:36 build.go:668: hover: The '--opengl=none' flag makes go-flutter incompatible with texture plugins!
22:53:36 build.go:681: hover: Compiling 'go-flutter' and plugins
22:53:41 build.go:687: hover: Successfully compiled executable binary for windows
22:53:41 run.go:51: hover: Build finished, starting app...
22:53:41 run.go:95: hover: Running flutter_app in debug_unopt mode
creating glfw window: APIUnavailable: WGL: The driver does not appear to support OpenGL
22:53:44 run.go:104: hover: App 'flutter_app' exited with error: exit status 1

Doing this in MINGW64 bash shell

@pchampio
Copy link
Member

Well I guess the VM you are using is not able to run glfw.
There is simply nothing we can do about it.
Maybe on virtual box check the OpenGL option?
It’s out of the scope of the support I can provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate question User questions
Development

No branches or pull requests

4 participants