Override-build not finishing

Hi,

I’m trying to update the cuda-samples snap to include more tests. Since the project’s Makefile doesn’t have an install step, I decided to override the build step in snapcraft.yaml. The snap appears to build, but not all of override-build is executed.

This is what I have in my override-build:

make -j$CRAFT_PARALLEL_BUILD_COUNT
mkdir -p $CRAFT_PART_INSTALL/usr/local/cuda/samples/bin
cp -ar bin/x86_64/linux/release/* $CRAFT_PART_INSTALL/usr/local/cuda/samples/bin/

As seen by a recent log of the build process, Snapcraft executes make -j8, and then it finishes the compilation with a Finished building CUDA samples message, but the mkdir and cp lines are not executed.

I’m very confused as to what is going on here, so if anyone has seen this before, I’d really appreciate some help.

My snapcraft.yaml file is here:

Have you tried to use craftctl default instead of your explicit make -j call ?

I’d also suggest not using usr/local in your installation targets but put things into proper places (usr/bin, usr/lib, usr/share) which are all taken into account by default in the sandbox when executing the shipped bits… If you keep usr/local you will need to add and maintain a lot of extra environment mangling…

I will try craftctl default. I thought that, with the make plugin, make install is called by default, but the Makefile does not have an install target.

And if you can’t use the make plugin’s build steps, then I recommend changing the plugin type to nil and add the craftctl default to the end of your override script.

Okay, I’ll try with the nil plugin. The make plugin is indeed not that useful in this case since I’m not really using its steps (using craftctl default does indeed cause the part to fail).

It still doesn’t execute all the lines

      make -j$CRAFT_PARALLEL_BUILD_COUNT
      mkdir -p $CRAFT_PART_INSTALL/usr/local/cuda/samples/bin
      cp -ar bin/x86_64/linux/release/* $CRAFT_PART_INSTALL/usr/local/cuda/samples/bin/
      craftctl default

Next thing I will test is making a patch that adds an install target to the Makefile. I am realizing that make install did try to execute when I used craftctl default with the make plugin…

I am already patching different parts of the upstream project in my snap, so what’s the harm in one more patch lol.

Okay, patching the Makefile and using the make plugin seems to solve my problem.

I suspect it’s possible the project uses subshells in its Makefiles in a weird way that is causing snapcraft to finish the override-build script early.

1 Like