Staging part... no such file or directory

My snap (EDIT: The cp -r third_party/..., at the end of override-build, was added to unblock after posting this, the question refers to the problem that arises without such line) with a single part, has:

      - third_party/llvm-build/Release+Asserts/

The end of build log proves that /build/llvm-chromium/parts/clang/build/third_party exists at the end of the build phase. However, the stage fails because it cannot find /build/llvm-chromium/parts/clang/install/third_party.

:: [1/1] cd /build/llvm-chromium/parts/clang/build/third_party/llvm-build/Release+Asserts/tools/chrometools && /usr/bin/cmake -D COMPONENT=chrome-tools -P cmake_install.cmake
[-- snip --]
Staging clang
/build/llvm-chromium/parts/clang/install/third_party: No such file or directory

The reference says

CRAFT_PART_BUILD parts/<part-name>/build the working directory during the build step
CRAFT_PART_INSTALL parts/<part-name>/install contains the results of the build step and the stage packages.

So why is it not copying the results from build to install and what should I do to ensure that happens?

Since you are using the nil plugin, you are doing the correct thing by copying your build artifacts from the build directory to the install directory via the override-build script.

A more programmatic way would be

- cp -r third_party/llvm-build/Release+Asserts /build/llvm-chromium/parts/clang/install/third_party/llvm-build || :
+ cp -r third_party/llvm-build/Release+Asserts $CRAFT_PART_INSTALL/third_parts/llvm-build

The reasoning is that the nil plugin doesn’t “install” anything whereas other plugins do. For example, the make plugin calls make ... install DESTDIR=$CRAFT_PART_INSTALL and the rust plugin calls cargo install ... --root $CRAFT_PART_INSTALL

Thank you, with that I got

:: cp: cannot create directory '/build/llvm-chromium/parts/clang/install/third_party/llvm-build': No such file or directory

I’ll assume that is not because $CRAFT_PART_INSTALL doesn’t exist yet but because I didn’t create $CRAFT_PART_INSTALL/third_party/llvm-build previously but please correct me if I’m wrong.

1 Like

Exactly, $CRAFT_PART_INSTALL/third_party/llvm-build is not yet available. An mkdir will solve it.

1 Like