How to include a go lib which seems missing

Yes.

In the end I added a find for it and copied it into place (which is almost what is happening in the Makefile as you mentioned):

override-build: |
      # The Makefile contains bunch of compiler options. Don't even try reproduce it.
      go mod tidy
      make all
      make DIST=$SNAPCRAFT_PART_INSTALL install
      mkdir -p $SNAPCRAFT_PART_INSTALL/lib/

      # Rip out the libsilkworm_capi.so and ship it.
      find /root/go/pkg/mod/github.com/erigontech/ -name libsilkworm_capi.so -exec cp {} $SNAPCRAFT_PART_INSTALL/lib/ \;

    stage:
      - bin/erigon
      - lib/libsilkworm_capi.so

    organize:
      erigon: bin/erigon

… and added last in the snapcraft.yaml

# Make sure we can find libsilkworm_capi.so by setting LD_LIBRARY_PATH
environment:
  LD_LIBRARY_PATH: "$SNAP/lib:$LD_LIBRARY_PATH"

This seems to have resolved it.

1 Like