Skip to content

Linking errors and warnings lead to failure in generating shared library #29

@wangxdgg

Description

@wangxdgg

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.

(base) root@2b5da774569c:/home/workspace/gamma/accelergy-timeloop-infrastructure/src/timeloop-python# pip3 install .
Processing /home/workspace/gamma/accelergy-timeloop-infrastructure/src/timeloop-python
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pyyaml in /root/miniforge-pypy3/lib/python3.9/site-packages (from pytimeloop==0.0.1) (6.0.1)
Building wheels for collected packages: pytimeloop
  Building wheel for pytimeloop (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pytimeloop (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [150 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-pypy39
      creating build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/__init__.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/accelergy_interface.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/config.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/engine.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/mapper.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/mapping.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/mapspace.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/model.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/problem.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      copying pytimeloop/search.py -> build/lib.linux-x86_64-pypy39/pytimeloop
      creating build/lib.linux-x86_64-pypy39/tests
      copying tests/__init__.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/test_accelerator.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/test_buffer.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/test_config.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/test_mapper.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/test_model.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/test_topology.py -> build/lib.linux-x86_64-pypy39/tests
      copying tests/util.py -> build/lib.linux-x86_64-pypy39/tests
      creating build/lib.linux-x86_64-pypy39/pytimeloop/app
      copying pytimeloop/app/__init__.py -> build/lib.linux-x86_64-pypy39/pytimeloop/app
      copying pytimeloop/app/call_utils.py -> build/lib.linux-x86_64-pypy39/pytimeloop/app
      copying pytimeloop/app/mapper.py -> build/lib.linux-x86_64-pypy39/pytimeloop/app
      copying pytimeloop/app/model.py -> build/lib.linux-x86_64-pypy39/pytimeloop/app
      creating build/lib.linux-x86_64-pypy39/tests/demo
      copying tests/demo/__init__.py -> build/lib.linux-x86_64-pypy39/tests/demo
      copying tests/demo/demo.py -> build/lib.linux-x86_64-pypy39/tests/demo
      running build_ext
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.
      
        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.
      
      
      -- The C compiler identification is GNU 11.4.0
      -- The CXX compiler identification is GNU 11.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Using timeloop includes from: /home/workspace/gamma/accelergy-timeloop-infrastructure/src/timeloop/include
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE
      -- pybind11 v2.13.0 dev1
      -- Found PythonInterp: /root/miniforge-pypy3/bin/python3.9 (found suitable version "3.9.18", minimum required is "3.6")
      -- Found PythonLibs: python3.9
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- Configuring done (0.9s)
      -- Generating done (0.0s)
      -- Build files have been written to: /home/workspace/gamma/accelergy-timeloop-infrastructure/src/timeloop-python/build/temp.linux-x86_64-pypy39
      [  3%] Building CXX object CMakeFiles/define_gterminate.dir/bindings/gterminate.cpp.o
      [  7%] Linking CXX static library libdefine_gterminate.a
      [  7%] Built target define_gterminate
      [ 10%] Building CXX object CMakeFiles/pytimeloop.dir/src/mapper/coupled-mapper.cpp.o
      [ 14%] Building CXX object CMakeFiles/pytimeloop.dir/src/mapspace/status.cpp.o
      [ 17%] Building CXX object CMakeFiles/pytimeloop.dir/src/model/accelerator.cpp.o
      [ 21%] Building CXX object CMakeFiles/pytimeloop.dir/src/model/bounded-queue-accelerator-pool.cpp.o
      [ 25%] Building CXX object CMakeFiles/pytimeloop.dir/src/model/unbounded-queue-accelerator-pool.cpp.o
      [ 28%] Building CXX object CMakeFiles/pytimeloop.dir/src/model/util.cpp.o
      [ 32%] Linking CXX shared library /home/workspace/gamma/accelergy-timeloop-infrastructure/src/timeloop-python/build/lib.linux-x86_64-pypy39/libpytimeloop.so
      lto-wrapper: warning: using serial compilation of 39 LTRANS jobs
      ../../../timeloop/src/loop-analysis/mapping-to-isl/mapping-to-isl.cpp: In function 'LogicalBufSkewsFromMapping':
      ../../../timeloop/src/loop-analysis/mapping-to-isl/mapping-to-isl.cpp:284:34: warning: 'MEM[(const int &)&last_y_idx_opt]' may be used uninitialized in this function [-Wmaybe-uninitialized]
        284 |       for (int i = last_y_idx; i < loop_idx; ++i)
            |                                  ^
      ../../../timeloop/src/loop-analysis/mapping-to-isl/mapping-to-isl.cpp:174:22: note: 'MEM[(const int &)&last_y_idx_opt]' was declared here
        174 |   std::optional<int> last_y_idx_opt = std::nullopt;
            |                      ^
      ../../../timeloop/src/loop-analysis/mapping-to-isl/mapping-to-isl.cpp:246:7: warning: 'MEM[(const int &)&last_x_idx_opt]' may be used uninitialized in this function [-Wmaybe-uninitialized]
        246 |       for (auto i = last_x_idx; i < loop_idx; ++i)
            |       ^
      ../../../timeloop/src/loop-analysis/mapping-to-isl/mapping-to-isl.cpp:173:22: note: 'MEM[(const int &)&last_x_idx_opt]' was declared here
        173 |   std::optional<int> last_x_idx_opt = std::nullopt;
            |                      ^
      /usr/bin/ld: /tmp/cchzahKo.ltrans30.ltrans.o: relocation R_X86_64_TPOFF32 against symbol `gCtx' can not be used when making a shared object; recompile with -fPIC
      /usr/bin/ld: failed to set dynamic section sizes: bad value
      collect2: error: ld returned 1 exit status
      gmake[2]: *** [CMakeFiles/pytimeloop.dir/build.make:179: /home/workspace/gamma/accelergy-timeloop-infrastructure/src/timeloop-python/build/lib.linux-x86_64-pypy39/libpytimeloop.so] Error 1
      gmake[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/pytimeloop.dir/all] Error 2
      gmake: *** [Makefile:91: all] Error 2
      Traceback (most recent call last):
        File "/root/miniforge-pypy3/lib/pypy3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/root/miniforge-pypy3/lib/pypy3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/root/miniforge-pypy3/lib/pypy3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 97, in <module>
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/command/build_ext.py", line 91, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
          self.build_extensions()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-8c1iw72k/overlay/lib/pypy3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 91, in build_extension
        File "/root/miniforge-pypy3/lib/pypy3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pytimeloop
Failed to build pytimeloop
ERROR: Could not build wheels for pytimeloop, which is required to install pyproject.toml-based projects

Thank you for your assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions