Open wangxdgg opened 2 months ago
I haven't seen this error before, but it seems like the timeloop libraries are built without PIC and that is causing the issue. Would you mind providing some information about how you built timeloop? E.g., what commands did you call to build timeloop.
Hi, I apologize for the disturbance, but I am also encountering the same issue after pulling the most recent version of the Accelergy-Timeloop Infrastructure. After pulling the infrastructure, I also updated some of the repositories to their most recent commit:
I then built the infrastructure as explained in: https://timeloop.csail.mit.edu/v4/installation, thereby building Timeloop through SConstruct with scons -j4 --with-isl --static --accelergy
.
Subsequently I proceeded to install pytimeloop as per its README: https://github.com/Accelergy-Project/timeloop-python/blob/main/README.md
As a result, the same error as above occurs.
I managed to work around the issue somewhat by modifying Timeloop's SConstruct as follows:
# ...
env = Environment(ENV = os.environ)
if not GetOption('clang'):
env.Append(CCFLAGS=['-fPIC'])
#...
And after re-building Timeloop, I got a different error while running pip3 install -e .
for pytimeloop:
# ...
[ 46%] Building CXX object CMakeFiles/bindings.dir/src/model/bounded-queue-accelerator-pool.cpp.o
[ 50%] Building CXX object CMakeFiles/bindings.dir/src/model/unbounded-queue-accelerator-pool.cpp.o
[ 53%] Building CXX object CMakeFiles/bindings.dir/src/model/util.cpp.o
[ 56%] Building CXX object CMakeFiles/bindings.dir/bindings/accelergy_interface.cpp.o
[ 60%] Building CXX object CMakeFiles/bindings.dir/bindings/applications.cpp.o
[ 63%] Building CXX object CMakeFiles/bindings.dir/bindings/bindings.cpp.o
[ 66%] Building CXX object CMakeFiles/bindings.dir/bindings/buffer.cpp.o
[ 70%] Building CXX object CMakeFiles/bindings.dir/bindings/config.cpp.o
[ 73%] Building CXX object CMakeFiles/bindings.dir/bindings/looptree.cpp.o
/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings/looptree.cpp: In function ‘void pytimeloop::looptree_bindings::BindLooptree(pybind11::module&)’:
/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings/looptree.cpp:14:16: error: ‘application’ was not declared in this scope; did you mean ‘Application’?
14 | py::class_<application::LooptreeModel>(m, "LooptreeModelApp")
| ^~~~~~~~~~~
| Application
/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings/looptree.cpp:14:42: error: template argument 1 is invalid
14 | py::class_<application::LooptreeModel>(m, "LooptreeModelApp")
| ^
/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings/looptree.cpp:18:32: error: ‘application’ is not a class, namespace, or enumeration
18 | .def_readwrite("ops", &application::LooptreeModel::Result::ops)
| ^~~~~~~~~~~
/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings/looptree.cpp:19:33: error: ‘application’ is not a class, namespace, or enumeration
19 | .def_readwrite("fill", &application::LooptreeModel::Result::fill)
| ^~~~~~~~~~~
/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings/looptree.cpp:20:38: error: ‘application’ is not a class, namespace, or enumeration
20 | .def_readwrite("occupancy", &application::LooptreeModel::Result::occupancy);
| ^~~~~~~~~~~
gmake[2]: *** [CMakeFiles/bindings.dir/build.make:244: CMakeFiles/bindings.dir/bindings/looptree.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:156: CMakeFiles/bindings.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/setup.py", line 97, in <module>
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/develop.py", line 34, in run
self.install_for_development()
File "/usr/lib/python3/dist-packages/setuptools/command/develop.py", line 114, in install_for_development
self.run_command('build_ext')
File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/setup.py", line 91, in build_extension
subprocess.check_call(
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
[end of output]
To solve this error, I temporarily rolled back the last commit of pytimeloop, going from 54cdc1e50a1d0b34dedd3c39f1c649e14f983253 to 95e4a731d7e518ea16a59ed217fbac5330a6b777.
After this, I have been able to successfully run pip3 install -e .
for pytimeloop.
However, once I try to import it, I get the following error:
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytimeloop
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/pytimeloop/init.py", line 1, in <module>
from bindings import *
ImportError: /home/zero/Desktop/Timeloop/accelergy-timeloop-infrastructure/src/timeloop-python/bindings.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZTIN5boost13serialization13typeid_system27extended_type_info_typeid_0E
I don't know if the steps I took were meaningful in fixing the problem, but anyway I did not manage to go any further from here. If there is any further information that you think could be of help, I will promptly to provide it.
Thank you in advance.
On a side note, I also tried to use pytimeloop within the Docker container mentioned in the documentation, however I cannot successfully import pytimeloop there too, with the following error (on a freshly created container):
workspace@accelergy-timeloop:~$ python3
Python 3.8.10 (default, Nov 22 2023, 10:22:35)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytimeloop
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/pytimeloop/init.py", line 1, in <module>
from bindings import *
ImportError: libbarvinok.so.23: cannot open shared object file: No such file or directory
I followed the timeloop tutorial to install it, and then followed the timeloop-python Installing, but pip3 install -e. The following error message is returned.
Thank you for your assistance!