How to use custom libraries with the autoconf plugin?

I am trying to update the Slurm Snap and I am stuck at a point:

We need to ship some dependencies of Slurm with this snap, that’s why we build json, yaml, http-parser. Those parts work fine: i can build , stage, prime, and install them in the final snap.

But to build Slurm, with the autotools plugin, I need to specify the paths for those libraries I built previously, so I have something similar to this:

    autotools-configure-parameters:
      - --prefix=/usr
      - --sysconfdir=/etc
      - --with-munge=/usr
      - --with-http-parser=${SNAPCRAFT_STAGE}/usr
      - --with-yaml=${SNAPCRAFT_STAGE}/usr
      - --with-json=${SNAPCRAFT_STAGE}/usr

This way, the build part can find libjson, libyaml, libhhtp-parser. But the final snap has some weird paths for those libraries: /root/stage/usr instead of /snap/slurm/common/usr, which leads to some runtime errors.

We need to use the libraries shipped with the snap during the build as well. How to do that? Can i add a part to build-packages metadata?

Or is there a better approach to solve this problem?

1 Like