Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not install on Ubuntu linux 24.04 (with workaround) #133

Open
KlfJoat opened this issue Sep 10, 2024 · 8 comments
Open

Does not install on Ubuntu linux 24.04 (with workaround) #133

KlfJoat opened this issue Sep 10, 2024 · 8 comments

Comments

@KlfJoat
Copy link

KlfJoat commented Sep 10, 2024

Hi,

I love your tool here.

When I tried following your instructions, I ran into a dependency problem.

To start with, apt install ./filename usually works on Ubuntu to install .debs.

$ sudo apt install ./october_1.10.0_amd64.deb                             
Executing sudo -- bash -x -v -c "apt" 'install' './october_1.10.0_amd64.deb'                        
[sudo] password for klfjoat:                                                                        
"apt" 'install' './october_1.10.0_amd64.deb'                                                        
+ apt install ./october_1.10.0_amd64.deb                                                            
Reading package lists... Done                                                                       
Building dependency tree... Done                                                                    
Reading state information... Done                                                                   
Note, selecting 'october' instead of './october_1.10.0_amd64.deb'                                   
Some packages could not be installed. This may mean that you have                                   
requested an impossible situation or if you are using the unstable                                  
distribution that some required packages have not yet been created                                  
or been moved out of Incoming.                                                                      
The following information may help to resolve the situation:                                        
                                                                                                    
The following packages have unmet dependencies:                                                     
 october : Depends: libwebkit2gtk-4.0-dev but it is not installable                                 
E: Unable to correct problems, you have held broken packages.                                       
100 $

Okay, dependency problem. So I used dpkg -i in case it was a soft dependency.

$ sudo dpkg -i october_1.10.0_amd64.deb                               
Executing sudo -- bash -x -v -c "dpkg" '-i' 'october_1.10.0_amd64.deb'                              
"dpkg" '-i' 'october_1.10.0_amd64.deb'                                                              
+ dpkg -i october_1.10.0_amd64.deb                                                                  
Selecting previously unselected package october.                                                    
(Reading database ... 381473 files and directories currently installed.)                            
Preparing to unpack october_1.10.0_amd64.deb ...                                                    
Unpacking october (1.10.0) ...                                                                      
dpkg: dependency problems prevent configuration of october:                                         
 october depends on libgtk-3-dev; however:                                                          
  Package libgtk-3-dev is not installed.                                                            
 october depends on libwebkit2gtk-4.0-dev; however:                                                 
  Package libwebkit2gtk-4.0-dev is not installed.

dpkg: error processing package october (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.27-2build1) ...
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 october
1 $

So, that didn't work. Unable to find the dependencies. So I checked and sure enough, hard dependencies on specific versions.

$ dpkg --info ./october_1.10.0_amd64.deb
 new Debian package, version 2.0.
 size 5332528 bytes: control archive=311 bytes.
     278 bytes,     9 lines      control
 Package: october
 Version: 1.10.0
 Section: base
 Priority: optional
 Architecture: amd64
 Depends: libgtk-3-dev, libwebkit2gtk-4.0-dev
 Maintainer: Marcus Crane <[email protected]>
 Homepage: https://october.utf9k.net
 Description: A tool for syncing your Kobo highlights with Readwise
$

So I typed this in and tabbed it out to get bash-completion to tell me what versions of libwebkit2 are available on Ubuntu 24.04.

$ apt show libwebkit2gtk-4.
libwebkit2gtk-4.0-37   libwebkit2gtk-4.0-doc  libwebkit2gtk-4.1-0    libwebkit2gtk-4.1-dev
$

FIX ABORTED INSTALL
So I first removed the aborted install...

$ sudo apt --fix-broken install
Executing sudo -- bash -x -v -c "apt" '--fix-broken' 'install'
"apt" '--fix-broken' 'install'                                                                      
+ apt --fix-broken install                     
Reading package lists... Done                                                                       
Building dependency tree... Done                                                                    
Reading state information... Done                                                                   
Correcting dependencies... Done
The following packages will be REMOVED:                                                             
  october                                                                                           
