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
179 stars 14 forks source link

Installing module on arm64 do not setup webui #37

Open Aukstkalnis opened 5 months ago

Aukstkalnis commented 5 months ago

Description

I am developing application for Raspberry pi 4B and wen I run go get -u github.com/webui-dev/go-webui/v2 it do not sets up the webui and compailing ends up with an error webui.h not found. It looks like raspberry pi returns aarch64 architecture but webui has only arm64. This means that there is only webui-linux-gcc-arm64.zip and no webui-linux-gcc-aarch64.zip. Since the aarch64 and arm64 are the same it should be possible to fallback to webui-linux-gcc-arm64.zip if webui-linux-gcc-aarch64.zip is not found.

Expected Behavior

When I fetch go mudule it should be fully set for compiling.

Reproduction Steps

No response

Error Logs

No response

Possible Solution

Fix setup.sh file to download webui for arm64 if there is no aarch64.

Version

2.4.2, 2.4.2-1.0, 2.4.3+

Environment Details (OS name, version, etc.)

Linux 6.6.31+rpt-rpi-v8 aarch64 GNU/Linux
hassandraga commented 5 months ago

Thank you for the report @Aukstkalnis.

ttytm commented 5 months ago

For the next release the interop with the WebUI C library has changed a bit. This will simplify the setup across systems and webui versions. It entirely removes the need to have a setup that downloads the pre-built lib that fits to the target system.

To use go-webui from the GOPATH, it will still required to have a little setup step, because go mod is very opinionated in module handling - e.g. regarding its paths depend on version, which parts of a repository it adds to the GOPATH etc.. Afaik there aren't any good ways for exceptions when it comes to its rules.


So for now and until the next version, the easiest thing to use the latest go-webui, will likely be to keep it relative to your project.

For this you can clone the repository to your project:

git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules \
  https://github.com/webui-dev/go-webui.git

(or add it as a submodule)

Then replace the required module path in the go.mod of your project (like it's done for the examples in the snippet below)

https://github.com/webui-dev/go-webui/blob/af171c1946dadddb41e35a9bcc6c662b042e4e39/examples/go.mod#L5-L7


Regarding having it in the GOPATH, I'll make an update tomorrow or the day after.

ttytm commented 4 months ago

Sorry for the delay. I haven't found the time to finish it. The good news, though not yet publicly visible, is that there is good progress. With the next free moment to work on it I'll do some more tests and push an update soon.

ttytm commented 4 months ago

Added a setup helper that can work across platforms(for now unix-like/wsl) and go-webui versions. Also extended the installation instructions in the readme accordingly.

Please let me know if it works for you.

The next stage will be also making this additional step obsolete for the $GOPATH. I will submit a suggestion to the webui main repo after doing further tests and can verify that everything works. Even when the script becomes obsolete, it's good to have it as a reference in the history.