I am trying to put https://github.com/nifty-site-manager/nsm-snap this package on the snap store and am not having much luck.
I have tried using snapcraft from the command line, however need multipass and it’s not available for my architecture (i386).
Alternatively I have been trying to use the “Build with GitHub” feature on the website, however I keep getting “Failed to Build” and I’m not sure what I’m doing wrong? The problem is probably with my snapcraft.yaml file as I’m not really sure what I am doing?
To install the package from source you just run ‘make’ and ‘make install’. Any help would be greatly appreciated.
to build on your local host you can use:
then you wont need multipass …
but your snap will fail if you do not change:
to an actual plugin …
i’d suggest starting with:
(and you can drop make from the
build-packages block then … the make plugin will bring the make binary in automatically)
Cheers, I had tried autotools which the dosbox example snapcraft.yaml file uses and suspected that might be my problem. I unsuccessfully tried ‘’ as the plugin instead and had meant to change that back to autotools before my last post (sorry about that). I am trying make now.
If you aren’t using autoconf to build your project, then the
autotools plugin is definitely the wrong choice. As @ogra suggested, the
make plugin is probably the right choice for you.
It looks like you’ll need to make a few changes to your
Makefile though. In the install target, you should prepend
$(DESTDIR) to the paths you’re installing files to. This is used to stage the install to a different location: a practice widely adopted from the GNU coding standards:
I’d also drop the “sudo” calls in the
make install /
uninstall targets. That should be left up to the caller, and is generally unnecessary when doing a staged install like Snapcraft does.
@jamesh I’m not quite sure what you mean by prepend $(DESTDIR) to the paths I’m installing files to? (edit: I have tried editing in what I think you mean and am trying that now, I might ask if you can check as well though so I know if I’m fluffing it up)
I have got it to build and release, however when I install it through snap edge now and try to run nsm I get
/snap/nsm/8/command-nsm.wrapper: 2: exec: nsm: not found. Does anyone know why that is? Maybe @jamesh’s suggestion will fix that?
Also with removing the sudo calls, if I do that when building from source on my machine I get
mv: cannot move ‘nsm’ to ‘/usr/local/bin/nsm’: Permission denied.
In your Makefile, you have:
sudo mv nsm /usr/local/bin
I’m suggesting you change this to something like:
mkdir -p $(DESTDIR)/usr/local/bin
cp nsm $(DESTDIR)/usr/local/bin
$(DESTDIR) isn’t set, this should be equivalent to what you had before since it expands to an empty string. If I instead called e.g.
make DESTDIR=/tmp/stage install, it would install to
With the sudo calls removed, you will need to run
sudo make install to do a local install. Burying sudo calls within scripts is bad practice, since the user has no idea what actions are being performed with elevated privileges, or whether the password prompt is even real.
Okay I’ve (hopefully) fixed up the Makefile. The latest build is in progress, hopefully the
/snap/nsm/8/command-nsm.wrapper: 2: exec: nsm: not found problem is gone (though I’m not sure what will have fixed it). Thanks a lot for your help .
The previous snap you’d built didn’t seem to contain your program:
$ unsquashfs -l nsm_15.snap
Parallel unsquashfs: Using 6 processors
6 inodes (9 blocks) to write
This would likely be down to the missing
$(DESTDIR) support: if your Makefile wasn’t installing your program into the directory snapcraft expected it to be staged in, then it wouldn’t be included in the snap.
I’d strongly suggest trying to get snapcraft running locally, since that will let you iterate a lot quicker than relying on build.snapcraft.io. If virtualisation doesn’t work on your development machine, perhaps try building with LXD instead, as described here: