When trying to build with "snapcraft --use-lxd" and get .a file errors

When trying to build with “snapcraft --use-lxd” it eventually complains:

  ```Project MESSAGE: *** Enterprise config
    Project MESSAGE: *** Pro Alpha Release Build
    Project MESSAGE: *** SNAPCRAFT
    Project MESSAGE: *** QMAKE_RPATHDIR = /opt/qt51512 /opt/qt51512/lib /usr/lib/wickr-client/plugins /usr/lib/wickr-client/lib /root/parts/wickr/build/clients/enterprise/../../libs/qzxing/src /root/parts/wickr/build/clients/enterprise/../../wickr-sdk/libs/quazip/quazip /WickrDesktopApp/clients/enterprise/../../wickr-sdk/wickr-core-c/localRepo/wickr-crypto/unix/lib
    /WickrDesktopApp/clients/enterprise/enterprise.qrc: Warning: potential duplicate alias detected: 'defaulttheme.json'
    enterprise_qmlcache.qrc: Warning: potential duplicate alias detected: 'defaulttheme.json'
    make[2]: *** No rule to make target '/root/parts/wickr/build/clients/enterprise/../../wickr-sdk/src/libwickr-sdk.a', needed by 'libwickr-client.a'.  Stop.
    make[1]: *** [sub-enterprise-make_first-ordered] Error 2
    make: *** [sub-clients-make_first-ordered] Error 2
    Failed to run 'make -j4' for 'wickr': Exited with code 2.```

But on previous builds that didn’t require vms or linux containers (which have their own file system) issues did not occur. There are so many million things I keep needing to push or update to the lxc container. It feels very cumbersome to manually find and add every little thing it will need to build with the container. Is there any recommended way to be able to use lxc without it being so impossibly cumbersome to build an app?

Any thoughts on this .a issue as well? I do not want to have to manually move .a files and all.

It looks like Snapcraft is running the build with make -j4, so make will attempt to build up to 4 targets at a time. Is it possible that your project is missing some dependencies, and only builds reliably with no parallelism?

If that’s the case, you could try limiting parallelism using the SNAPCRAFT_PARALLEL_BUILD_COUNT variable:

parts:
  part-name:
    ...
    build-environment:
      SNAPCRAFT_PARALLEL_BUILD_COUNT: 1

I think that should work for core20 and core22 based snaps.

Hmmm @jamesh I am using core 18. Getting this error:

Issues while validating snapcraft.yaml: The 'parts/wickr/build-environment' property does not match the required schema: OrderedDict([('SNAPCRAFT_PARALLEL_BUILD_COUNT', 1)]) is not of type 'array'
Issues while validating snapcraft.yaml: The 'parts/wickr/build-environment' property does not match the required schema: OrderedDict([('SNAPCRAFT_PARALLEL_BUILD_COUNT', 1)]) is not of type 'array'