webui icon indicating copy to clipboard operation
webui copied to clipboard

Ubuntu 20.04 is not supported?

Open Zizaco opened this issue 2 years ago • 17 comments

First of all, thanks for the great work. Webui is an innovative project that takes a fresh approach to creating UIs with web technologies. Now, the issue that I have is: Ubuntu 20.04 has glibc 2.31.

When I try to use webui I get the following error:

Error: Could not open library: Could not open library: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/zizaco/Projects/deno/deno-webui/src/webui-linux-gcc-x64/webui-2.so)

From v2.4.2 - v2.0.2, all versions required glibc 2.34 or 2.33. I guess Ubuntu 20.04 is not supported then? Unfortunately, that contradicts the promise of being "Portable" of Webui.

Is there any chance of a release that works with glibc 2.31?

Zizaco avatar Jan 28 '24 01:01 Zizaco

you can use zig to compile this, it should use glibc 2.31 correctly

just download zig 0.11 or nightly, then git clone webui, goto the directory, and run zig build -Dis_static=false -Denable_tls=true, this will compile webui wtch tls support(dynamic link library)

The build results can be found under zig-out/lib

jinzhongjia avatar Jan 28 '24 09:01 jinzhongjia

according to this issue: https://github.com/ziglang/zig/issues/4459, zig should support glibc 2.31

jinzhongjia avatar Jan 28 '24 09:01 jinzhongjia

Thanks, I'll give it a try!

Having releases that are more widely compatible would be a plus. Do you find it reasonable to have .github/workflows/linux.yml use zig by default?

Zizaco avatar Jan 28 '24 14:01 Zizaco

I think it's a better choice to use zig as a toolchain build, but that's up to @hassandraga and @ttytm decide However, if webui itself does not provide libraries compiled by zig, it may be possible to provide libraries compiled by zig in the downstream zig-webui.

jinzhongjia avatar Jan 28 '24 15:01 jinzhongjia

indeed, zig is well-known for allowing cross-compilation of popular projects. I found it a very reasonable approach. @hassandraga @ttytm I would love to hear your thoughts on this

Zizaco avatar Jan 28 '24 18:01 Zizaco

I think Zig is an excellent build system, but webui is very simple to build. It has one .c file. You can build webui by simply cloning and running make. So, asking all developers to install Zig is an overkill.

On the other hand, some developers want to integrate webui as a submodule in their repo, so some need Zig, others need Cmake, Ninja... that's why it is a good thing to have those build systems as well.

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

AlbertShown avatar Jan 29 '24 15:01 AlbertShown

I think Zig is an excellent build system, but webui is very simple to build. It has one .c file. You can build webui by simply cloning and running make. So, asking all developers to install Zig is an overkill.

On the other hand, some developers want to integrate webui as a submodule in their repo, so some need Zig, others need Cmake, Ninja... that's why it is a good thing to have those build systems as well.

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

@hassandraga @AlbertShown I really appreciate any help, do we have any updates on this? I use python version of webui2 and I really need this for my bachelor thesis. E.g. on newly installed ubuntu 20.04 even with installing the updates, you still get the glibc 2.31 and webui2 fails. I need users to be able to use my app out of the box just by installing the python packages and not the operating system dependencies. It currently works out of the box on Windows and MacOS but I also need to at least support Ubuntu and updating glibc is not the easiest thing for some casual user since it is one of the core libraries:(

halildgn avatar Apr 23 '24 13:04 halildgn

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

Long term fix

  1. Creating a new PR where linux.yml change ubuntu-latest to ubuntu-18.04
  2. Wait until next stable release of WebUI comes, so Python-WebUI PyPi will be updated
  3. Upgrade your webui2 local Python package

Quick fix / Workaround

  1. Clone WebUI and run make to build it in your Ubuntu
  2. Clone Python WebUI
  3. Copy your local compiled webui-2.so and webui.py into your Python project
  4. Make your project use the local webui.py instead of the installed PyPi package

AlbertShown avatar Apr 23 '24 21:04 AlbertShown

@halildgn Let me know if you need any assistance.

AlbertShown avatar Apr 23 '24 21:04 AlbertShown

To fix glibc issue, you can re-compile webui. But I guess to officially support the old glibc version, we should modify linux.yml from ubuntu-latest to ubuntu-18.04, this way we will be sure that webui will work with old glibc version and also the latest one.

Long term fix

  1. Creating a new PR where linux.yml change ubuntu-latest to ubuntu-18.04
  2. Wait until next stable release of WebUI comes, so Python-WebUI PyPi will be updated
  3. Upgrade your webui2 local Python package

Quick fix / Workaround

  1. Clone WebUI and run make to build it in your Ubuntu
  2. Clone Python WebUI
  3. Copy your local compiled webui-2.so and webui.py into your Python project
  4. Make your project use the local webui.py instead of the installed PyPi package

@AlbertShown Thanks a ton, I am going to try these tomorrow, it is 1am here. Two more questions: 1-Do you think that this should work on all x86_x64 linux systems or would it only work on ubuntu? (I did some google research, most people say compiled files shouldn't work on all linux systems but I also researched for so file format, it looks like it is a common format for linux systems, so I wanted to ask maybe it is somehow possible) 2-If you don't mind, could you please share when would be your prediction for the approximate date when the next stable release to take place?

Thank you very very much for responding in such a short time, really appreciate your help.

halildgn avatar Apr 23 '24 22:04 halildgn

1 - The webui-2.so file is a dynamic library, it depend only on the standard GNU C library glibc that it is installed in all Linux systems by default, the only issue is the version, so if your Ubuntu has glibc v2.31, then your compiled webui-2.so will look for this version when used in other x86_x64 machines, normally Ubuntu has the new and some of old glibc to support new and old softwares.

2 - I don't know, this is a open source project managed by the community. When majority of open issues get fixed and all new features get tested then a new version should be released, so maybe in a couple of months. I suggest you do the quick around solution for now.

Your main Python script --> include webui.py which it will auto load webui-2.so in the same folder.

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

AlbertShown avatar Apr 23 '24 22:04 AlbertShown

1 - The webui-2.so file is a dynamic library, it depend only on the standard GNU C library glibc that it is installed in all Linux systems by default, the only issue is the version, so if your Ubuntu has glibc v2.31, then your compiled webui-2.so will look for this version when used in other x86_x64 machines, normally Ubuntu has the new and some of old glibc to support new and old softwares.

2 - I don't know, this is a open source project managed by the community. When majority of open issues get fixed and all new features get tested then a new version should be released, so maybe in a couple of months. I suggest you do the quick around solution for now.

Your main Python script --> include webui.py which it will auto load webui-2.so in the same folder.

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

Thank you again Albert, I tried the workaround and I had succcess but I am a little confused right now. From what I understand(Please forgive my ignorance) the linux.yml builds the app probably with CI pipeline after a new release comes around. My question is that even though this builds the files for the whole Linux ecosystem, it uses ubuntu-latest(or in the future possibly ubuntu 18.04), so if I write my code like the following, i.e. only for Ubuntu, does this make sense? Since it looks like that regardless of the linux OS, it uses the Ubuntu builds anyway(it is most likely that I am mistaken though). In short, should I use number one or number two(What I mean is that if linux.yml builds like it only builds for Ubuntu for all linux distributions anyway, wouldn't it be just redundant to only check for ubuntu since even the official remote webui2 builds all linux distros like it is building for ubuntu? ):
1.

import distro
if distro.id() == 'ubuntu' :
# I renamed the `webui.py` file as `webui_ubuntu.py`
    import webui_ubuntu as webui
else:
   # the remote package from pip 
    from webui import webui 
from sysimport platform
if platform == 'linux':
# I renamed the `webui.py` file as `webui_linux.py`
    import webui_linux as webui 
else:
    from webui import webui

halildgn avatar Apr 24 '24 13:04 halildgn

When linux.yml build for Ubuntu, it means it build for all Debian based Linux ditro, not only Ubuntu.

The issue we have with linux.yml it's not Ubuntu itself, but, the issue is it use ubuntu-latest which use also the latest glibc v2.33, that's means the compiled webui-2 will work in all Debian based distro but only if glibc v2.33 is installed. Old Ubuntu/Debian still have glibc v2.31.

Your project should simply be like:

# Import local `webui.py`
import webui
MyWindow = webui.window()
MyWindow.show('<html><head><script src=\"webui.js\"></script></head> Hello World ! </html>')
webui.wait()

Files:

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

How to get webui-2.so?

git clone https://github.com/webui-dev/webui.git cd webui make

Your webui-2.so will be in /webui/dist/webui-2.so

AlbertShown avatar Apr 24 '24 14:04 AlbertShown

If you do this, your manual compiled webui-2.so will work in all old and new Debian based Linux distro (including Ubuntu) where glibc +v2.31 is installed, including new versions of glibc due to the backward compatibility features of glibc. The glibc is designed to ensure that binaries compiled against an older version will continue to function on systems with newer versions.

AlbertShown avatar Apr 24 '24 14:04 AlbertShown

When linux.yml build for Ubuntu, it means it build for all Debian based Linux ditro, not only Ubuntu.

The issue we have with linux.yml it's not Ubuntu itself, but, the issue is it use ubuntu-latest which use also the latest glibc v2.33, that's means the compiled webui-2 will work in all Debian based distro but only if glibc v2.33 is installed. Old Ubuntu/Debian still have glibc v2.31.

Your project should simply be like:

# Import local `webui.py`
import webui
MyWindow = webui.window()
MyWindow.show('<html><head><script src=\"webui.js\"></script></head> Hello World ! </html>')
webui.wait()

Files:

├── main.py
├── webui.py
└── webui-linux-gcc-x64
    └── webui-2.so

How to get webui-2.so?

git clone https://github.com/webui-dev/webui.git cd webui make

Your webui-2.so will be in /webui/dist/webui-2.so

Thanks again, I already did what you mentioned above and it is already running. I just wanted to ask regarding importing but I understand from your message already that it is fine to just use the glibcv2.31 version for if sys.platform == 'linux' since it is fine for all debian. I did the following since I still want to use the remote pip package for other operating systems, e.g. Windows and MacOS. Summary: Thank you a million, everything works now, I am going to create a pull request for the next release too as you mentioned but I never did such thing before, so I am going to learn how to do it meanwhile:

if platform == 'linux':
# I renamed the `webui.py` file as `webui_linux.py`
    import webui_linux as webui 
else:
    from webui import webui

halildgn avatar Apr 24 '24 14:04 halildgn

Oh, sorry, I did not know that your project is targeting Windows and macOS as well. In this case, yes, importing local script only for Linux is the right thing to do. Glad that all works fine 👍

AlbertShown avatar Apr 24 '24 14:04 AlbertShown