RosettaCommons / binder

Binder, tool for automatic generation of Python bindings
MIT License
317 stars 67 forks source link

Installation stucks when exexcuting the build-and-run-tests.py #72

Open nuistzhou opened 5 years ago

nuistzhou commented 5 years ago

image Just like what you see in ths screen shot.

supreme-core commented 5 years ago

I am also encountering this issue

lyskov commented 5 years ago

Thank you for reporting this @nuistzhou and @supreme-core ! I just double check and this script work as expected on my machine... could you please post you platform info? Particularly, did you run this on Linux or Mac? And what is compilers versions.

Also, screenshot shows that you running this script with -j1: please note that building Binder requite considerable time. On my system it take ~10min to build it while using 50 cores. Could it be that the script was actually working but did not have time to finish the job? Thanks,

supreme-core commented 5 years ago

someone@somewhere:/opt/binder $ sudo ./build-and-run-tests.py

Download llvm source. curl http://releases.llvm.org/4.0.0/llvm-4.0.0.src.tar.xz | tar -Jxo && mv llvm-4.0.0.src /opt/binder/build/llvm-4.0.0 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 20.0M 100 20.0M 0 0 6482k 0 0:00:03 0:00:03 --:--:-- 6482k

Download clang source. curl http://releases.llvm.org/4.0.0/cfe-4.0.0.src.tar.xz | tar -Jxo && mv cfe-4.0.0.src /opt/binder/build/llvm-4.0.0/tools/clang % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10.3M 100 10.3M 0 0 5757k 0 0:00:01 0:00:01 --:--:-- 5757k

Building tool: binder... cd /opt/binder/build/llvm-4.0.0/build_4.0.0.linux.eric-computer.release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=ON .. && ninja bin/binder clang -j1

It has been running for about 2 hours. Still running, I am going leave it on for another 4 hours and see what happens. Ubuntu 18.04 Memory: 12 GB Processor: Intel Core i5 @ 1.9GHZ (4 cores) OS Type: 64 bit

supreme-core commented 5 years ago

Was missing Ninja and Clang. To install it on ubuntu: sudo apt-get install ninja-build sudo apt-get install clang

However, I encountered error on the tests, it stopped on T10. Checked for /opt/binder/build/bin/binder but wasn't able to find the bin folder and the binary.

T10.inheritance.hpp Running test... /opt/binder/build/llvm-4.0.0/build_4.0.0.linux.eric-computer.release/bin/binder --bind "" --root-module T10_inheritance --prefix /opt/binder/test/build/ --single-file --annotate-includes /opt/binder/test/build//T10.inheritance.hpp.include -- -x c++ -std=c++11 -I /opt/binder/test -I /opt/binder/test/.. Generate bindings, pass 1... Generate bindings, pass 2... Sorting Binders... Sorting Binders... Done. Writing code... Writing code... Done.

T10.inheritance.hpp Compiling binding results... cd /opt/binder/test/build/ && clang++ -O3 -shared -std=c++11 -isystem /opt/binder/build/pybind11/include -I/usr/include/python2.7 -I./.. -I./../.. -I./../../source T10_inheritance.cpp -o T10_inheritance.so -fPIC

T10.inheritance.hpp Testing imports... cd /opt/binder/test/build/ && python2.7 -c 'import T10_inheritance'

Comparing results for test T10.inheritance.hpp... diff /opt/binder/test/T10.inheritance.ref /opt/binder/test/build//T10_inheritance.cpp 230,231d229 < cl.def( pybind11::init( [](B const &o){ return new B(o); } ) ); < cl.def("assign", (class B & (B::*)(const class B &)) &B::operator=, "C++: B::operator=(const class B &) --> class B &", pybind11::return_value_policy::automatic, pybind11::arg(""));

Encounter error while executing: diff /opt/binder/test/T10.inheritance.ref /opt/binder/test/build//T10_inheritance.cpp

Encounter error while executing: diff /opt/binder/test/T10.inheritance.ref /opt/binder/test/build//T10_inheritance.cpp

230,231d229 < cl.def( pybind11::init( [](B const &o){ return new B(o); } ) ); < cl.def("assign", (class B & (B::*)(const class B &)) &B::operator=, "C++: B::operator=(const class B &) --> class B &", pybind11::return_value_policy::automatic, pybind11::arg(""));

lyskov commented 5 years ago

However, I encountered error on the tests, it stopped on T10. Checked for /opt/binder/build/bin/binder but wasn't able to find the bin folder and the binary.

This script is not aim to install Binder system-wide - it just compile and run it locally. If you want to make Binder available to all user of your system then you will need to do this manually.

Re failing tests: current test for Binder is sensitive to exact compiler+libc++ version. So such failure is to be expected. In other word i would not worry too much about it. Just try to generate bindings for your project and if resulted code could be compiled then all is good!

supreme-core commented 5 years ago

