Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947584 - x11-terms/ghostty: Unable to create GL context
Summary: x11-terms/ghostty: Unable to create GL context
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal critical
Assignee: sin-ack
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2025-01-06 05:38 UTC by ericpetersen3.14
Modified: 2025-01-14 15:16 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Screenshot of the program failing to load (2025-01-05-220854_hyprshot.png,15.75 KB, image/png)
2025-01-06 05:38 UTC, ericpetersen3.14
Details
running emerge -pvO gui-libs/gtk (emerge_pvO_gui-libs-gtk.txt,314 bytes, text/plain)
2025-01-06 15:54 UTC, ericpetersen3.14
Details
running `emerge --info` command (emerge_info.txt,7.98 KB, text/plain)
2025-01-06 15:55 UTC, ericpetersen3.14
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ericpetersen3.14 2025-01-06 05:38:10 UTC
Created attachment 915966 [details]
Screenshot of the program failing to load

Apologies is this isn't too clear:

ghostty on my system fails to start with the error "Unable to create GL context". ghostty itself cannot run with GLES, and sets GDK_DISABLE=gles-api to prevent GLES from loading. ghostty itself isn't seeming to set this flag, and manually setting the environment variable when running seems to fix the problem: `GDK_DISABLE=gles-api ghostty`.

After chatting with someone in the discord server for ghostty, I believe this may be because ghostty is built with an older version of GTK than is required, because apparently it avoids setting the environment variable on older GTK versions.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-06 05:39:28 UTC
Please share emerge --info and emerge -pvO gui-libs/gtk.
Comment 2 ericpetersen3.14 2025-01-06 15:54:45 UTC
Created attachment 915992 [details]
running emerge -pvO gui-libs/gtk

Here is the `emerge -pvO gui-libs/gtk` command output as requested
Comment 3 ericpetersen3.14 2025-01-06 15:55:14 UTC
Created attachment 915993 [details]
running `emerge --info` command

Here is the `emerge --info` command output as requested.
Comment 4 sin-ack 2025-01-07 09:15:28 UTC
> After chatting with someone in the discord server for ghostty, I believe this 
> may be because ghostty is built with an older version of GTK than is required,
> because apparently it avoids setting the environment variable on older GTK
> versions.

Actually, no, it's the other way around :) I can't reproduce this with GTK 4.14
but can reproduce it with GTK 4.16, so it seems to be a GTK 4.16 regression.
Comment 5 sin-ack 2025-01-07 10:04:56 UTC
Investigated this in the Ghostty Discord. This seems to be a Ghostty bug because
it doesn't check against the runtime GTK version when applying its environment variables. As a workaround before this is fixed on upstream, rebuild Ghostty
after installing GTK 4.16.
Comment 6 Larry the Git Cow gentoo-dev 2025-01-14 15:16:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee5eb81093ec8c2efea73c18815b4acca7074319

commit ee5eb81093ec8c2efea73c18815b4acca7074319
Author:     sin-ack <sin-ack@protonmail.com>
AuthorDate: 2025-01-08 06:54:32 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2025-01-14 15:15:51 +0000

    x11-terms/ghostty: apply upstream patch for gtk version skew
    
    Link: https://github.com/ghostty-org/ghostty/pull/4783
    Closes: https://bugs.gentoo.org/947584
    Signed-off-by: sin-ack <sin-ack@protonmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/40040
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 ...t-gtk-move-most-version-checks-to-runtime.patch | 125 +++++++++++++++++++++
 ...tty-1.0.1-r1.ebuild => ghostty-1.0.1-r2.ebuild} |   1 +
 2 files changed, 126 insertions(+)