Exit code -9 running ant

I’m trying to run snapcraft which has an ant based part.

The build is failing with an opaque message:

Failed to run 'ant' for 'tomcat-with-ssl': Exited with code -9.
Verify that the part is using the correct parameters and try again.

This doesn’t look like an ant error code (google doesn’t find anything) so I’m guessing its a snapcraft error.

The snapcraft yaml is:

name: orion-monitor # you probably want to 'snapcraft register <name>'
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: monitoring of orion vms.
    description: | 
  OrionMonitor is a webapp designed to monitor Orion Vms and stop/start them
  when they are not required.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

apps:  
  tomcat:
    command: tomcat-launch
    daemon: simple
    stop-timeout: 30s
    plugs: [network, network-bind]

  # used to ran the certbot renewal process.
  cron:
    command: cron
    daemon: simple
    plugs: [network, network-bind]

  # You must run getcert after the install to create the certificate.
  getcert:
    command: getcert/getcert
    plugs: [network, network-bind]
    
    parts: 
      # build the web app
      orion-monitor-webapp:
    plugin: maven
#source: git@bitbucket.org:sbsutton/orionmonitor.git
source: https://sbsutton:cutRSzDYR6CxeJmZmVVb@bitbucket.org/sbsutton/orionmonitor.git
source-type: git
maven-options:
  [-DskipTests=true]
organize:
  war/orionmonitor-1.0-SNAPSHOT.war : webapps/ROOT.war
stage-packages:
  - libc6
after: [setup-repo,getcert,tomcat-with-ssl]

The build runs as follows:

Blockquote sudo snapcraft [sudo] password for bsutton: Skipping pull setup-repo (already ran) Skipping build setup-repo (already ran) Skipping stage setup-repo (already ran) Skipping pull getcert (already ran) Skipping build getcert (already ran) Skipping stage getcert (already ran) Skipping pull tomcat-with-ssl (already ran) ‘orion-monitor-webapp’ has prerequisites that need to be staged: tomcat-with-ssl Preparing to build tomcat-with-ssl Building tomcat-with-ssl ant Buildfile: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/build.xml>

download-compile:

testexist: [echo] Testing for /root/tomcat-build-libs/commons-daemon-1.1.0/commons-daemon-1.1.0.jar

downloadgz-2:

testexist: [echo] Testing for /root/tomcat-build-libs/ecj-4.6.3/ecj-4.6.3.jar

downloadfile-2:

build-prepare: [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/classes [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build/bin [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build/conf [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build/lib [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build/logs [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build/temp [mkdir] Created dir: /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/build/webapps

compile-prepare: [copy] Copying 1 file to /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/java/org/apache/catalina/startup [copy] Copying 1 file to /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/webapps/docs

download-validate:

validate:

compile: [javac] Compiling 1639 source files to /home/bsutton/git/orionmonitor/snap-projects/installer/parts/tomcat-with-ssl/build/output/classes [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7 Failed to run ‘ant’ for ‘tomcat-with-ssl’: Exited with code -9. Verify that the part is using the correct parameters and try again.

I think this is related to using libc6 in stage-packages. This is sort of experimental.
Mind instead trying to use base: core18 (you will need to snap install core18 --edge) and building on bionic (lxc launch ubuntu-daily:bionic)?

I’m running a test by just removing the libc6 reference and will report back the results.
I have to say that this was previously working.

My next problem is that I don’t know how to build using the lxc launch method. I’m currently using the experimental:

SNAPCRAFT_CONTAINER_BUILDS=1

So I remove the libc6 from the stage packages and the snap now builds.

The problem is that I then added the libc6 back in, did a clean and then a new build and the build succeeded.

I’ve tried both with and without lxd and both work and I’m not using the suggested bionic daily.

So the problem has mysteriously disappeared.