0 upgraded, 0 newly installed, 1 to remove and 14 not upgraded.     
1 not fully installed or removed.                                                                   
After this operation, 0 B of additional disk space will be used.                               
Do you want to continue? [Y/n]                                                                      
(Reading database ... 381480 files and directories currently installed.)              
Removing october (1.10.0) ...                                                                       
dpkg: warning: while removing october, directory '/usr/local/bin' not empty so not removed
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for desktop-file-utils (0.27-2build1) ...
needrestart is being skipped since dpkg has failed 

WORKAROUND INSTALL
Then I installed v4.1 of the dependency and installed October, ignoring dependencies using --force-depends...

$ sudo apt install libwebkit2gtk-4.1-dev
Executing sudo -- bash -x -v -c "apt" 'install' 'libwebkit2gtk-4.1-dev'
"apt" 'install' 'libwebkit2gtk-4.1-dev'
+ apt install libwebkit2gtk-4.1-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libatk-bridge2.0-dev libatk1.0-dev libatspi2.0-dev libcairo2-dev libdatrie-dev libegl1-mesa-dev
  libepoxy-dev libgdk-pixbuf-2.0-dev libglvnd-core-dev libglvnd-dev libgtk-3-dev
  libjavascriptcoregtk-4.1-dev libnghttp2-dev libopengl-dev libpango1.0-dev libpixman-1-dev
  libpsl-dev libsoup-3.0-dev libsqlite3-dev libsysprof-capture-4-dev libthai-dev libxcomposite-dev
  libxdamage-dev libxft-dev libxtst-dev pango1.0-tools
Suggested packages:
  libcairo2-doc libdatrie-doc libgtk-3-doc libnghttp2-doc libpango1.0-doc libsoup-3.0-doc
  sqlite3-doc libthai-doc graphicsmagick
The following NEW packages will be installed:
  libatk-bridge2.0-dev libatk1.0-dev libatspi2.0-dev libcairo2-dev libdatrie-dev libegl1-mesa-dev
  libepoxy-dev libgdk-pixbuf-2.0-dev libglvnd-core-dev libglvnd-dev libgtk-3-dev
  libjavascriptcoregtk-4.1-dev libnghttp2-dev libopengl-dev libpango1.0-dev libpixman-1-dev
  libpsl-dev libsoup-3.0-dev libsqlite3-dev libsysprof-capture-4-dev libthai-dev
  libwebkit2gtk-4.1-dev libxcomposite-dev libxdamage-dev libxft-dev libxtst-dev pango1.0-tools
0 upgraded, 27 newly installed, 0 to remove and 14 not upgraded.
Need to get 3,770 kB of archives.
After this operation, 34.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...blah, blah, blah
Setting up libgtk-3-dev:amd64 (3.24.41-4ubuntu1.1) ...                                              
Setting up libwebkit2gtk-4.1-dev:amd64 (2.44.3-0ubuntu0.24.04.1) ...                                
Processing triggers for man-db (2.12.0-4build2) ...                                                 
Scanning processes...                                                                               
Scanning processor microcode...                                                                     
Scanning linux images...                                                                            
                                                                                                    
Running kernel seems to be up-to-date.                                                              
                                                                                                    
The processor microcode seems to be up-to-date.                                                     
                                                                                                    
No services need to be restarted.                                                                   

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.


$ sudo dpkg -i --force-depends october_1.10.0_amd64.deb 
Executing sudo -- bash -x -v -c "dpkg" '-i' '--force-depends' 'october_1.10.0_amd64.deb'
"dpkg" '-i' '--force-depends' 'october_1.10.0_amd64.deb'
+ dpkg -i --force-depends october_1.10.0_amd64.deb
Selecting previously unselected package october.
(Reading database ... 382705 files and directories currently installed.)
Preparing to unpack october_1.10.0_amd64.deb ...
Unpacking october (1.10.0) ...
dpkg: october: dependency problems, but configuring anyway as you requested:
 october depends on libwebkit2gtk-4.0-dev; however:
  Package libwebkit2gtk-4.0-dev is not installed.

Setting up october (1.10.0) ...
Processing triggers for desktop-file-utils (0.27-2build1) ...
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...