Thank you, installation went through. I don't know how to turn on the verbose option to allow you to see detail log during the installation. I was using Intel i5 quad core laptop with 12 gb of memory, and ran for 3 hours.

anparoct commented 5 years ago

Hi, I don't often write about issues on GitHub but I need to start somewhere I guess. This thread seems appropriate because I'm stuck too in the installation (On Windows 7):

1st option tried

The installation procedure proposed goes as follow and I did it completely...

Create build dir
$mkdir $HOME/prefix && cd $HOME/prefix
 Clone  LLVM
$git clone http://llvm.org/git/llvm.git llvm && cd llvm
$git reset --hard origin/release_38

Clone Clang
$cd $HOME/prefix/llvm/tools
$git clone http://llvm.org/git/clang.git clang
$cd clang && git reset --hard origin/release_38

Clone Clang extra tools
$cd $HOME/prefix/llvm/tools/clang/tools
$git clone http://llvm.org/git/clang-tools-extra.git extra

Create symlink pointing to binder/src dir
$ln -s $HOME/binder/binder $HOME/prefix/llvm/tools/clang/tools/extra/binder

Create ``llvm/tools/clang/tools/extra/CMakeLists.txt`` file with content: ``add_subdirectory(binder)``
$echo 'add_subdirectory(binder)' > $HOME/prefix/llvm/tools/clang/tools/extra/CMakeLists.txt

Build Binder
$mkdir $HOME/prefix/build && cd $HOME/prefix/build
$cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_EH=1 -DLLVM_ENABLE_RTTI=ON .. && ninja

At this point, if all above steps is succeseful, binder should be at $HOME/prefix/build/bin/binder

The problem is that I don't understand how could we use cmake in the ''prefix'' folder, when there's no CMakeLists.txt in the first place? Should I create one? What am I missing here?

Also at the creation of the symlink, it's not a big deal but it's written ''../binder/binder'' as a source, but just on top you wrote ''binder/src dir''.

2nd option tried

I've tried to run the script ''build-and-run-tests.py'' , but it stops.

Output from MINGW64 (Git Bash): $ ./build-and-run-tests.py Traceback (most recent call last): File "./build-and-run-tests.py", line 19, in <module> import build File "J:\binder\build.py", line 28, in <module> _machine_name_ = os.uname()[1] AttributeError: module 'os' has no attribute 'uname'

I did try a small change in the script, according to python: _machine_name_ = platform.node() #os.uname()[1] would do it.

Then I got this by running the script again :

 ./build-and-run-tests.py
Traceback (most recent call last):
  File "./build-and-run-tests.py", line 53, in <module>
    main(sys.argv)
  File "./build-and-run-tests.py", line 45, in main
    if not Options.binder: Options.binder = build.install_llvm_tool('binder', source_path+'/source', source_path + '/build', Options.binder_debug, jobs=Options.jobs, gcc_install_prefix=Options.gcc_install_prefix)
  File "J:\binder\build.py", line 102, in install_llvm_tool
    os.symlink(source_location, tool_link_path)
PermissionError: [WinError 5] Access is denied: 'J:\\binder/source' -> 'J:\\binder/build/llvm-4.0.0/tools/clang/tools/extra/binder'

When I run ''build.py'', this is the output I get :

$ ./build.py
./build.py:17: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import os, sys, argparse, platform, subprocess, imp, shutil, distutils.dir_util
Traceback (most recent call last):
  File "./build.py", line 174, in <module>
    main(sys.argv)
  File "./build.py", line 166, in main
    if not Options.binder: Options.binder = install_llvm_tool('binder', source_path+'/source', source_path + '/build', Options.binder_debug, jobs=Options.jobs)
  File "./build.py", line 102, in install_llvm_tool
    os.symlink(source_location, tool_link_path)
PermissionError: [WinError 5] Access is denied: 'J:\\binder/source' -> 'J:\\binder/build/llvm-4.0.0/tools/clang/tools/extra/binder'

Pretty alike but in the ''build.py'' script , you can see a deprecation warning... not sure if I only need to change imp module for importlib... Anyway, I feel like I didn't have to change anything in this script to make it work... now I see that the last error might be more related to the access/permissions of Windows itself.

In the case of the first option, what should I do? If you have any recommendation for the second option, they're welcome also.

Edit :

Yes I did try to run the script by running CMD.exe as an administrator image

I have the same exact output...

My machine :

Windows 7 Intel Core i7-6700 CPU 64 bits

Thank you for your time

lyskov commented 5 years ago

re 2nd option: we currently do not build Binder on native Windows platform so current version of build.py does not support it.

re 1st option: I am guessing that you using UNIX subsystem of Windows? If so, then please note that bindings generated by Binder build in such way will reflect libc++ that used in such subsystem. This might be an issue if you later planning to build native Windows Python module.

To answer your direct questions: the CMakeLists.txt root file come from LLVM repository, so if you cloned and checkout the right revision it should be there.