unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
To: 64981@debbugs.gnu.org
Subject: bug#64981: GTK4 applications broken (missing libGLESv2)
Date: Thu, 10 Aug 2023 22:47:08 +0200	[thread overview]
Message-ID: <20230810224708.5d091140@primary_laptop> (raw)
In-Reply-To: <87h6pjag4n.fsf@riseup.net>

[-- Attachment #1: Type: text/plain, Size: 12890 bytes --]

Hi,

I've the same issue for several programs.

I'm using sway and I tried to use dino.

I've built dino like that:
> guix install dino \
> 	--with-debug-info=gtk \
> 	--with-debug-info=glib \
> 	--with-debug-info=glibc \
> 	--with-debug-info=libepoxy
> 
> cat $(which dino) | sed 's#exec -a "$0" #exec -a "$0" gdb #g' > dino
> chmod +x dino

And here's my gdbinit:
> $ cat ~/.gdbinit 
> guile
> (use-modules (gdb))
> (execute (string-append "set debug-file-directory "
>                         (or (getenv "GDB_DEBUG_FILE_DIRECTORY")
>                             "~/.guix-profile/lib/debug")))
> end

Then I run ./dino and I get that:
> $ ./dino 
> GNU gdb (GDB) 12.1
> Copyright (C) 2022 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-unknown-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>.
> 
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from /gnu/store/qhc45j9hjspvig6m1wjvx4nxpjwsnq4d-dino-0.4.2/bin/.dino-real...
> (No debugging symbols found in /gnu/store/qhc45j9hjspvig6m1wjvx4nxpjwsnq4d-dino-0.4.2/bin/.dino-real)
> (gdb) run
> Starting program: /gnu/store/qhc45j9hjspvig6m1wjvx4nxpjwsnq4d-dino-0.4.2/bin/.dino-real 
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libthread_db.so.1".
> [New Thread 0x7ffff33ff640 (LWP 27192)]
> [Thread 0x7ffff33ff640 (LWP 27192) exited]
> [New Thread 0x7ffff33ff640 (LWP 27193)]
> [New Thread 0x7ffff1bf4640 (LWP 27194)]
> [Detaching after fork from child process 27195]
> [New Thread 0x7ffff13f3640 (LWP 27196)]
> [New Thread 0x7ffff0bea640 (LWP 27197)]
> [New Thread 0x7fffe3611640 (LWP 27198)]
> [New Thread 0x7fffe2e10640 (LWP 27199)]
> [New Thread 0x7fffe260f640 (LWP 27200)]
> [New Thread 0x7fffe1e0e640 (LWP 27201)]
> [Thread 0x7fffe260f640 (LWP 27200) exited]
> [New Thread 0x7fffe260f640 (LWP 27202)]
> [Thread 0x7fffe1e0e640 (LWP 27201) exited]
> [New Thread 0x7fffe1e0e640 (LWP 27203)]
> [Thread 0x7fffe260f640 (LWP 27202) exited]
> [Thread 0x7fffe1e0e640 (LWP 27203) exited]
> [New Thread 0x7fffe1e0e640 (LWP 27204)]
> [New Thread 0x7fffe260f640 (LWP 27205)]
> [Thread 0x7fffe1e0e640 (LWP 27204) exited]
> [Thread 0x7fffe260f640 (LWP 27205) exited]
> [New Thread 0x7fffe260f640 (LWP 27206)]
> [New Thread 0x7fffe1e0e640 (LWP 27207)]
> [Thread 0x7fffe260f640 (LWP 27206) exited]
> [Thread 0x7fffe1e0e640 (LWP 27207) exited]
> [New Thread 0x7fffe1e0e640 (LWP 27208)]
> [New Thread 0x7fffe260f640 (LWP 27209)]
> [New Thread 0x7fffe1318640 (LWP 27210)]
> [New Thread 0x7fffe0b17640 (LWP 27211)]
> [New Thread 0x7fffbf3ff640 (LWP 27212)]
> [New Thread 0x7fffbebfe640 (LWP 27213)]
> [New Thread 0x7fffabfff640 (LWP 27214)]
> [New Thread 0x7fffab7fe640 (LWP 27215)]
> [New Thread 0x7fffaaffd640 (LWP 27216)]
> Couldn't open libGLESv2.so.2: libGLESv2.so.2: cannot open shared object file: No such file or directory
> 
> Thread 1 ".dino-real" received signal SIGABRT, Aborted.
> 0x00007ffff48e4fec in __pthread_kill_implementation () from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
> (gdb) bt
> #0  0x00007ffff48e4fec in __pthread_kill_implementation ()
>    from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
> #1  0x00007ffff489b202 in raise () from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
> #2  0x00007ffff488645b in abort () from /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6
> #3  0x00007ffff4590eb5 in get_dlopen_handle (load=true, exit_on_fail=true, 
>     lib_name=0x7ffff45b26d3 "libGLESv2.so.2", handle=0x7ffff45ff028 <api+72>)
>     at ../source/src/dispatch_common.c:316
> #4  get_dlopen_handle (handle=0x7ffff45ff028 <api+72>, lib_name=0x7ffff45b26d3 "libGLESv2.so.2", 
>     exit_on_fail=<optimized out>, load=<optimized out>) at ../source/src/dispatch_common.c:293
> #5  0x00007ffff4591842 in epoxy_gles2_dlsym (name=0x7ffff45a536b <entrypoint_strings+25867> "glGetString")
>     at ../source/src/dispatch_common.c:722
> #6  epoxy_gles2_dlsym (name=0x7ffff45a536b <entrypoint_strings+25867> "glGetString")
>     at ../source/src/dispatch_common.c:717
> #7  epoxy_get_bootstrap_proc_address (name=0x7ffff45a536b <entrypoint_strings+25867> "glGetString")
>     at ../source/src/dispatch_common.c:835
> #8  0x00007ffff4534303 in gl_single_resolver (provider=provider@entry=PROVIDER_always_present, 
>     entrypoint_offset=<optimized out>, entrypoint_offset@entry=25867) at src/gl_generated_dispatch.c:75810
> #9  0x00007ffff454485f in epoxy_glGetString_resolver () at src/gl_generated_dispatch.c:89821
> #10 epoxy_glGetString_global_rewrite_ptr (name=7938) at src/gl_generated_dispatch.c:50154
> #11 0x00007ffff4590cd5 in epoxy_internal_gl_version (version_string=version_string@entry=7938, 
>     error_version=error_version@entry=0, factor=factor@entry=10) at ../source/src/dispatch_common.c:397
> #12 0x00007ffff4591091 in epoxy_gl_version () at ../source/src/dispatch_common.c:437
> #13 0x00007ffff5480bb5 in gdk_gl_context_check_extensions (context=0xd065e0)
>     at ../gtk-4.8.1/gdk/gdkglcontext.c:1498
> #14 gdk_gl_context_make_current (context=0xd065e0) at ../gtk-4.8.1/gdk/gdkglcontext.c:1605
> #15 0x00007ffff54afd18 in gsk_gl_renderer_realize (error=0x7fffffffa978, surface=<optimized out>, 
>     renderer=0xc68200) at ../gtk-4.8.1/gsk/gl/gskglrenderer.c:123
> #16 gsk_gl_renderer_realize (renderer=0xc68200, surface=<optimized out>, error=0x7fffffffa978)
>     at ../gtk-4.8.1/gsk/gl/gskglrenderer.c:86
> #17 0x00007ffff5498fa7 in gsk_renderer_realize (renderer=renderer@entry=0xc68200, 
>     surface=surface@entry=0xb8c0b0, error=error@entry=0x7fffffffa978) at ../gtk-4.8.1/gsk/gskrenderer.c:309
> #18 0x00007ffff5499786 in gsk_renderer_new_for_surface (surface=surface@entry=0xb8c0b0)
>     at ../gtk-4.8.1/gsk/gskrenderer.c:649
> #19 0x00007ffff5322ad8 in gtk_window_realize (widget=0x95c2f0) at ../gtk-4.8.1/gtk/gtkwindow.c:4294
> #20 0x00007ffff4ba64ef in g_closure_invoke ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #21 0x00007ffff4bb7f6d in ?? ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #22 0x00007ffff4bbe689 in g_signal_emit_valist ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #23 0x00007ffff4bbebb2 in g_signal_emit ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #24 0x00007ffff5315931 in gtk_widget_realize (widget=0x95c2f0) at ../gtk-4.8.1/gtk/gtkwidget.c:3412
> #25 0x00007ffff5327a72 in gtk_window_show (widget=0x95c2f0) at ../gtk-4.8.1/gtk/gtkwindow.c:3818
> #26 0x00007ffff4ba6719 in ?? ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #27 0x00007ffff4bbea16 in g_signal_emit_valist ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #28 0x00007ffff4bbebb2 in g_signal_emit ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #29 0x00007ffff530acf1 in gtk_widget_show (widget=0x95c2f0) at ../gtk-4.8.1/gtk/gtkwidget.c:2692
> #30 0x00007ffff532559c in gtk_window_present_with_time (window=<optimized out>, timestamp=0)
>     at ../gtk-4.8.1/gtk/gtkwindow.c:5237
> #31 0x00007ffff4ba64ef in g_closure_invoke ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #32 0x00007ffff4bb8306 in ?? ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #33 0x00007ffff4bbe689 in g_signal_emit_valist ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #34 0x00007ffff4bbebb2 in g_signal_emit ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgobject-2.0.so.0
> #35 0x00007ffff4cd6328 in ?? ()
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgio-2.0.so.0
> #36 0x00007ffff4cd647e in g_application_run ()
> --Type <RET> for more, q to quit, c to continue without paging--
>    from /gnu/store/nb40pwd37v6i1g4b1fq4l6q4h9px3asr-glib-2.72.3/lib/libgio-2.0.so.0
> #37 0x000000000042ef77 in main ()

