fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.87k stars 1.38k forks source link

compilation failed ubuntu 24.04 LTS #5085

Closed ghost closed 1 month ago

ghost commented 1 month ago

Checklist

Describe the bug

I am developing a cloud native application and when i am compiling the code, it is giving error. I tested the fyne installation twice but it is giving the following error:

go run fyne.io/fyne/v2/cmd/fyne_demo@latest
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from ../../go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/c_glfw.go:4:
./glfw/src/x11_platform.h:33:10: fatal error: X11/Xlib.h: No such file or directory
   33 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

i install the libx11-dev using the sudo apt-cache search libx11 | grep ^ lib | sudo apt-get update && sudo apt-get install libx11-dev and it is showing the complete installation of libx11. I wrote a OpenGL code and it is working fine. Can you help with this.

Thank you, Gaurav

How to reproduce

I am developing a cloud native application and when i am compiling the code, it is giving error. I tested the fyne installation twice but it is giving the following error:

go run fyne.io/fyne/v2/cmd/fyne_demo@latest
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from ../../go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/c_glfw.go:4:
./glfw/src/x11_platform.h:33:10: fatal error: X11/Xlib.h: No such file or directory
   33 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

i install the libx11-dev using the sudo apt-cache search libx11 | grep ^ lib | sudo apt-get update && sudo apt-get install libx11-dev and it is showing the complete installation of libx11. I wrote a OpenGL code and it is working fine. Can you help with this.

Thank you, Gaurav

Screenshots

No response

Example code

I am developing a cloud native application and when i am compiling the code, it is giving error. I tested the fyne installation twice but it is giving the following error:

go run fyne.io/fyne/v2/cmd/fyne_demo@latest
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from ../../go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/c_glfw.go:4:
./glfw/src/x11_platform.h:33:10: fatal error: X11/Xlib.h: No such file or directory
   33 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

i install the libx11-dev using the sudo apt-cache search libx11 | grep ^ lib | sudo apt-get update && sudo apt-get install libx11-dev and it is showing the complete installation of libx11. I wrote a OpenGL code and it is working fine. Can you help with this.

Thank you, Gaurav

Fyne version

go install fyne.io/fyne/v2/cmd/fyne@latest

Go compiler version

1.26

Operating system and version

Ubuntu 24.04 LTS

Additional Information

I am developing a cloud native application and when i am compiling the code, it is giving error. I tested the fyne installation twice but it is giving the following error:

go run fyne.io/fyne/v2/cmd/fyne_demo@latest
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from ../../go/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/c_glfw.go:4:
./glfw/src/x11_platform.h:33:10: fatal error: X11/Xlib.h: No such file or directory
   33 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.

i install the libx11-dev using the sudo apt-cache search libx11 | grep ^ lib | sudo apt-get update && sudo apt-get install libx11-dev and it is showing the complete installation of libx11. I wrote a OpenGL code and it is working fine. Can you help with this.

Thank you, Gaurav

andydotxyz commented 1 month ago

Did you try the library install commands from https://docs.fyne.io/started/?

ghost commented 1 month ago

Yes i tried and the only change is that instead of using the golang suggested in the version of the started fyne, I used the latest version of the golang. Is it possible that the fyne is causing the compilation error with the new version of golang.?.

Thank you for the time taken to help me approaching towards a solution, Gaurav

andydotxyz commented 1 month ago

No, this error is separate to the Go compiler. The developer headers for libX11 are not being found by your C compiler.

andydotxyz commented 1 month ago

Perhaps you can verify where Xlib.h is found on your system?

ghost commented 1 month ago

i did check

❯ sudo apt-get install libx11-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libx11-dev is already the newest version (2:1.8.7-1build1).

but it is still showing the error.

❯ go install fyne.io/fyne/v2/cmd/fyne@latest
❯ go run fyne.io/fyne/v2/cmd/fyne_demo@latest
# github.com/go-gl/glfw/v3.3/glfw
In file included from ./glfw/src/internal.h:188,
                 from ./glfw/src/context.c:30,
                 from go/bin/pkg/mod/github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20240506104042-037f3cc74f2a/c_glfw.go:4:
./glfw/src/x11_platform.h:33:10: fatal error: X11/Xlib.h: No such file or directory
   33 | #include <X11/Xlib.h>
      |          ^~~~~~~~~~~~
compilation terminated.
^C

any guess?.

ghost commented 1 month ago

i further checked and also made the X11 in the PATH

export PATH=/usr/include/X11:$PATH 
echo $PATH 
(base) gauravcodepro-XPS-13-9350% echo $PATH
/usr/include/X11:/home/gauravcodepro/.local/bin:/usr/include/X11:/usr/include/X11:/home/gauravcodepro/miniconda3/bin:/home/gauravcodepro/miniconda3/condabin:/home/gauravcodepro/.cargo/bin:/home/gauravcodepro/.juliaup/bin:/home/gauravcodepro/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/gauravcodepro/.local/bin

but the error is the same.

andydotxyz commented 1 month ago

PATH is not used to look up libraries.

Perhaps you can verify where Xlib.h is found on your system?

Please answer this question so we can proceed.

ghost commented 1 month ago

this is not working and i think i will solve this later. Thank you for the time taken and help provided. I close this now.

andydotxyz commented 1 month ago

Just rounding this out the conversation happened on another channel and pasting in the command from the getting started seemed to solve the issue.