0

My computer:

snap 2.48.2 snapd 2.48.2 series 16 ubuntu 20.04 kernel 5.8.0-41-generic

Here is my yml:

name: someproject
version: '3.3.1.0'
base: core20
summary: "someproject: asdfasdf"
description: |
    someproject asdfasdf.
grade: devel
confinement: strict

apps:
    someprojectd:
        daemon: forking
        command: |
            someprojectd-wrapper --detach --data-dir ${SNAP_COMMON} --config-file ${SNAP_USER_DATA}/etc/someprojectd.conf
        plugs:
            - network
            - network-bind
    someproject-wallet-rpc:
        command: |
            someproject-wallet-rpc --log-file ${SNAP_USER_DATA}
        plugs:
            - home
            - network
            - network-bind
    someproject-wallet-cli:
        command: |
            someproject-wallet-cli --log-file ${SNAP_USER_DATA}
        plugs:
            - home
            - network

parts:
    cmake-build:
        plugin: cmake
        cmake-parameters:
            - -DBDB_STATIC=1
            - -DUPNP_STATIC=1
            - -DBoost_USE_STATIC_LIBS=1
            - -DBoost_USE_STATIC_RUNTIME=1
            - -DARCH=default
        source: .
        build-packages:
            - gcc
            - pkg-config
            - libunbound-dev
            - libevent-dev
            - libboost-all-dev
            - libdb-dev
            - libunwind-dev
            - libminiupnpc-dev
            - libldns-dev
            - libexpat1-dev
            - bison
            - doxygen
            - graphviz
        stage-packages:
            - libminiupnpc17
            - libunbound8
            - libunwind8
        prime:
            - bin
            - usr/lib/
            - -usr/lib/gcc
            - -usr/share

    dist-files:
        plugin: dump
        source: .
        organize:
            contrib/snap/someprojectd.conf: etc/someprojectd.conf
            contrib/snap/someprojectd-wrapper: bin/someprojectd-wrapper
        prime:
            - etc
            - bin

The error I receive is:

cmake /root/parts/cmake-build/src/ -G Unix Makefiles -DBDB_STATIC=1 -DUPNP_STATIC=1 -DBoost_USE_STATIC_LIBS=1 -DBoost_USE_STATIC_RUNTIME=1 -DARCH=default CMake Error: The current CMakeCache.txt directory /root/parts/cmake-build/src/CMakeCache.txt is different than the directory /home/chris/etnsnap where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt Failed to build 'cmake-build'.

Recommended resolution: Check the build logs and ensure the part's configuration and sources are correct.

I understand how to fix this issue within a local environment; other posts have been made about how to do that and I'm fine building locally. However, this seems like an issue with Snapcraft itself. It seems like the cmakecache.txt is first generated in the local environment and then everything else is done inside the vm causing the conflict. I never used to get this issue. Does anyone have any ideas? Thanks

1 Answers1

0

Like the error states, you have a stale CMakeCache.txt in your source directory. This needs to be removed before you run snapcraft. Ideally you would not have any build-time temporary files in your source tree at all. That means removing any build directories you used on your host. You should alse remove any CMakeCache.txt files, and any CMakeOut.txt files. Do not remove any CMakeLists.txt files or any *.cmake files, which are important for building from source.

Lucy Llewellyn
  • 1,011
  • 6
  • 5