Dependecy problem on Ubuntu 20.04
I install sudo apt install libgl1-mesa-dev but
Steps to reproduce the behaviour:
// cat main.go
package main
import (
"fyne.io/fyne/widget"
"fyne.io/fyne/app"
)
func main() {
app := app.New()
w := app.NewWindow("Hello")
w.SetContent(widget.NewVBox(
widget.NewLabel("Hello Fyne!"),
widget.NewButton("Quit", func() {
app.Quit()
}),
))
w.ShowAndRun()
}
# fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw
In file included from ./glfw/src/internal.h:169,
from ./glfw/src/context.c:28,
from /home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw.go:4:
./glfw/src/x11_platform.h:39:10: fatal error: X11/Xcursor/Xcursor.h: No such file or directory
39 | #include <X11/Xcursor/Xcursor.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
It is not enough to just install sudo apt install libgl1-mesa-dev. The error you are getting tells you that your system is missing headers for xorg. The official developer docs states that you need to also install xorg-dev. Hopefully that should sort things out for you :)
Thanks for quick response. It's worked
but another error/warning appear:
# fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw
In file included from /home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:24:
/home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c: In function ‘_glfwInitJoysticksLinux’:
/home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/linux_joystick.c:224:42: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 9 [-Wformat-truncation=]
224 | snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
| ^~~~~~~
In file included from /usr/include/stdio.h:867,
from /usr/include/X11/Xcursor/Xcursor.h:26,
from /home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_platform.h:39,
from /home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/internal.h:169,
from /home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/glfw/src/x11_init.c:28,
from /home/sweb/go/src/fyne.io/fyne/vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw_linbsd.go:19:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 12 and 267 bytes into a destination of size 20
67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^C
These are warnings that can be ignored. Our next release, expected in around 2 weeks, removes them
I've got the same issue as OP where I get compilation terminated. Didn't wanna open a new issue as this one is new enough, happy to do so if you'd like though. Anyway, this is the terminal output:
$ sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
golang is already the newest version (2:1.14-1longsleep1+bionic).
gcc is already the newest version (4:7.4.0-1ubuntu2.3).
libgl1-mesa-dev is already the newest version (19.2.8-0ubuntu0~18.04.3).
xorg-dev is already the newest version (1:7.7+19ubuntu7.1).
0 to upgrade, 0 to newly install, 0 to remove and 74 not to upgrade.
$ cat gui.go
package main
import (
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Hello")
w.SetContent(widget.NewVBox(
widget.NewLabel("Hello Fyne!"),
widget.NewButton("Quit", func() {
a.Quit()
}),
))
w.ShowAndRun()
}
$ go run ./gui.go
# github.com/go-gl/glfw/v3.2/glfw
../../vendor/github.com/go-gl/glfw/v3.2/glfw/c_glfw.go:4:10: fatal error: glfw/src/context.c: No such file or directory
#include "glfw/src/context.c"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
There it hangs for a little bit, then exits with a non-zero error code.
It looks like you have an incomplete vendor directory @hoshsadiq. If you deviously used “go vendor” the please try “fyne vendor” which should fix the issue
Aah! Thank you! Did not realise that.
Most helpful comment
These are warnings that can be ignored. Our next release, expected in around 2 weeks, removes them