So for some reasons it fails in libepoxy.

So I tried to reproduce the issue:
> $ cat dlopen-test.c
> /*
>  * Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
>  *
>  * This program is free software: you can redistribute it and/or
> modify
>  * it under the terms of the GNU General Public License as published
> by
>  * the Free Software Foundation, either version 3 of the License, or
>  * (at your option) any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program.  If not, see
> <http://www.gnu.org/licenses/>. */
> 
> #include <assert.h>
> #include <dlfcn.h>
> #include <stdio.h>       
> 
> int main()
> {
> 	void* handle;
> 
> 	assert((RTLD_LAZY|RTLD_LOCAL) == 1);
>        
> 	handle = dlopen("libGLESv2.so.2", RTLD_LAZY|RTLD_LOCAL);
> 
> 	if (handle == NULL) {
> 		fprintf(stderr, "error: %s\n", dlerror());
> 	} else {
> 		printf("handle: %p\n", handle);
> 	}
> 
> 	return 0;
> }

And there it works:
> $ gcc dlopen-test.c
> [gnutoo@primary_laptop dino]$ ./a.out 
> handle: 0x9a52e0

But it somehow fails in my gdb sessions:
> (gdb) set directories ~/debug/rqlhj8xk7x34pnsq8y3gzf7dzwyn9flk-libepoxy-1.5.10-checkout/source/
> (gdb) f 4
> #4  get_dlopen_handle (handle=0x7ffff45ff028 <api+72>, lib_name=0x7ffff45b26d3 "libGLESv2.so.2", 
>     exit_on_fail=<optimized out>, load=<optimized out>) at ../source/src/dispatch_common.c:293
> warning: Source file is more recent than executable.
> 293	get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool load)
> (gdb) l
> 288	{
> 289	    library_initialized = true;
> 290	}
> 291	
> 292	static bool
> 293	get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool load)
> 294	{
> 295	    if (*handle)
> 296	        return true;
> 297	
> (gdb) 
> 298	    if (!library_initialized) {
> 299	        fputs("Attempting to dlopen() while in the dynamic linker.\n", stderr);
> 300	        abort();
> 301	    }
> 302	
> 303	#ifdef _WIN32
> 304	    *handle = LoadLibraryA(lib_name);
> 305	#else
> 306	    pthread_mutex_lock(&api.mutex);
> 307	    if (!*handle) {
> (gdb) 
> 308	        int flags = RTLD_LAZY | RTLD_LOCAL;
> 309	        if (!load)
> 310	            flags |= RTLD_NOLOAD;
> 311	
> 312	        *handle = dlopen(lib_name, flags);
> 313	        if (!*handle) {
> 314	            if (exit_on_fail) {
> 315	                fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());
> 316	                abort();
> 317	            } else {
> (gdb) 
> 318	                (void)dlerror();
> 319	            }
> 320	        }
> 321	    }
> 322	    pthread_mutex_unlock(&api.mutex);
> 323	#endif
> 324	
> 325	    return *handle != NULL;
> 326	}
> 327	
> (gdb) p *handle
> $1 = (void *) 0x0

All the above is in Guix system.

The libGLESv2.so.2 comes from libglvnd, but libglvnd is not a
dependency of dino, and I only installed libglvnd with 'guix
package -i libglvnd' and dino is wrapped, so maybe for some reason
it doesn't find libglvnd.

I've tried to add libglvnd in dino inputs, but I got the same error
message (I didn't look at it with gdb though).

But if I install dino with Guix on top of parabola (a host
distribution) then it works fine.

I've also found out that gnome-weather was also complaining about a
missing libGLESv2:
> $ gnome-weather 
> Couldn't open libGLESv2.so.2: libGLESv2.so.2: cannot open shared object file: No such file or directory
> Aborted
but I didn't try to debug that.

Probably many more applications (than dino and gnome-weather) are
broken on Guix system.

Denis.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2023-08-10 20:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 22:06 bug#64981: GTK4 applications broken (missing libGLESv2) Csepp
2023-08-05 12:01 ` Liliana Marie Prikler
2023-08-06 10:10   ` Csepp
2023-08-06 15:15     ` paren--- via Bug reports for GNU Guix
2023-08-10 20:47 ` Denis 'GNUtoo' Carikli [this message]
2023-08-15 20:46 ` Efraim Flashner
2023-08-16 13:51 ` jbranso--- via Bug reports for GNU Guix
     [not found] ` <4d6f572f6f936a57f80f0447ef8b7ce0ec06b663.1692413930.git.iyzsong@member.fsf.org>
2023-08-19  3:13   ` 宋文武 via Bug reports for GNU Guix
2023-10-06 15:47 ` John Kehayias via Bug reports for GNU Guix
2023-11-28  5:33   ` John Kehayias via Bug reports for GNU Guix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230810224708.5d091140@primary_laptop \
    --to=gnutoo@cyberdimension.org \
    --cc=64981@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).