build: `cmake --install` fails if only select targets are built #31745

issue fanquake opened this issue on January 28, 2025
  1. fanquake commented at 10:22 AM on January 28, 2025: member

    Noticed this when going to update the lighting docs, porting what they do using Autotools. i.e:

    ./autogen.sh
    ./configure
    make src/bitcoind src/bitcoin-cli
    make install
    

    If you attempt the same with master:

    cmake -B build
    cmake --build build --target bitcoind bitcoin-cli
    cmake --install build
    -- Install configuration: "RelWithDebInfo"
    CMake Error at build/src/test/cmake_install.cmake:57 (file):
      file INSTALL cannot find "/root/ci_scratch/build/src/test/test_bitcoin": No
      such file or directory.
    Call Stack (most recent call first):
      build/src/cmake_install.cmake:77 (include)
      build/cmake_install.cmake:57 (include)
    

    The output of cmake --build build --target list_install_components just prints (if configured with the kernel):

    cmake --build build --target list_install_components 
    > Available install components are: "Kernel" "Unspecified"
    

    so it seems like component based install either isn't yet possible, or the names are not easily discoverable.

    Otherwise, I don't think we should fail to install because we can't find a binary the user didn't want.

  2. fanquake added the label Build system on Jan 28, 2025
  3. theuni commented at 5:49 PM on January 28, 2025: member

    This is frustrating, but it seems to be how CMake works. cmake --install build doesn't force any builds, but make -C build install does.

    I think what you're really looking for is a way to only build/install certain binaries. For that, the workaround would be to name each one as a separate component. That would allow for:

    cmake -B build
    cmake --build build --target bitcoind bitcoin-cli
    cmake --install build --component bitcoind bitcoin-cli
    
  4. hebasto commented at 12:23 PM on January 29, 2025: member

    I think what you're really looking for is a way to only build/install certain binaries. For that, the workaround would be to name each one as a separate component. That would allow for:

    cmake -B build cmake --build build --target bitcoind bitcoin-cli cmake --install build --component bitcoind bitcoin-cli

    I agree. We have already done it for the bitcoinkernel target.

    On the other hand, the CMAKE_SKIP_INSTALL_ALL_DEPENDENCY variable seems not a proper solution because it affects the all target.

  5. fanquake added this to the milestone 29.0 on Jan 31, 2025
  6. fanquake closed this on Feb 14, 2025

  7. fanquake referenced this in commit 73e2ec1373 on Feb 14, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me