danfragoso / thdwb

🌭 The hotdog web browser and browser engine 🌭
MIT License
1.12k stars 58 forks source link

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

Open gnusupport opened 3 years ago

gnusupport commented 3 years ago
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/glfw@v0.0.0-20210410170116-ea3d685f79fb/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/glfw@v0.0.0-20210410170116-ea3d685f79fb/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 commented 3 years ago

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/glfw@v0.0.0-20210410170116-ea3d685f79fb/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/glfw@v0.0.0-20210410170116-ea3d685f79fb/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 commented 3 years ago

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 commented 3 years ago

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.