angr / angr-dev

Some helper scripts to set up an environment for angr development.
BSD 2-Clause "Simplified" License
114 stars 95 forks source link

`./setup.sh -i -e angr` due to `archr` requiring `--no-build-isolation` when `pip` installing #169

Closed zwimer closed 1 year ago

zwimer commented 1 year ago

Description

Below cmake cannot find Ninja, which we install via pip as declared as a build dependency by pyproject.toml

Building wheels for collected packages: archr
  Building editable for archr (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building editable for archr (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [62 lines of output]
      running editable_wheel
      creating /tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info
      writing /tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/requires.txt
      writing top-level names to /tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/top_level.txt
      writing manifest file '/tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/SOURCES.txt'
      reading manifest file '/tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file '/tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr.egg-info/SOURCES.txt'
      creating '/tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr-9.2.25.dev0.dist-info'
      adding license file "LICENSE" (matched pattern "LICENSE")
      creating /tmp/pip-wheel-2doyw0dp/tmp68sh4sno/archr-9.2.25.dev0.dist-info/WHEEL
      /home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      Building Archr support libraries
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 2.8.12 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.

      CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
      CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
      -- Configuring incomplete, errors occurred!
      See also "/home/zwimer/bar/archr/archr/implants/udp_tcp_convert/build/CMakeFiles/CMakeOutput.log".
      Traceback (most recent call last):
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 138, in run
          self._create_wheel_file(bdist_wheel)
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 284, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/command/editable_wheel.py", line 257, in _run_build_commands
          self.run_command("build")
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 992, in run_command
          cmd_obj.run()
        File "<string>", line 38, in run
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 340, in execute
          util.execute(func, args, msg, dry_run=self.dry_run)
        File "/home/zwimer/.virtualenvs/test2/lib/python3.10/site-packages/setuptools/_distutils/util.py", line 343, in execute
          func(*args)
        File "<string>", line 23, in _build_support_libraries
        File "/usr/lib64/python3.10/subprocess.py", line 524, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '.', '-Bbuild']' returned non-zero exit status 1.
      error: Support for editable installs via PEP 660 was recently introduced
      in `setuptools`. If you are seeing this error, please report to:

      https://github.com/pypa/setuptools/issues

      Meanwhile you can try the legacy behavior by setting an
      environment variable and trying to install again:

      SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for archr
Failed to build archr
ERROR: Could not build wheels for archr, which is required to install pyproject.toml-based projects
[!!] 13:44:31 pip failure (--no-build-isolation -e archr).

Steps to reproduce the bug

./setup.sh -i -e angr

Environment

A clean clone of master: https://github.com/angr/angr-dev/commit/059e9bd473dc93fb79ffd778ac189c27f084bb34

Additional context

No response

weaver9651 commented 1 year ago

You may have already solved it, but for me, sudo apt install ninja-build worked.

zwimer commented 1 year ago

That may work because it puts ninja into your system path; but we are trying to install our desired version of ninja via pip; which this overrides.