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

gimp: Testing dev version with Meson #67576

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Aug 27, 2019

Trying to see if we need any changes on Darwin.

Depends on #73833

closes #333800

@jtojnar jtojnar added the 2.status: wait-for-upstream Waiting for upstream fix (or their other action). label Sep 9, 2019
@jtojnar jtojnar mentioned this pull request Oct 31, 2019
1 task
@jtojnar
Copy link
Member Author

jtojnar commented Nov 5, 2019

The gjs failure will require #72805

];

buildInputs = [
python3
Copy link
Contributor

@worldofpeace worldofpeace Nov 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this won't work if it ends up in a shebang for darwin (because wrappers).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bah. Hoping for C wrappers before GIMP 3 is released.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good news! makeBinaryWrapper is a thing now: #124556

@jtojnar
Copy link
Member Author

jtojnar commented Dec 13, 2019

@GrahamcOfBorg eval

@jtojnar
Copy link
Member Author

jtojnar commented May 2, 2024

I rebased to resolve the conflicts, skimmed the upstream changes and merged the update but for some reason that does not build.

The previous GIMP revision still builds fine if I apply https://gitlab.gnome.org/GNOME/gimp/-/commit/a4f02398188bc36d1808ef802082b3856cc73741 as a patch but the latest one does not. I reverted for that for now.

It appears to fail at running GIMP at build time (https://gitlab.gnome.org/GNOME/gimp/-/commit/354970c0ebb5b2af706b6b5aea16d4a19b2dd0ea makes that failure visible) and at test time.

I tried to bisect it but did not succeed. It resulted in a translation commit that obviously cannot be causing the issue:

Bisection log
# bad: [254d4270e6084f6794e737c561d9a5460df9df4c] Updated Italian translation
# good: [ad7a2e53eb72ef471566fa2d0ce9faeec929fbcf] Update Slovenian translation
git bisect start '254d4270e6084f6794e737c561d9a5460df9df4c' 'ad7a2e53eb72ef471566fa2d0ce9faeec929fbcf'
# bad: [220362bf056ed71f2994cb99c5cbc6d370ae8c50] Update Basque translation
git bisect bad 220362bf056ed71f2994cb99c5cbc6d370ae8c50
# bad: [b43a7f5635ad575f63b59e4b2c4d9183df9f529d] Update Slovenian translation
git bisect bad b43a7f5635ad575f63b59e4b2c4d9183df9f529d
# bad: [b43a7f5635ad575f63b59e4b2c4d9183df9f529d] Update Slovenian translation
git bisect bad b43a7f5635ad575f63b59e4b2c4d9183df9f529d
# bad: [521a8613d65138ddff116dc26e82c7095e452798] Update Slovenian translation
git bisect bad 521a8613d65138ddff116dc26e82c7095e452798
# bad: [ed8a4f74105e0db17615873760ce0c4100c3ed76] app: fix a segfault which may happen randomly.
git bisect bad ed8a4f74105e0db17615873760ce0c4100c3ed76
# bad: [91d2d416f19b85dddf0033c48acacf2ce15fbe55] Update Basque translation
git bisect bad 91d2d416f19b85dddf0033c48acacf2ce15fbe55
# bad: [4d56ad943c781b6e0786c2f11a449f58fc0768a7] Revert "Update Persian translation"
git bisect bad 4d56ad943c781b6e0786c2f11a449f58fc0768a7
# bad: [e7695c2b57244d673f1e8db76104c7d92f415e60] plug-ins: Port file-tga widgets to use...
git bisect bad e7695c2b57244d673f1e8db76104c7d92f415e60
# good: [ad2aca633f71e4283a12a609c6356f416dbd9c6c] Update Ukrainian translation
git bisect good ad2aca633f71e4283a12a609c6356f416dbd9c6c
# bad: [be026d4cbafc40965eda9924eedf0fbdcafc7c68] Update Georgian translation
git bisect bad be026d4cbafc40965eda9924eedf0fbdcafc7c68
# bad: [51a511279391010d0381d26a2464c1d7e7ccfe46] Update Slovenian translation
git bisect bad 51a511279391010d0381d26a2464c1d7e7ccfe46
# bad: [d3560e1eb89fea2bbd8471ddceec55bdbbaf7996] Update Georgian translation
git bisect bad d3560e1eb89fea2bbd8471ddceec55bdbbaf7996
# first bad commit: [d3560e1eb89fea2bbd8471ddceec55bdbbaf7996] Update Georgian translation
Patch to facilitate bisection
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
index ffb40331d952..ff8229def450 100644
--- a/pkgs/applications/graphics/gimp/default.nix
+++ b/pkgs/applications/graphics/gimp/default.nix
@@ -89,15 +89,16 @@ in stdenv.mkDerivation (finalAttrs: {
   # We should not use fetchFromGitLab because the build system
   # will complain and mark the build as unsupported when it cannot find
   # .git directory but downloading the whole repo is jus too much.
-  src = fetchFromGitHub rec {
-    name = "gimp-dev-${rev}"; # to make sure the hash is updated
-    owner = "GNOME";
-    repo = "gimp";
-    rev = "254d4270e6084f6794e737c561d9a5460df9df4c";
-    hash = "sha256-dCddCFCRDTT4iY+kepKKu413ezWOMEQ1m4hxBptBCfU=";
-    # For gimp-data containing assets.
-    fetchSubmodules = true;
-  };
+  # src = fetchFromGitHub rec {
+  #   name = "gimp-dev-${rev}"; # to make sure the hash is updated
+  #   owner = "GNOME";
+  #   repo = "gimp";
+  #   rev = "254d4270e6084f6794e737c561d9a5460df9df4c";
+  #   hash = "sha256-dCddCFCRDTT4iY+kepKKu413ezWOMEQ1m4hxBptBCfU=";
+  #   # For gimp-data containing assets.
+  #   fetchSubmodules = true;
+  # };
+  src = /home/jtojnar/Projects/gimp;
 
   patches = [
     # to remove compiler from the runtime closure, reference was retained via
@@ -226,7 +227,7 @@ in stdenv.mkDerivation (finalAttrs: {
     # Requires neweer appstreamcli and not necessary
     "-Dappdata-test=disabled"
     # Not yet packaged.
-    "-Dilbm=disabled"
+    # "-Dilbm=disabled"
   ] ++ lib.optionals stdenv.isDarwin [
     "-Dalsa=disabled"
     "-Djavascript=false"
@@ -250,11 +251,22 @@ in stdenv.mkDerivation (finalAttrs: {
       app/tests/create_test_env.sh \
       tools/gimp-mkenums
 
+    export NIX_CFLAGS_COMPILE=$(echo "$NIX_CFLAGS_COMPILE" | sed "s/ -Wno-incompatible-function-pointer-types//g")
+    echo "====$NIX_CFLAGS_COMPILE"
+
     # Bypass the need for downloading git archive.
-    substitute app/git-version.h.in git-version.h \
-      --subst-var-by GIMP_GIT_VERSION "GIMP_2.99.?-g${builtins.substring 0 10 finalAttrs.src.rev}" \
-      --subst-var-by GIMP_GIT_VERSION_ABBREV "${builtins.substring 0 10 finalAttrs.src.rev}" \
-      --subst-var-by GIMP_GIT_LAST_COMMIT_YEAR "${builtins.head (builtins.match ".+\-unstable-([0-9]{4})-[0-9]{2}-[0-9]{2}" finalAttrs.version)}"
+  '';
+    # substitute app/git-version.h.in git-version.h \
+    #   --subst-var-by GIMP_GIT_VERSION "GIMP_2.99.?-g${builtins.substring 0 10 finalAttrs.src.rev}" \
+    #   --subst-var-by GIMP_GIT_VERSION_ABBREV "${builtins.substring 0 10 finalAttrs.src.rev}" \
+    #   --subst-var-by GIMP_GIT_LAST_COMMIT_YEAR "${builtins.head (builtins.match ".+\-unstable-([0-9]{4})-[0-9]{2}-[0-9]{2}" finalAttrs.version)}"
+
+  preBuild = ''
+    # Generating gimp-data/images/gimp-splash.png using tools/in-build-gimp.sh appears to run gimp, which complains:
+    # Failed to create the data directory '/homeless-shelter/.local/share': Permission denied
+    export HOME="$(mktemp -d)"
+
+    templaterc="$out/etc/gimp/3.0/templaterc"
   '';
 
   preCheck = ''
diff --git a/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch b/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch
index 13e37da3bd24..6cb261d84ff0 100644
--- a/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch
+++ b/pkgs/applications/graphics/gimp/hardcode-plugin-interpreters.patch
@@ -1,8 +1,8 @@
 --- a/plug-ins/python/pygimp.interp.in
 +++ b/plug-ins/python/pygimp.interp.in
 @@ -2,4 +2,4 @@ python=@PYTHON_PATH@
- python3=@PYTHON_PATH@python.exe
- /usr/bin/python=@PYTHON_PATH@python.exe
- /usr/bin/python3=@PYTHON_PATH@python.exe
+ python3=@PYTHON_PATH@
+ /usr/bin/python=@PYTHON_PATH@
+ /usr/bin/python3=@PYTHON_PATH@
 -:Python:E::py::python3:
 +:Python:E::py::@python_interpreter@:

@emilazy
Copy link
Member

emilazy commented Jul 29, 2024

Hi @jtojnar, I’m interested in working on this as part of getting rid of the remnants of GTK 2 and Python 2. Do you want to discuss the current state of things or should I just have a go at getting it working?

@9p4
Copy link
Contributor

9p4 commented Jul 29, 2024

My GIMP 2.99.18 compiles fine: https://git.sr.ht/~fd/nix-configs/tree/main/item/pkgs/gimp-devel (applied patches from AUR)

@emilazy
Copy link
Member

emilazy commented Jul 29, 2024

Thank you @9p4! I will certainly take a look at that.

@ulysses4ever
Copy link
Contributor

git.sr.ht/~fd/nix-configs#gimp-devel works great for me, thank you! I run it on Sway with Xwayland disabled, so the "normal" released version of Gimp from nixpkgs-24.05 gives me the pesky Cannot open display: .

One issue with this gimp-devel is that it crashes on exit for me. It doesn't make my life any harder but just wanted to share it...

❯ nix run https://git.sr.ht/~fd/nix-configs/archive/c1230e2f6383a8982d74475b20219b9455b42ffe.tar.gz#gimp-devel
This is a development version of GIMP.  Debug messages may appear here.

gimp_font_factory_load_names: 141 unsupported fonts were ignored. Set the GIMP_DEBUG_FONTS environment variable for a listing.
set device 'Wayland Pointer' to mode: disabled
/usr/bin/env: ‘gimp-script-fu-interpreter-3.0’: No such file or directory
GIMP-WARNING: gimp: gimp_wire_read(): error

/usr/bin/env: ‘gimp-script-fu-interpreter-3.0’: No such file or directory
GIMP-WARNING: gimp: gimp_wire_read(): error

/nix/store/zmlwq0ijfmz9rf9m46zbikam92cszc34-gimp-2.99.18/lib/gimp/2.99/plug-ins/python-console/pyconsole.py:165: SyntaxWarning: invalid escape sequence '\w'
  self.nonword_re = re.compile("[^\w\._]")
double free or corruption (fasttop)
/nix/store/zmlwq0ijfmz9rf9m46zbikam92cszc34-gimp-2.99.18/lib/gimp/2.99/extensions/org.gimp.extension.goat-exercises/goat-exercise-lua.lua: fatal error: Aborted
/nix/store/zmlwq0ijfmz9rf9m46zbikam92cszc34-gimp-2.99.18/lib/gimp/2.99/extensions/org.gimp.extension.goat-exercises/goat-exercise-lua.lua (pid:754467): [E]xit, show [S]tack trace or [P]roceed: jpeg-load: found Exif block (9166 bytes)
set device 'Wayland Wheel Scrolling' to mode: disabled
jpeg-load: found Exif block (9156 bytes)
jpeg-save: saving image comment (17 bytes)
/nix/store/zmlwq0ijfmz9rf9m46zbikam92cszc34-gimp-2.99.18/bin/gimp: fatal error: Segmentation fault
Cannot access memory at address 0x162d
Cannot access memory at address 0x1625
Cannot access memory at address 0x1625
Cannot access memory at address 0x162d
Cannot access memory at address 0x162d
Cannot access memory at address 0x1625
Cannot access memory at address 0x1625

(script-fu:754514): LibGimpBase-WARNING **: 09:37:54.296: script-fu: gimp_wire_read(): error

@paperdigits paperdigits mentioned this pull request Aug 11, 2024
17 tasks
@wildwestrom
Copy link

Something must have changed recently, but one of the tests fails to pass when building.

nix-build https://github.com/jtojnar/nixpkgs/archive/gimp-meson.tar.gz -A gimp
# or
nix run "github:jtojnar/nixpkgs/gimp-meson#gimp"
Summary of Failures:

 9/10 gimp:app / save-and-export                         FAIL             7.23s   (exit status 139 or signal 11 SIGSEGV)

Ok:                 7
Expected Fail:      0
Fail:               1
Unexpected Pass:    0
Skipped:            2
Timeout:            0

Full log written to /build/gimp-dev-ad7a2e53eb72ef471566fa2d0ce9faeec929fbcf/build/meson-logs/testlog.txt
error: builder for '/nix/store/rz2qammxp0lvlm9yf9ap4j27pf8354jb-gimp-2.99.14-unstable-2023-03-17.drv' failed with exit code 1;
       last 10 log lines:
       >  9/10 gimp:app / save-and-export                         FAIL             7.23s   (exit status 139 or signal 11 SIGSEGV)
       >
       > Ok:                 7
       > Expected Fail:      0
       > Fail:               1
       > Unexpected Pass:    0
       > Skipped:            2
       > Timeout:            0
       >
       > Full log written to /build/gimp-dev-ad7a2e53eb72ef471566fa2d0ce9faeec929fbcf/build/meson-logs/testlog.txt
       For full logs, run 'nix log /nix/store/rz2qammxp0lvlm9yf9ap4j27pf8354jb-gimp-2.99.14-unstable-2023-03-17.drv'.

Shall I upload a more complete log?

jtojnar and others added 16 commits August 23, 2024 03:27
Co-Authored-By: Linus Heckemann <git@sphalerite.org>
https://www.gimp.org/news/2022/08/27/gimp-2-99-12-released/
GNOME/gimp@256b2d9...a791151

Introduces `gimp-script-fu-interpreter-3.0` as interpreter invoked by shebang of some plug-ins. Let’s ensure it is on `PATH`.
GNOME GitLab instance fails with “fatal: the remote end hung up unexpectedly”
GNOME/gimp@ad7a2e5...254d427

- gimp config for tests separated 2f9881c03fdfc09d3d51ecf93bc8f0abd1c162c9
- gimp images moved to gimp-data 42171503d4793612ca35919c517f057c68e35bcd
- new testing framework 7b43a7492f9dfe8761beb25fe4e24b48d60ff314
- libiblm support ab93a1484a0784943e7cd7421c05f63a1e91c968
- allow running uninstalled 9e9fe1435af3758f856b6bb15f9efd404a4e11d7
This is already part of gimp master but that does not build yet.
…-01"

This reverts commit ef9dec5a14ea5dc7dcf49abc12d62ed93309b8e8.
@jtojnar
Copy link
Member Author

jtojnar commented Aug 23, 2024

Rebased onto nixos-unstable and updated to latest GIMP commit. Also fixed the issue that prevented GIMP from running at build time (it requires typelibs to be installed due to our gobject-introspection patches).

It appears to work, though lua goat exercises crash at the moment:

double free or corruption (fasttop)
/nix/store/51mnmsq61f5z4yp9i8f5x0j2xglbx478-gimp-2.99.18-unstable-2024-08-22/lib/gimp/3.0/extensions/org.gimp.extension.goat-exercises/goat-exercise-lua.lua: fatal error: Aborted
/nix/store/51mnmsq61f5z4yp9i8f5x0j2xglbx478-gimp-2.99.18-unstable-2024-08-22/lib/gimp/3.0/extensions/org.gimp.extension.goat-exercises/goat-exercise-lua.lua (pid:392138): [E]xit, show [S]tack trace or [P]roceed: s
"/nix/store/51mnmsq61f5z4yp9i8f5x0j2xglbx478-gimp-2.99.18-unstable-2024-08-22/lib/gimp/3.0/extensions/org.gimp.extension.goat-exercises/goat-exercise-lua.lua": not in executable format: file format not recognized
warning: File "/nix/store/7lr9qdizm42pf6clysg7syrky0si8aab-glib-2.80.4/lib/libgobject-2.0.so.0.8000.4-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/nix/store/jfilhsiqdgm4nks2z6labx3iq9qd077a-gcc-13.3.0-lib".
warning: File "/nix/store/7lr9qdizm42pf6clysg7syrky0si8aab-glib-2.80.4/lib/libglib-2.0.so.0.8000.4-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/nix/store/jfilhsiqdgm4nks2z6labx3iq9qd077a-gcc-13.3.0-lib".

# Stack traces obtained from PID 392138 - Thread 392138 #

[New LWP 392143]
[New LWP 392142]
[New LWP 392140]
[New LWP 392139]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libthread_db.so.1".
0x00007fb62cb353dc in read () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
To enable execution of this file add
	add-auto-load-safe-path /nix/store/7lr9qdizm42pf6clysg7syrky0si8aab-glib-2.80.4/lib/libgobject-2.0.so.0.8000.4-gdb.py
line to your configuration file "/home/jtojnar/.config/gdb/gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/jtojnar/.config/gdb/gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
  Id   Target Id                                         Frame 
* 1    Thread 0x7fb62ca32280 (LWP 392138) "lua"          0x00007fb62cb353dc in read () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
  2    Thread 0x7fb6234006c0 (LWP 392143) "dconf worker" 0x00007fb62cb34d1f in poll () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
  3    Thread 0x7fb623e006c0 (LWP 392142) "gdbus"        0x00007fb62cb34d1f in poll () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
  4    Thread 0x7fb629c006c0 (LWP 392140) "gmain"        0x00007fb62cb34d1f in poll () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
  5    Thread 0x7fb62a6006c0 (LWP 392139) "pool-spawner" 0x00007fb62cb40ded in syscall () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
#0  0x00007fb62cb353dc in read () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#1  0x00007fb6293e5a06 in gimp_stack_trace_print () from /nix/store/51mnmsq61f5z4yp9i8f5x0j2xglbx478-gimp-2.99.18-unstable-2024-08-22/lib/libgimpbase-3.0.so.0
No symbol table info available.
#2  0x00007fb6293e6148 in gimp_stack_trace_query () from /nix/store/51mnmsq61f5z4yp9i8f5x0j2xglbx478-gimp-2.99.18-unstable-2024-08-22/lib/libgimpbase-3.0.so.0
No symbol table info available.
#3  0x00007fb629c4a80a in gimp_plugin_sigfatal_handler () from /nix/store/51mnmsq61f5z4yp9i8f5x0j2xglbx478-gimp-2.99.18-unstable-2024-08-22/lib/libgimp-3.0.so.0
No symbol table info available.
#4  <signal handler called>
No symbol table info available.
#5  0x00007fb62cac57dc in __pthread_kill_implementation () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#6  0x00007fb62ca73516 in raise () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#7  0x00007fb62ca5b935 in abort () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#8  0x00007fb62ca5c7f3 in __libc_message_impl.cold () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#9  0x00007fb62cacfd05 in malloc_printerr () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#10 0x00007fb62cad1f9a in _int_free () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#11 0x00007fb62cad4913 in free () from /nix/store/5adwdl39g3k9a2j0qadvirnliv4r7pwd-glibc-2.39-52/lib/libc.so.6
No symbol table info available.
#12 0x00007fb62c880720 in g_slice_free_chain_with_offset () from /nix/store/7lr9qdizm42pf6clysg7syrky0si8aab-glib-2.80.4/lib/libglib-2.0.so.0
No symbol table info available.
#13 0x00007fb62ca00319 in guard_gc () from /nix/store/d8klnms6mjl2405h7nrvpi0wq6r15kfb-luajit-2.1.1713773202-env/lib/lua/5.1/lgi/corelgilua51.so
No symbol table info available.
#14 0x0000000000472966 in ?? ()
No symbol table info available.
#15 0x000000000044f7b7 in ?? ()
No symbol table info available.
#16 0x0000000000454b38 in ?? ()
No symbol table info available.
#17 0x0000000000472d5c in ?? ()
No symbol table info available.
#18 0x00000000004646d7 in lua_close ()
No symbol table info available.
#19 0x00000000004056fe in main ()
No symbol table info available.
[Inferior 1 (process 392138) detached]

Maybe something to do with the interp file change. Though the Lua demo plug-in works 🤷‍♀️

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/solved-overriding-gimp-attributes-and-a-dependent-package/51003/4

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

Successfully merging this pull request may close these issues.