SUGGESTION
I'm not sure if Wallis requires -dev packages to just run an application--that's unusual, but not unheard of. As a longtime linux admin (admittedly, not a programmer), I would suggest three things (pick and choose between them).

  1. Make sure you need the -dev- packages and not just the main package. My host has libwebkit2gtk-4.0-37 available, but not a 4.0-dev available.
  2. See if you can create a more liberal dependency specification. My host has both libwebkit2gtk-4.0-37 & libwebkit2gtk-4.1-0 available. Maybe a spec like Depends: libwebkit2gtk-4.0|libwebkit2gtk-4.1? (ref1, ref2)
  3. libwebkit2gtk-4.1, at the very least, itself depends on libgtk-3 in Debian. So you might be able to skip that dependency.
@marcus-crane
Copy link
Owner

Hey @KlfJoat,

Ah, thanks for that great writeup! You're the first person I'm aware of that has used the Linux version at all. Personally, I'm not running any Linux installs at the moment so I wasn't aware of this.

I probably don't need the -dev versions, I just happened to install those because they worked and I hadn't thought too much about the pinned libwebkit2gtk versions breaking as new OS releases roll out.

It probably doesn't even need to be pinned anyway, just any version of libwebkit2gtk should do the job.

I haven't had much time to look at October lately but I'll spin up my VM sometime and have a look at this

@marcus-crane marcus-crane added bug Something isn't working packaging platform/linux labels Oct 3, 2024
@reality
Copy link

reality commented Dec 3, 2024

Hi,

Same issue, however workaround as given does not work. Get the following error when running: october: error while loading shared libraries: libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory

I was able to run it by following the process referred to here: bambulab/BambuStudio#3973 (comment) (you have to add those statements to the sources, apt update, apt --fix-broken install (or if you don't have a broken october install you can just install it at that point), then remove those entries from the sources list again to make sure terrible things don't happen). As the original reporter mentioned I think it could probably solved relatively easily with some more liberal linking.

Anyway, apart from that small issue, it works great. Thanks for the software, @marcus-crane.

@KlfJoat
Copy link
Author

KlfJoat commented Dec 3, 2024

@reality Adding an old repository like mentioned in that comment can mess up your dpkg database beyond all reasonable attempts to fix it. I would highly recommend against that being the first thing that people try.

Installing the new version of the dependency, then forcing only October to ignore its dependency list, is the best option.

  1. We've limited the scope of what's non-standard to just the October deb. There's no way for something else besides October to be affected by the workaround I proposed. On the other hand, mixing release repos can have strange and sometimes devastating consequences.
  2. Because these are header files (-dev), there is no difference in compatibility where we'd need 4.0-dev-37 exactly. So we don't gain anything by mixing release repos.

@reality
Copy link

reality commented Dec 3, 2024

sure, but like i said in my comment, your workaround doesn't work for me - that is actually why i sought another solution.

@marcus-crane
Copy link
Owner

Heya,

No promises as always since I can't predict the future but I'll see if I can make the linking for libwebkit2gtk a bit less strict this weekend.

As far as Wails (the underlying framework), it seems that the approach some other projects have taken is to just distribute two copies of their projects: one for 4.0 and another for 4.1 which seems kind of wonky.

Wails itself seems to mostly push this issue to the packagers (which I suppose is me in this case) and is looking to lean on AppImage and the like.

I guess I'm learning the hard way why Snap/Flatpak/AppImage are a thing. Personally I don't really like any of them since they always have something wonky about them in my (fairly limited) experience.

@marcus-crane
Copy link
Owner

Heya,

I've had a look around and I think I understand the constraints a lot better now. That said, I haven't had to fiddle with static/dynamic linking stuff in Linux. Given that, I'm building out a mental model of what's going on at the same time as trying to understand a possible fix so you'll have to let me know if I'm misinterpreting anything here.

As a tl;dr, it seems the only real options here are:

  • Create separate deb packages for webkit2gtk 4.0 and 4.1 which is annoying but I don't really see any other way around it
  • Hide all this complexity by setting up an apt repository so the "correct" version can be pulled based on whether you're on a newer or older version of Ubuntu (Debian and other spinoffs might need some consideration)

The rest of this post is just elaborating my understanding of the problem in detail for any interested readers and/or other Wails devs who have probably run into this problem. Feel free to skip the rest if you're not particularly interested.

So, there's a couple issues here tangled together as far as I can tell:

  • October (by way of Wails) is dynamically linked vs statically linked
  • Wails pinned dependency on specific versions of webkit2gtk (4.0/4.1) vs a loose dependency (ie webkit2gtk >= 2.0)
  • Out of date Depends for the control file used to build the deb file

Dynamic vs static linking

If I compile a fresh build of October locally, I can use ldd on the binary to see which libraries it is dynamically linked to, meaning it'll try to pull in these dependencies from my file system as opposed to them being baked into the binary itself.

ldd

As you can see, some of these links are done at the version level so for example, if you had libsoup-2.4 installed, presumably October would crash as it wouldn't be able to resolve that link.1

As a workaround, you could symlink /usr/lib/libsoup-3.0.so.0 to /usr/lib/libsoup-2.4.so.0 and this may work by chance but there's also the likelihood that the API surfaced by that dependency is completely different between 2.4 and 3.0. Given it's a major version, semver would suggest that's more likely than not.

Now, even if the APIs between those two dependency versions were identical (or changes were only adding new functionality, not changing anything existing), there's no guarantee that the ABI for that library hasn't changed. I can't really speak to ABI stuff since I've only been vaguely aware of the term without really reading about it until now.

With all that said, actually trying to produce a fully statically linked application for something that depends on GTK doesn't actually seem to be supported. Even if I were to attempt it, I'm not actually sure that it would functionally work.

It seems that the conventional solution here is to package up everything using Flatpak/AppImage/Snap which solves the dependency issue by stuffing the final build in a container. I'd probably provide those versions for convenience (and the currently unreleased v3 of Wails seems to make this easier than ever) but they're a bit of an apples to oranges comparison for people who like "installing" apps via deb.

Wails hard pinning vs loosening up dependencies

Wails currently supports building against webkit2gtk 4.0 vs 4.1 by way of using build tags.

You can see how this is structured here by way of CGO declarations building certain files based on the installed version of libwebkit2gtk at build time.

From the referenced PR, you can see that there are actually different implementations of the asset server based on what version of libwebkit2gtk exists with functionality being slightly different as a result.

While I'm sure unpinning libwebkit2gtk would be a bad idea purely for the API/ABI reasons mentioned above, I think even if you did that in theory, the resulting compiled binary would still be statically linked to the specific version installed at build time, so it wouldn't actually resolve anything.

Out of date depends in deb

This one I can actually influence and it should be updated to either assert a recent version of webkit2gtk (ie; 4.0||4.1) or match whatever build tag is used.

Actually removing it or modifying it won't change the reality of the application being dynamically linked to a specific version but it'll still assert for the user that they have webkit2gtk installed since October would just crash if they didn't have it installed (rather than prompting them to install it like Windows 10 with webview2 for example)


Another thing mentioned was the requirement for -dev. It seems to be mentioned here and there about it being required although I can't really speak to that. It might be that the end user doesn't specifically need -dev but it's still required at build time in order to do dynamic linking at compile time. Most of that is all abstracted away as a developer honestly.

Anyway, for now, I'll just generate a second deb package with 4.0 vs 4.1 support as a starting point and then potentially iterate towards an apt repository as well as flatpak/snap/appimage support.

I don't think it'd ever be possible to have a single binary/package that supports all webkit2gtk versions (due to dynamic linking) but I do wonder how other non-Wails projects solve this stuff as far as webkit2gtk dependencies.

Footnotes

  1. I'm not actually sure what the crash behaviour is for dynamic links ie; does it hard crash or can it run but malfunction? It'd be easy to test, I just haven't done it at the time of writing.

@marcus-crane
Copy link
Owner

Anyway, just to be a bit more explicit, I'm gonna go for a walk after hurting my brain parsing through all the above but I'll try and generate some builds later today + add some docs around which versions to use.

It'll work as a stop gap to unblock support for newer Ubuntu versions but it does seem a bit like one of those issues where you just have to pick the least worst choice since they all come with tradeoffs

@marcus-crane
Copy link
Owner

I've got some bits of the release pipeline to fix up still but I've generated two versions of the Linux deb package available in this prerelease: https://github.com/marcus-crane/october/releases/tag/v1.10.1-beta2

The non-webkit2gtk4.0 version should work for you.

I'm not entirely sold on the naming scheme for the releases but it'll do for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants