Skip to content

Run in Virtual Box / Virtualization / VM #272

Closed
@joeblew99

Description

@joeblew99

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions