Search code examples
pythonpybind11android-binder

How to properly build binder for pybind11


I'm a new user of binder and I followed the installation steps but when I run the last following command:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=ON .. && ninja

It says: CMake Error: The source directory "/Users/cuinjune/prefix" does not appear to contain CMakeLists.txt.

Am I missing something? I followed the steps twice but am still stuck at the last step. Any guidance would be appreciated.


Solution

  • I couldn't successfully build binder using this installation steps. I too received the following error :

    CMake Error: The source directory "$HOME/prefix" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.

    However, the installation steps seem to be obsolete. You can find the latest installation steps here and the binder repository here.

    As mentioned in the docs, you can clone the binder repository and run build-and-run-tests.py for a default installation.


    While running the build-and-run-tests.py, if you are at this step Building tool: binder..., it might seem as if the process is taking forever as there is no immediate verbose output available.

    Instead you can terminate the build and manually execute the commands in the terminal to get verbose output.

    For example, consider the below output :

    Building tool: binder...
    cd /home/test/binder/build/llvm-6.0.1/build_6.0.1.linux.ubuntu.release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=ON  .. && ninja bin/binder clang -j1
    

    You can terminate (Ctrl+C) the build and run the commands manually in a sequence in the terminal (run the build-and-run-tests.py again to continue the build after manual execution of the commands),

    cd /home/test/binder/build/llvm-6.0.1/build_6.0.1.linux.ubuntu.release
    cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=ON  ..
    ninja bin/binder clang -j1
    

    Furthermore, in the last command you can increase the number of jobs being executed in parallel.

    From man page,

    -j N

    run N jobs in parallel [default=derived from CPUs available]


    Also make sure that prerequisites such as clang and ninja-build are installed as noted in this issue here