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

issue fanquake openend 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:

    0./autogen.sh
    1./configure
    2make src/bitcoind src/bitcoin-cli
    3make install
    

    If you attempt the same with master:

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

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

    0cmake --build build --target list_install_components 
    1> 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:

    0cmake -B build
    1cmake --build build --target bitcoind bitcoin-cli
    2cmake --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


fanquake theuni hebasto

Labels
Build system

Milestone
29.0


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: 2025-02-22 06:12 UTC

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