简体   繁体   English

Snapcraft 构建失败 cmake 部分步骤

[英]Snapcraft build fails cmake part step

My computer:我的电脑:

snap 2.48.2 snapd 2.48.2 series 16 ubuntu 20.04 kernel 5.8.0-41-generic snap 2.48.2 snapd 2.48.2 系列 16 ubuntu 20.04 kernel 5.8.0-41-通用

Here is my yml:这是我的 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. 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 与创建 CMakeCache.txt 的目录 /home/chris/etnsnap 不同。 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'.如果你不确定,重新编辑 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.然而,这似乎是 Snapcraft 本身的问题。 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.似乎 cmakecache.txt 首先是在本地环境中生成的,然后其他所有操作都在 vm 内完成,从而导致冲突。 I never used to get this issue.我从来没有遇到过这个问题。 Does anyone have any ideas?有没有人有任何想法? Thanks谢谢

Like the error states, you have a stale CMakeCache.txt in your source directory.与错误状态一样,您的源目录中有一个陈旧的CMakeCache.txt This needs to be removed before you run snapcraft .这需要在运行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.这意味着删除您在主机上使用的任何build目录。 You should alse remove any CMakeCache.txt files, and any CMakeOut.txt files.您还应该删除所有CMakeCache.txt文件和所有CMakeOut.txt文件。 Do not remove any CMakeLists.txt files or any *.cmake files, which are important for building from source.不要删除任何CMakeLists.txt文件或任何*.cmake文件,它们对于从源代码构建很重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM