Skip to content

Instantly share code, notes, and snippets.

@hebasto
Last active July 30, 2024 12:30
Show Gist options
  • Save hebasto/7c126e7839e801ae00ece946a8ee83d7 to your computer and use it in GitHub Desktop.
Save hebasto/7c126e7839e801ae00ece946a8ee83d7 to your computer and use it in GitHub Desktop.
Building Bitcoin Core from Read-Only Archive

Working with a Read-Only Source Directory

To build with a read-only source directory, the build directory must reside outside of the source directory. For instance, it can be a sibling directory:

cmake -B ../build
cmake --build ../build

Running ctest is also supported for the read-only source directory:

ctest --test-dir ../build

Note: PR30533 improves this functionality.

To run functional tests with the read-only source directory, choose one of the following options:

  1. Disable Python bytecode creation:
    python3 -B ../build/test/functional/test_runner.py
    
    or
    env PYTHONDONTWRITEBYTECODE=1 ../build/test/functional/test_runner.py
    

UPDATE: Actually, there is no need to force Python to disable bytecode creation. It will skip it automaticaly if filesystem permissions do not allow to write it.

  1. Specify the Python cache prefix path somewhere outside of the source directory:
    python3 -X pycache_prefix=$(PWD)/../build ../build/test/functional/test_runner.py
    
    or
    env PYTHONPYCACHEPREFIX=$(PWD)/../build ../build/test/functional/test_runner.py
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment