meson.build ERROR: Dependency "gtk+-2.0" not found

Technical issues/questions of an intermediate or advanced nature.
User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#1 by Rava » 03 Oct 2023, 21:11

My System Port 5.0 with 05-devel activated:

Code: Select all

guest@rava:/$ cat /etc/porteus/*
001-core.xzm:20221211
002-xorg.xzm:20221211
002-xtra.xzm:20221211
003-xfce.xzm:20220925
initrd.xz:20220928
the activated 05-devel's md5sum:

Code: Select all

4ad2c0217ec914cb02aab3b77fd55fe5  05-devel.xzm
I try to compile the newest version of viewnior - 1.8 - and get this error:

Code: Select all

root@rava:/mybin/linux/viewnior/1.8/Viewnior-viewnior-1.8# meson --prefix=/usr builddir
The Meson build system
Version: 0.59.4
Source dir: /mybin/linux/viewnior/1.8/Viewnior-viewnior-1.8
Build dir: /mybin/linux/viewnior/1.8/Viewnior-viewnior-1.8/builddir
Build type: native build
Project name: viewnior
Project version: 1.8
C compiler for the host machine: cc (gcc 11.2.0 "cc (GCC) 11.2.0")
C linker for the host machine: cc ld.bfd 2.37-slack15
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (GCC) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.37-slack15
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Found CMake: /usr/bin/cmake (3.21.4)
Run-time dependency gtk+-2.0 found: NO (tried pkgconfig and cmake)

meson.build:25:0: ERROR: Dependency "gtk+-2.0" not found, tried pkgconfig and cmake

A full log can be found at /mybin/linux/viewnior/1.8/Viewnior-viewnior-1.8/builddir/meson-logs/meson-log.txt
Where do I get Dependency "gtk+-2.0" and where do I install it to?

Should I post snippets of /mybin/linux/viewnior/1.8/Viewnior-viewnior-1.8/builddir/meson-logs/meson-log.txt ?
Tried looking for "gtk+-2.0" online via duckduckgo but sadly found nothing helpful. :(
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#2 by beny » 03 Oct 2023, 22:06


User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#3 by Rava » 03 Oct 2023, 22:44

Thanks beny, that did the trick. :friends:

But I am not 100% happy with the result.
I hacked the C source code to change the maximum slideshow pause from 30 to 99 seconds, and it works as intended.
Image
:)

But the size of the resulting binary is abysmal.

this is the one from viewnior-gtk3-1.7-x86_64-2ncm package / module:

Code: Select all

-rwxr-xr-x 1 root 162528 2021-09-22 14:42 viewnior
and this is the one I just compiled. Main difference is mine is GTK2 but I prefer it since GTK2 applications seem to run more efficient compared to GTL3 ones. And its v1.8 compared to 1.7

But why is it so much larger?

Code: Select all

-rwxr-xr-x 1 root 769384 2023-10-04 00:17 viewnior
More than 4.7 in size.

The problem, there seems to be more than one maintainer of the same program and I choose the branch that seems to be most up-to-date. But what do I know about how that variant is maintained.

These are the directions I followed for compiling from source
https://siyanpanayotov.com/project/view ... ource-code

Anyone any ideas how I can decrease the size of the binary? Aside from its size, it seems to work flawlessly (and of course now supports the pause between images in slideshow from 1 to 99 seconds, where all other versions only supported 1 to 30 seconds.)

And here the diff of the hacked C file:

Code: Select all

root@rava:/tmp# diff vnr-window*
488c488
<     spinner_adj = (GtkAdjustment *) gtk_adjustment_new (window->prefs->slideshow_timeout, 1.0, 99.0, 1.0, 1.0, 0);
---
>     spinner_adj = (GtkAdjustment *) gtk_adjustment_new (window->prefs->slideshow_timeout, 1.0, 30.0, 1.0, 1.0, 0);
As you can see, a most minimal of hacks. :oops:
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#4 by beny » 03 Oct 2023, 23:19

hi Rava mine is 760kb but i have done it in porteux current and with glibc changed 2.38

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3941
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#5 by ncmprhnsbl » 04 Oct 2023, 02:37

here's the slackbuild i used for my package..
the version is somewhat arbitrary since it's just pulled from BwackNinja's git fork..
the size difference could be due to the config line: --optimization=2 and/or the standard binary strip of slackbuild further down..
it would be easy enough to adapt this to whatever source you prefer.. and add whatever patches..

Code: Select all

#!/bin/sh

# Slackbuild for viewnior

PRGNAM=viewnior
SRCNAM=Viewnior-master
VERSION=${VERSION:-1.7}
BUILD=${BUILD:-3}
TAG=ncm
SRC_ARCHIVE=${SRC_ARCHIVE:-zip}
URL="https://github.com/BwackNinja/Viewnior/archive/refs/heads/master.${SRC_ARCHIVE}"

[ -e master.${SRC_ARCHIVE} ] || wget -c $URL || exit 1

NPROCS=$(cat /proc/cpuinfo | grep processor | wc -l)

ARCH="$(uname -m)"
#ARCH="x86_64"
#ARCH="arm"
#ARCH="x86"

CWD=$(pwd)
TMP=${TMP:-/tmp/JSB}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686 -DNDEBUG"
  ARCH="i586"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC -DNDEBUG"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -DNDEBUG"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM
unzip $CWD/master.${SRC_ARCHIVE}
cd $SRCNAM
chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

patch -Np1 -i "${CWD}/fix-use-after-free-multi-file.patch.txt"

sed -i '/^MimeType=/ s/$/image\/webp;/' data/viewnior.desktop.in

meson \
  --prefix=/usr \
  --optimization=2 \
  -Ddebug=false \
  --libdir=lib${LIBDIRSUFFIX} \
  --mandir=/usr/man \
  build

  ninja -C build
  DESTDIR=$PKG ninja -C build install
  
cd ..

find $PKG | xargs file | grep -e "executable" -e "shared object" \
  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-gtk3-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
here's the fix-use-after-free-multi-file.patch.txt, if that's needed

Code: Select all

diff --git a/src/vnr-file.c b/src/vnr-file.c
index d57b0b5..382df67 100644
--- a/src/vnr-file.c
+++ b/src/vnr-file.c
@@ -275,7 +275,7 @@ vnr_file_load_uri_list (GSList *uri_list, GList **file_list, gboolean include_hi
 
                 new_vnrfile->mtime = g_file_info_get_attribute_uint64 (fileinfo, G_FILE_ATTRIBUTE_TIME_MODIFIED);
 
-                new_vnrfile->path = p_path;
+                new_vnrfile->path = g_strdup (p_path);
 
                 *file_list = g_list_prepend(*file_list, new_vnrfile);
             }
..and btw, gtk2 is available via 'Bundles'
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#6 by Rava » 04 Oct 2023, 06:06

ncmprhnsbl wrote:
04 Oct 2023, 02:37
..and btw, gtk2 is available via 'Bundles'
Yeah, i should have looked into that.

Thanks a lot for the two code snippets, much appreciated.
ncmprhnsbl wrote:
04 Oct 2023, 02:37
it's just pulled from BwackNinja's git fork.
I used https://github.com/hellosiyan/Viewnior/ ... 1.8.tar.gz as by the link in post #3 above. :D But the C source should not be the issue here. (Hopefully)

BTW, how can I determine why 05-devel won't let me deactivate it?

Code: Select all

root@rava:/mnt/live/memory/images# deactivate 05-devel.xzm
05-devel.xzm: The module can't be removed, because it's busy (used).
Updating shared library links:  /sbin/ldconfig
Updating MIME database:  /usr/bin/update-mime-database /usr/share/mime
Updating GDK pixbuf loaders: /usr/bin/update-gdk-pixbuf-loaders
Updating GDK pixbuf loaders: /usr/bin/update-gdk-pixbuf-loaders
root@rava:/mnt/live/memory/images# 
tried figuring out which program is open via

Code: Select all

top -bn 1
but to no avail. :(


BTW² - when you both use viewnior, why is there no DE with it included and/or why is there no official viewnior module available? (Or did I once more just not find these?)
I use it since the dark ages of Porteus 2.x since I prefer it over any other image viewer.

Added in 35 minutes 14 seconds:
BTW³

Code: Select all

NPROCS=$(cat /proc/cpuinfo | grep processor | wc -l)
This results in "8" on my system, but is that correct for my system?
I have a 4 code CPU, each core is able to handle 2 tasks at once. So max CPU% of 800, but only 4 cores visible via

Code: Select all

sensors
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#7 by Rava » 04 Oct 2023, 08:11

ncmprhnsbl I altered the viewnior.slackbuild like so:

Code: Select all

TMP=${TMP:myviewior/RAVA}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:myviewior/}
since I want the downloaded and extracted files on my hard drive, not on my /tmp/ - so that I can patch the vnr-window.c prior the compilation.

But seems I am too stupid to understand the used bash code. I have no clue where the .slackbuild put the downloaded file or extracted the file into.
It should have been ./myviewior/ or ./myviewior/RAVA but there is no such folder as ./myviewior/ ???

Added in 1 minute 52 seconds:
and variable $TMP is empty, of course:

Code: Select all

root@rava:/mybin/linux/viewnior# echo $TMP

root@rava:/mybin/linux/viewnior# 
Cheers!
Yours Rava

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3941
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#8 by ncmprhnsbl » 05 Oct 2023, 00:34

Rava wrote:
04 Oct 2023, 08:13
ncmprhnsbl I altered the viewnior.slackbuild like so:
well the one difference i see is the missing dash after the colon..

Code: Select all

TMP=${TMP:-myviewior/RAVA}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-myviewior/}
but you can simply have:

Code: Select all

TMP=myviewior/RAVA
PKG=$TMP/package-$PRGNAM
OUTPUT=myviewior/
in my case, the archive downloads to the dir where the slackbuild is, ie. pwd, since that's usually where it should be run from.
Rava wrote:
04 Oct 2023, 06:41
This results in "8" on my system, but is that correct for my system?
I have a 4 code CPU, each core is able to handle 2 tasks at once. So max CPU% of 800, but only 4 cores visible via
:), you answer yourself: "each core is able to handle 2 tasks at once" 4 cores, 8 threads. = 100% of cpu compiling.
Rava wrote:
04 Oct 2023, 06:41
BTW² - when you both use viewnior, why is there no DE with it included and/or why is there no official viewnior module available? (Or did I once more just not find these?)
I use it since the dark ages of Porteus 2.x since I prefer it over any other image viewer.
003-openbox has it ..
in my custom setups i tend to use pqiv https://github.com/phillipberndt/pqiv
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#9 by Rava » 05 Oct 2023, 01:49

Since I am on Porteus 5.0.1 I have to wait until I find its 05-devel. See this post: Porteus-v5.01 bug reports (Post by Rava #96124)
Until then I have to wait. :coffee:

Added in 5 minutes 25 seconds:
I edited the viewnior.slackbuild

Code: Select all

TMP=myviewior/RAVA
PKG=$TMP/package-$PRGNAM
OUTPUT=myviewior/
(thanks ncmprhnsbl )
and exited the process via "exit 0" after these lines:

Code: Select all

patch -Np1 -i "${CWD}/fix-use-after-free-multi-file.patch.txt"

sed -i '/^MimeType=/ s/$/image\/webp;/' data/viewnior.desktop.in
to apply my manual hack of vnr-window.c

Then I use "if false; then" to skip the download and extract part and go right to this line

Code: Select all

meson \
  --prefix=/usr \
  --optimization=2 \
But that part has to wait like I wrote above until I get 05-devel of Port 5.0.1.

Added in 5 hours 17 seconds:
Got some errors in the end:

Code: Select all

root@rava:/mybin/linux/viewnior# ./viewnior.slackbuild 
The Meson build system
Version: 0.59.4
Source dir: /mybin/linux/viewnior/myviewior/RAVA/Viewnior-master
Build dir: /mybin/linux/viewnior/myviewior/RAVA/Viewnior-master/build
Build type: native build
Project name: viewnior
Project version: 1.7
C compiler for the host machine: cc (gcc 11.2.0 "cc (GCC) 11.2.0")
C linker for the host machine: cc ld.bfd 2.37-slack15
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (GCC) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.37-slack15
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Run-time dependency gtk+-3.0 found: YES 3.24.33
Run-time dependency glib-2.0 found: YES 2.70.3
Run-time dependency gio-2.0 found: YES 2.70.3
Run-time dependency shared-mime-info found: YES 2.1
Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.6
Run-time dependency exiv2 found: YES 0.27.5
Configuring config.h using configuration
Program desktop-file-validate found: YES (/usr/bin/desktop-file-validate)
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Program glib-genmarshal found: YES (/usr/bin/glib-genmarshal)
Program meson_post_install.py found: YES (/usr/bin/python3 /mnt/sda2/bin/linux/viewnior/myviewior/RAVA/Viewnior-master/meson_post_install.py)
Build targets in project: 7

Found ninja-1.10.2 at /usr/bin/ninja
ninja: Entering directory `build'
[1/21] Generating uni-marshal_h with a custom command
INFO: Reading ../src/uni-marshal.list...
[2/21] Generating uni-marshal_c with a custom command
INFO: Reading ../src/uni-marshal.list...
[21/21] Linking target src/viewnior
ninja: Entering directory `build'
[0/1] Installing files.
Installing subdir /mybin/linux/viewnior/myviewior/RAVA/Viewnior-master/data/icons/16x16/apps to myviewior/RAVA/package-viewnior/usr/share/icons/hicolor/16x16/apps
Traceback (most recent call last):
  File "/usr/lib64/python3.9/site-packages/mesonbuild/mesonmain.py", line 228, in run
    return options.run_func(options)
  File "/usr/lib64/python3.9/site-packages/mesonbuild/minstall.py", line 720, in run
    installer.do_install(datafilename)
  File "/usr/lib64/python3.9/site-packages/mesonbuild/minstall.py", line 511, in do_install
    self.install_subdirs(d, dm, destdir, fullprefix) # Must be first, because it needs to delete the old subtree.
  File "/usr/lib64/python3.9/site-packages/mesonbuild/minstall.py", line 540, in install_subdirs
    self.do_copydir(d, i.path, full_dst_dir, i.exclude, i.install_mode, dm)
  File "/usr/lib64/python3.9/site-packages/mesonbuild/minstall.py", line 445, in do_copydir
    raise ValueError(f'dst_dir must be absolute, got {dst_dir}')
ValueError: dst_dir must be absolute, got myviewior/RAVA/package-viewnior/usr/share/icons/hicolor/16x16/apps
FAILED: meson-install 
/usr/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.
but it compiled okay. Smaller than my 1.8 version:
210088 bytes (205.16 KB) - but I wanted it as GTK2 - and I presume that version I just compiled is a GTK3 one.

I will try again using the other source code that previously compiled into the too large executable using the almost same ./viewnior.slackbuild - I will have to tweak it even ore reflecting the other paths of the other source code.

Wish me luck.

But that version I just compiled, the 205.16 KB one, is also able to have a max pause between images of 99 seconds, just as planned. B)
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

meson.build ERROR: Dependency "gtk+-2.0" not found

Post#10 by Rava » 05 Oct 2023, 07:09

:coffee: For now the attempt to compile the GTK2 1.8 version fails using the slackbuild:

Code: Select all

root@rava:/mybin/linux/viewnior# ./viewnior1.8.slackbuild 
patching file src/vnr-file.c
patch unexpectedly ends in middle of line
Hunk #1 FAILED at 275.
1 out of 1 hunk FAILED -- saving rejects to file src/vnr-file.c.rej
Seems that patch is for the other 1.7 version only and not works on the other source code. :wall:

What I could do is do my own diff of the original 1.7 src/vnr-file.c and the successfully patched src/vnr-file.c and manually apply the patch to the 1.8 src/vnr-file.c (when applicable, that is) and leave out the

Code: Select all

patch -Np1 -i "${CWD}/fix-use-after-free-multi-file.patch.txt"
line.
What are your thoughts?

Added in 3 minutes 46 seconds:
Enough messing up my system for now :%) (see the Xfce panel vanished and i/O errors here Porteus-v5.01 bug reports ) I call it a day, compiling-wise, will restart and manually check the source code via the diff as described above and maybe try again some other day.
Cheers!
Yours Rava

Post Reply