wmww / gtk4-layer-shell

A library to create panels and other desktop components for Wayland using the Layer Shell protocol and GTK4
MIT License
128 stars 4 forks source link

Installation from source didn't work #21

Closed siddharthroy12 closed 10 months ago

siddharthroy12 commented 1 year ago

I cloned the repo, checked out to the 1.0.0 tag, and then ran the necessary commands but the library didn't seem to be in the linker cache

I'm on Fedora

20230528_12h16m40s_grim

siddharthroy12 commented 1 year ago

Ok after some research I found out that RedHat removed /usr/local/lib and /usr/local/lib64 from /etc/ld.so.conf because I could create problems with their package manager.

Running these commands will fix this issue on RedHat based distros

sudo su

echo /usr/local/lib > /etc/ld.so.conf.d/local.conf
echo /usr/local/lib64 > /etc/ld.so.conf.d/local.conf

ldconfig
siddharthroy12 commented 1 year ago

gtk4-layer-demo worked but the python example didn't so I had to install this from a third-party repo

Install Terra repository:

# dnf config-manager --add-repo https://terra.fyralabs.com/terra.repo

Install gtk4-layer-shell rpm package:

# dnf install gtk4-layer-shell

After this python example also worked. You might want to add this in your README

wmww commented 1 year ago

I believe the more common approach is to install to a different directory using the --prefix meson argument (for example meson setup --prefix /usr build). Since we don't change meson's default install directory, this issue probably isn't specific to gtk4-layer-shell.

siddharthroy12 commented 1 year ago

I think it's a good idea to add a warning for fedora users to add this prefix in the README

wmww commented 1 year ago

Hmm, I'm a bit confused. This says on Fedora libraries are located in /usr/local/lib, so why wouldn't installing there work? https://www.tecmint.com/understanding-shared-libraries-in-linux/

siddharthroy12 commented 1 year ago

That blog doesn't mention Fedora anywhere also read these: https://bugzilla.redhat.com/show_bug.cgi?id=144967 https://unix.stackexchange.com/questions/356624/why-isnt-usr-local-lib-on-the-library-path-by-default

Consolatis commented 1 year ago

[..] install to a different directory using the --prefix meson argument (for example meson setup --prefix /usr build).

I don't think it's a good idea to potentially overwrite system libraries, that directory tree usually belongs to the distro repository system. Using /usr/local/ seems like the correct location for applications / libraries that bypass the distro repository. If RH derivatives don't add /usr/local/lib/ and /usr/local/lib64/ to /etc/ld.so.conf{,.d/*.conf} I'd consider that a bug in their distro that might warrant a small reminder in the README to add the user supplied library paths. (And potentially something similar for the Python path, depending on what python3 -c 'import sys; print(sys.path)' says on those systems).

The best solution would obviously be if distros start packaging gtk4-layer-shell themselves.

wmww commented 1 year ago

Python should work without installing anything by setting GI_TYPELIB_PATH and LD_LIBRARY_PATH (as noted at the top of the Python example). Other things should work regardless of where gtk4-layer-shell is installed if PKG_CONFIG_PATH is set correctly.

I'm hesitant to put anything in the readme since there should be nothing different about gtk4-layer-shell than any other library. There's so many different distros and workflows it might just end up confusing people. For example I generally install libraries to an install directory within the project next to the build directory, and then point things to that with PKG_CONFIG_PATH and LD_LIBRARY_PATH as needed.