There are only two files in the working folder - hello.c and snapcraft.yaml. What corrections do I need to make to the yaml file to build the snap successfully? Thanks.
Regards.
P.S.
Previously, I tried several other variations for the plugin but most of the errors were related to these variations (e.g. build, make). Both build-essential and make are present on the dev computer.
The autotools plugin does indeed expect your project to already be set up for building it with autotools … likewise for other plugins you could use … i.e the make plugin would expect a Makefile in your project dir…
If you just want to build the binary without adding any build system you can use the nil plugin and override-build: | to simply do the same gcc call you would do when building it manually on cmdline
I think you want to use the make plugin, make your code work fine locally and then just package it in a snap with the make plugin. The only real requirement is support for $(DESTDIR) variable. There a ample examples but I can offer one myself if you need one.
Thanks for the offer @zyga! Would love to get an example or two from you. Tried to get some from Google Gemini before starting this thread (and failed miserably). No comment on Gemini because my query could have been better.
I would like to get these “teething steps” under my belt so that I can ramp up the learning curve at a faster pace. The more varied the example, the better for my learning experience.
name: hello-world
version: "1"
summary: A toy hello-world program
description: |
This repository contains a toy hello world program
packaged as a snap.
base: core22
confinement: strict
apps:
hello-world:
command: usr/bin/hello-world
parts:
hello-world:
source: .
plugin: make
You can put this in a directory. Run snapcraft --verbose to build and sudo snap install --dangerous ./hello-world_1_amd64.snap to install it. The architecture will be different if you are not on an x86 system.
Cannot thank you enough for taking the time to provide the detailed guidance. Everything worked as you specified with my first pass - perhaps an achievement for me in a long time.
Since I can relate to Makefile, your example will be the foundation for teaching some high school kids.