webui-dev / go-webui

Use any web browser as GUI, with Go in the backend and modern web technologies in the frontend.
https://webui.me/
MIT License
170 stars 14 forks source link

Undefined references on install #5

Closed Kukulkano closed 4 months ago

Kukulkano commented 1 year ago

Hi. I follow the documentation and run

go get github.com/webui-dev/go-webui/v2@latest

Sadly, it fails:

# github.com/webui-dev/go-webui/v2
../../../go/pkg/mod/github.com/webui-dev/go-webui/v2@v2.4.0/webui-linux-gcc-x64/libwebui-2-static.a(civetweb.o): In function `set_non_blocking_mode':
civetweb.c:(.text+0x4ff): undefined reference to `fcntl64'
civetweb.c:(.text+0x51b): undefined reference to `fcntl64'
../../../go/pkg/mod/github.com/webui-dev/go-webui/v2@v2.4.0/webui-linux-gcc-x64/libwebui-2-static.a(civetweb.o): In function `fclose_on_exec':
civetweb.c:(.text+0x3fe4): undefined reference to `fcntl64'
../../../go/pkg/mod/github.com/webui-dev/go-webui/v2@v2.4.0/webui-linux-gcc-x64/libwebui-2-static.a(civetweb.o): In function `set_close_on_exec.constprop.0':
civetweb.c:(.text+0x453e): undefined reference to `fcntl64'
../../../go/pkg/mod/github.com/webui-dev/go-webui/v2@v2.4.0/webui-linux-gcc-x64/libwebui-2-static.a(civetweb.o): In function `close_connection':
civetweb.c:(.text+0xae12): undefined reference to `fcntl64'
../../../go/pkg/mod/github.com/webui-dev/go-webui/v2@v2.4.0/webui-linux-gcc-x64/libwebui-2-static.a(civetweb.o):civetweb.c:(.text+0xae2a): more undefined references to `fcntl64' follow
collect2: error: ld returned 1 exit status

Any idea what is wrong? How can I fix this?

I'm on Linux (x86-64) using go1.16.2 linux/amd64.

hassandraga commented 1 year ago

I just test it this morning in Windows and it works fine:

> go get github.com/webui-dev/go-webui/v2@latest
go: downloading github.com/webui-dev/go-webui/v2 v2.4.0
go: upgraded github.com/webui-dev/go-webui/v2 v2.3.2 => v2.4.0

> go build minimal.go

> minimal.exe

I will re-test it in Linux later today.

hassandraga commented 1 year ago

According to this issue, they make a hack as a workaround. In general, WebUI uses Civetweb, and Civetweb includes <fcntl.h>, which may not be compatible with your GLibc version.

What is the version of GLIBC installed on your machine? You can use ldd --version command or a similar one.

Kukulkano commented 1 year ago
> ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1.6) 2.27

I'm on KDE NEON 5.19 (basically Ubuntu 20.04 LTS) and just ran all updates (apt get update, apt get upgrade).

hassandraga commented 1 year ago

in glibc 2.28+ and _FILE_OFFSET_BITS=64 fcntl is #define'd to fcntl64 Thus headers say fcntl64 exists, but libc.so.6 (the old one) disagrees

I guess we need to apply the same hack they did. I will investigate.

hassandraga commented 1 year ago

I just test it using Ubuntu 22.04.2 LTS with ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35. it works fine.

ttytm commented 1 year ago

Most part of the wrapper was re-written for the upcoming release. Can you re-check if the issue is solved for you @Kukulkano ? The go get command changed to: go get github.com/webui-dev/go-webui@latest

hassandraga commented 1 year ago

Perhaps we should change #cgo windows to #cgo windows,amd64 so Go builder knows that ARM lib does not exist. @ttytm

ttytm commented 1 year ago

Yes, sounds good.

I'll look into linux arm the next days as well 👍 . If things work we can add it to webuis github releases.

ttytm commented 4 months ago

Perhaps we should change #cgo windows to #cgo windows,amd64 so Go builder knows that ARM lib does not exist. @ttytm

https://github.com/webui-dev/go-webui/blob/8333e2d71b0fc672c60be5b187892e269ac9990b/v2/cgo.go#L6

Its in there since October.