g2p / bedup

Btrfs deduplication
http://pypi.python.org/pypi/bedup
GNU General Public License v2.0
324 stars 50 forks source link

Compilation error: invalid application of ‘sizeof’ to incomplete type #106

Open gonciarz opened 1 year ago

gonciarz commented 1 year ago
  1. Create an isolated virtual python env.
  2. source bin/activate
  3. pip install cffi
  4. pip install bedup
pip install bedup
Collecting bedup
  Downloading bedup-0.10.1.tar.gz (75 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.8/75.8 kB 1.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [76 lines of output]
      bedup/platform/__pycache__/_cffi__x60defbacxcd6ff1fb.c: In function ‘_cffi_layout_struct_fiemap’:
      bedup/platform/__pycache__/_cffi__x60defbacxcd6ff1fb.c:524:11: error: invalid application of ‘sizeof’ to incomplete type ‘struct fiemap_extent[]’
        524 |     sizeof(((struct fiemap *)0)->fm_extents),
            |           ^
      Traceback (most recent call last):
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py", line 186, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py", line 1007, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn
          raise DistutilsExecError(
      distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/rob/src/bedup/lib/python3.11/site-packages/cffi/ffiplatform.py", line 51, in _build
          dist.run_command('build_ext')
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/dist.py", line 1217, in run_command
          super().run_command(command)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
          cmd_obj.run()
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
          self.build_extensions()
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
          self._build_extensions_serial()
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 547, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py", line 599, in compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/home/rob/src/bedup/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py", line 188, in _compile
          raise CompileError(msg)
      distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-3wff8tuy/bedup_dd85fbe197434211a2d92bf3c4363f83/setup.py", line 71, in <module>
          ext_modules=get_ext_modules(),
                      ^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-3wff8tuy/bedup_dd85fbe197434211a2d92bf3c4363f83/bedup/platform/cffi_support.py", line 57, in get_ext_modules
          return [mod.ffi.verifier.get_extension() for mod in get_mods()]
                                                              ^^^^^^^^^^
        File "/tmp/pip-install-3wff8tuy/bedup_dd85fbe197434211a2d92bf3c4363f83/bedup/platform/cffi_support.py", line 49, in get_mods
          from . import (
        File "/tmp/pip-install-3wff8tuy/bedup_dd85fbe197434211a2d92bf3c4363f83/bedup/platform/btrfs.py", line 30, in <module>
          from .fiemap import same_extents
        File "/tmp/pip-install-3wff8tuy/bedup_dd85fbe197434211a2d92bf3c4363f83/bedup/platform/fiemap.py", line 83, in <module>
          lib = cffi_support.verify(ffi, '''
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-3wff8tuy/bedup_dd85fbe197434211a2d92bf3c4363f83/bedup/platform/cffi_support.py", line 45, in verify
          return ffi.verify(source, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/rob/src/bedup/lib/python3.11/site-packages/cffi/api.py", line 468, in verify
          lib = self.verifier.load_library()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/rob/src/bedup/lib/python3.11/site-packages/cffi/verifier.py", line 105, in load_library
          self._compile_module()
        File "/home/rob/src/bedup/lib/python3.11/site-packages/cffi/verifier.py", line 202, in _compile_module
          outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/rob/src/bedup/lib/python3.11/site-packages/cffi/ffiplatform.py", line 22, in compile
          outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/rob/src/bedup/lib/python3.11/site-packages/cffi/ffiplatform.py", line 58, in _build
          raise VerificationError('%s: %s' % (e.__class__.__name__, e))
      cffi.VerificationError: CompileError: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

[notice] A new release of pip available: 22.3.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
gcc --version
gcc (GCC) 13.1.1 20230429
gonciarz commented 1 year ago

I've tried a different scenario:

  1. source bin/activate
  2. pip install --upgrade pip
  3. pip install cffi
  4. pip install bedup

Now I see a different error message:

ModuleNotFoundError: No module named 'cffi'