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

panic: runtime error: invalid memory address or nil pointer dereference #24

Open
gnusupport opened this issue Apr 20, 2021 · 3 comments

Comments

@gnusupport
Copy link

make
go: downloading github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff
go: downloading github.com/go-gl/gl v0.0.0-20210315015930-ae072cafe09d
go: downloading golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb
go: downloading github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb
go: downloading golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5b7062]

goroutine 1 [running, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw.(*Window).SetSizeLimits.func1(0x0, 0x12c, 0xc8, 0xffffffffffffffff, 0xffffffffffffffff)
	/home/data1/protected/go/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/window.go:505 +0x22
github.com/go-gl/glfw/v3.3/glfw.(*Window).SetSizeLimits(0x0, 0x12c, 0xc8, 0xffffffffffffffff, 0xffffffffffffffff)
	/home/data1/protected/go/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/window.go:505 +0x57
github.com/danfragoso/thdwb/mustard.CreateNewWindow(0x908822, 0x5, 0x384, 0x258, 0x1, 0x0)
	/home/data1/protected/Programming/git/thdwb/mustard/window.go:24 +0xba
main.main()
	/home/data1/protected/Programming/git/thdwb/browser/main.go:46 +0x2ed
exit status 2
make: *** [Makefile:11: run] Error 1
~/Programming/git/thdwb
@JeelRajodiya
Copy link

JeelRajodiya commented Apr 21, 2021

i'm facing the same problem
OS : windows 10

$ make test
Testing Sauce...

named files must be .go files: sauce/go.mod
make: *** [Makefile:24: test] Error 1

make build works perfectly but the binary doesn't run

C:\Users\ZEEL\Documents\languages\go\repositories\thdwb>C:\Users\ZEEL\Documents\languages\go\repositories\thdwb\bin\thdwb.exe
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x421ac9]

goroutine 1 [running, locked to thread]:
github.com/go-gl/glfw/v3.3/glfw.(*Window).SetSizeLimits.func1(0x0, 0x12c, 0xc8, 0xffffffffffffffff, 0xffffffffffffffff)
        C:/Users/ZEEL/Documents/languages/go/golib/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/window.go:505 +0x29
github.com/go-gl/glfw/v3.3/glfw.(*Window).SetSizeLimits(0x0, 0x12c, 0xc8, 0xffffffffffffffff, 0xffffffffffffffff)
        C:/Users/ZEEL/Documents/languages/go/golib/pkg/mod/github.com/go-gl/glfw/v3.3/[email protected]/window.go:505 +0x5e
github.com/danfragoso/thdwb/mustard.CreateNewWindow(0x76d231, 0x5, 0x384, 0x258, 0x1, 0x0)
        C:/Users/ZEEL/Documents/languages/go/repositories/thdwb/mustard/window.go:24 +0xd1
main.main()
        C:/Users/ZEEL/Documents/languages/go/repositories/thdwb/browser/main.go:46 +0x2fe

I've ran these make commands in git bash install on windows.
and renamed the bin/thdwb build file to bin/thdwb.exe and tried to run it

@ajzaff
Copy link
Contributor

ajzaff commented Apr 26, 2021

The error on line 23 is unchecked so something went wrong.
You might try to insert:

if err != nil {
    log.Fatal(err)
}

Before line 24, make run, then paste the error here.

ajzaff added a commit to ajzaff/thdwb that referenced this issue Apr 26, 2021
Issue danfragoso#24 references some issues on Windows that this might have helped
debug.
@ajzaff
Copy link
Contributor

ajzaff commented Apr 27, 2021

It's likely that the error is related to your version of opengl. This only aims to support 4.1 which is fine if it's in your profile, but would return an error if it's not available.

If you're on wsl you can try

sudo apt install mesa-utils
glxinfo | grep "core profile"

To find supported core GL version.

Then, to get it running, you can change all "github.com/go-gl/gl/v4.1-core/gl" imports to a supported version and change the window hints here: https://github.com/danfragoso/thdwb/blob/master/mustard/window.go#L16-17

Longer term would need to add support for older versions of gl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants