johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
5.26k stars 256 forks source link

Error when trying to build - "gjs-1.0" not found #1245

Closed BraidenPsiuk closed 4 months ago

BraidenPsiuk commented 5 months ago

Hi, firstly thanks for all your work on Foliate- loving it on both desktop and mobile! I'm looking to use Foliate as a reference to develop my own Adwaita/GJS/Meson/Flatpak app. Following the README, I used

gjs -m src/main.js

and got GJS to successfully run main.js as a module and render the app. But, when trying to build it with

meson setup build

...I ran into the same issue as described in #1073. (Just showing the important bit here, but full log is below)

Run-time dependency gjs-1.0 found: NO (tried pkgconfig and cmake)
meson.build:9:0: ERROR: Dependency "gjs-1.0" not found, tried pkgconfig and cmake

I was using Debian 12, and already had to upgrade GJS through unstable to meet that version requirement- so I figured I would try again using a new, more bleeding-edge setup to see if that would help. So I installed Fedora Silverblue through GNOME Boxes, set up a toolbox (toolbox create && toolbox enter), ran

sudo dnf install gtk4-devel libadwaita-devel webkitgtk6.0

...and I tried to build again, but I'm still having the same "gjs-1.0" not found issue. Installing cmake doesn't seem to matter, at least not during this step. I'm using GJS version 1.78.3, so I believe the version requirement is met... The meson-log.txt file mentions adding GJS to a PKG_CONFIG_PATH env var, does this seem right? (I don't know how to test that exactly) If so, should this step be added to the README?


⬢[dev@toolbox foliate]$ meson setup build
The Meson build system
Version: 1.3.1
Source dir: /var/home/dev/dev/foliate
Build dir: /var/home/dev/dev/foliate/build
Build type: native build
Project name: com.github.johnfactotum.Foliate
Project version: 3.1.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: YES (/usr/bin/pkg-config) 1.9.5
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency gjs-1.0 found: NO (tried pkgconfig)

meson.build:9:6: ERROR: Dependency "gjs-1.0" not found, tried pkgconfig

A full log can be found at /var/home/dev/dev/foliate/build/meson-logs/meson-log.txt
⬢[dev@toolbox foliate]$ cat build/meson-logs/meson-log.txt 
Build started at 2024-02-04T03:52:38.333325
Main binary: /usr/bin/python3
Build Options: 
Python system: Linux
The Meson build system
Version: 1.3.1
Source dir: /var/home/dev/dev/foliate
Build dir: /var/home/dev/dev/foliate/build
Build type: native build
Project name: com.github.johnfactotum.Foliate
Project version: 3.1.0
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Found pkg-config: YES (/usr/bin/pkg-config) 1.9.5
Determining dependency 'gjs-1.0' with pkg-config executable '/usr/bin/pkg-config'
env[PKG_CONFIG_PATH]: 
env[PKG_CONFIG]: /usr/bin/pkg-config
-----------
Called: `/usr/bin/pkg-config --modversion gjs-1.0` -> 1
stderr:
Package gjs-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gjs-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gjs-1.0', required by 'virtual:world', not found
-----------
CMake binary for host machine is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Did not find CMake 'cmake'
Found CMake: NO
Dependency lookup for gjs-1.0 with method 'cmake' failed: CMake binary for machine host machine not found. Giving up.
Run-time dependency gjs-1.0 found: NO (tried pkgconfig)

meson.build:9:6: ERROR: Dependency "gjs-1.0" not found, tried pkgconfig
johnfactotum commented 4 months ago

Don't know. Looks like a problem with pkg-config. Perhaps related to how GJS is packaged.

As a workaround you can just remove the requirements in Meson. Or run it with Flatpak with GNOME Builder, which is probably the easiest option for development.

wscharff commented 4 months ago

@BraidenPsiuk Found it elsewhere but cannot remember. Actually there are two package for gjs in Fedora : gsj (runtime) and gjs-devel (libraries), you need to install the latter to make it work sudo dnf install gjs-devel I also had to download webkitgtk from a fresh install sudo dnf install webkitgtk6.0-devel

hope this will help you

BraidenPsiuk commented 4 months ago

@BraidenPsiuk Found it elsewhere but cannot remember. Actually there are two package for gjs in Fedora : gsj (runtime) and gjs-devel (libraries), you need to install the latter to make it work sudo dnf install gjs-devel I also had to download webkitgtk from a fresh install sudo dnf install webkitgtk6.0-devel

hope this will help you

Just tried what you said, that seemed to work! Unfortunately another very similar error prevented me from continuing:

Run-time dependency webkitgtk-6.0 found: NO (tried pkgconfig)

Even though I thought I already had it installed, since I had already run sudo dnf install webkitgtk6.0

So I followed the same formula and tacked on "devel"... sudo dnf install webkitgtk6.0-devel

Hey look, that works! Made even more progress! Haha. Now the final error I faced:

meson.build:18:6: ERROR: Program 'update-desktop-database' not found or not executable

I am assuming this one is only missing because I am running inside a Fedora SilverBlue toolbox (similar to a container). A quick web search led me to installing desktop-file-utils


Now I am finally able to build Foliate!

Here's the quick list of everything I needed to install in a fresh Fedora toolbox in order to build, for convenience in case anyone else comes across these errors:

sudo dnf install meson gjs-devel gtk4-devel webkitgtk6.0-devel libadwaita-devel desktop-file-utils

Also make sure you have these installed for actually running/testing:

sudo dnf install gjs gtk4 webkitgtk6.0 libadwaita

Thank you both for your help and suggestions!