Gnome extension for core22

Hello!

We use gstreamer/gtk/makefile/C/C++ tools for build our snap. We use core20 with [gnome-3-38] extension and everything was fine. But we want switch to new version of core22 for use the new packages for example gstreamer etc. We faced with the problem: no gnome extension for core22. We use snapcraftctl tool to set package version, but now we have the next message in the log:

2022-07-08 07:46:42.531 :: + snapcraftctl set-version 3.8                                                                                                                                                         
2022-07-08 07:46:42.534 :: Warning: Use 'craftctl set version=<value>' to set version                                                                                                                             
2022-07-08 07:46:45.116 ::                                                                                                                                                                                        
2022-07-08 07:46:45.116 :: Users are encouraged to replace 'snapcraftctl' with 'craftctl' and use                                                                                                                 
2022-07-08 07:46:45.117 :: 'CRAFT_*' environment variables in scriptlets when building snaps based                                                                                                                
2022-07-08 07:46:45.117 :: on core22. Please refer to the core22 migration guide for details.                                                                                                                     

Where is ‘core22 migration guide’? How can we use gtk with core22? Do you plan to implement gome extension for core22? The new core22 gives more questions than answers…

Thanks!

core22 snaps should be able to use the gnome extension. That functionality was just added last week. The new gnome plugin has not yet been added to the documentation.

Example usage from snapcraft source:

name: gtk3-hello
version: "1.0"
summary: test the gnome extension
description: This is a basic gtk snap

grade: devel
base: core22
confinement: strict

apps:
  gtk3-hello:
    command: usr/local/bin/gtk3-hello
    extensions: [gnome]

parts:
  project:
    plugin: cmake
    source: .

# Temporarily use snaps from edge
build-snaps: [gnome-42-2204-sdk/latest/edge, gnome-42-2204/latest/edge]
hello.c
#include <gtk/gtk.h>

// Not called.
void activate(GtkApplication *app, gpointer user_data)
{
	g_print("ACTIVATED");
}

int main (int argc, char **argv)
{
	void *app = gtk_application_new("io.snapcraft.gtk-test", G_APPLICATION_FLAGS_NONE);
	g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);

	// Requires display.
	//int status = g_application_run(G_APPLICATION(app), argc, argv);

	g_print("hello world\n");

	g_object_unref(app);
	return 0;
}
CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(gtk-hello C)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_definitions(${GTK3_CFLAGS_OTHER})
add_executable(gtk3-hello hello.c)
target_include_directories(gtk3-hello PRIVATE ${GTK3_INCLUDE_DIRS})
target_link_libraries(gtk3-hello ${GTK3_LIBRARIES})
install(TARGETS gtk3-hello RUNTIME DESTINATION bin)
1 Like

Thank you very much for quick reply. We will try to use it.

Nope. Doesn’t work:

$ snapcraft --use-lxd
Extension 'gnome' does not exist                                                                                                                               
Full execution log: '/home/dani/.cache/snapcraft/log/snapcraft-20220708-154559.043482.log'
snap info snapcraft
$ snap info snapcraft
name:      snapcraft
summary:   easily create snaps
publisher: Canonical✓
store-url: https://snapcraft.io/snapcraft
contact:   https://forum.snapcraft.io/c/snapcraft
license:   GPL-3.0
description: |
  Package, distribute, and update any app for Linux and IoT.
  
  Snaps are containerised software packages that are simple to create and install. They auto-update
  and are safe to run. And because they bundle their dependencies, they work on all major Linux
  systems without modification.
commands:
  - snapcraft
snap-id:      vMTKRaLjnOJQetI78HjntT37VuoyssFE
tracking:     latest/stable
refresh-date: yesterday at 16:16 BST
channels:
  latest/stable:    7.0.10                    2022-07-07 (7882) 65MB classic
  latest/candidate: ↑                                                
  latest/beta:      ↑                                                
  latest/edge:      7.0.10.post21+git9f17e5fc 2022-07-07 (7904) 65MB classic
  7.x/stable:       7.0.10                    2022-07-07 (7882) 65MB classic
  7.x/candidate:    ↑                                                
  7.x/beta:         7.0.11                    2022-07-08 (7923) 65MB classic
  7.x/edge:         ↑                                                
  6.x/stable:       6.1                       2022-06-15 (7201) 54MB classic
  6.x/candidate:    ↑                                                
  6.x/beta:         ↑                                                
  6.x/edge:         ↑                                                
  5.x/stable:       5.0                       2021-08-09 (6751) 58MB classic
  5.x/candidate:    ↑                                                
  5.x/beta:         ↑                                                
  5.x/edge:         ↑                                                
  4.x/stable:       4.8                       2021-06-03 (6512) 74MB classic
  4.x/candidate:    ↑                                                
  4.x/beta:         ↑                                                
  4.x/edge:         ↑                                                
installed:          7.0.10                               (7882) 65MB classic
contents of the log file indicated in the output of the command above
2022-07-08 15:45:59.043 Starting Snapcraft 7.0.10
2022-07-08 15:45:59.044 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'trace': False, 'version': False} filtered=['--use-lxd']
2022-07-08 15:45:59.044 Using default command: 'pack'
2022-07-08 15:45:59.044 General parsed sysargs: command='pack' args=['--use-lxd']
2022-07-08 15:45:59.044 Command parsed sysargs: Namespace(debug=False, destructive_mode=False, directory=None, enable_developer_debug=False, enable_experimental_extensions=False, enable_experimental_target_arch=False, enable_manifest=False, manifest_image_information=None, output=None, provider=None, target_arch=None, use_lxd=True)
2022-07-08 15:45:59.044 lifecycle command: 'pack', arguments: Namespace(debug=False, destructive_mode=False, directory=None, enable_developer_debug=False, enable_experimental_extensions=False, enable_experimental_target_arch=False, enable_manifest=False, manifest_image_information=None, output=None, provider=None, target_arch=None, use_lxd=True)
2022-07-08 15:45:59.044 command: pack, arguments: Namespace(debug=False, destructive_mode=False, directory=None, enable_developer_debug=False, enable_experimental_extensions=False, enable_experimental_target_arch=False, enable_manifest=False, manifest_image_information=None, output=None, provider=None, target_arch=None, use_lxd=True)
2022-07-08 15:45:59.127 Extension 'gnome' does not exist
2022-07-08 15:45:59.127 Traceback (most recent call last):
2022-07-08 15:45:59.127   File "/snap/snapcraft/7882/lib/python3.8/site-packages/snapcraft/extensions/registry.py", line 49, in get_extension_class
2022-07-08 15:45:59.127     return _EXTENSIONS[extension_name]
2022-07-08 15:45:59.127 KeyError: 'gnome'
2022-07-08 15:45:59.127 Full execution log: '/home/dani/.cache/snapcraft/log/snapcraft-20220708-154559.043482.log'
$ snapcraft version
snapcraft 7.0.10

My apologies, gnome for core22 currently only available on snapcraft’s latest/edge channel!

1 Like

aha. I really should have checked that… :woman_facepalming: