Skip to content

Fix rpmbuild error: Empty Debug Files

Using Fedora 29 (on docker) after bootstrap execute:

    $ ./cerbero-uninstalled package -k gstreamer-1.0

    error: Empty %files file /root/cerbero/build/tmpk0u0dzp9/BUILD/base-system-1.0-1.17.0.1/debugsourcefiles.list
    RPM build errors:
        Empty %files file /root/cerbero/build/tmpk0u0dzp9/BUILD/base-system-1.0-1.17.0.1/debugsourcefiles.list
    Traceback (most recent call last):
      File "./cerbero/utils/shell.py", line 157, in call
        env=env, shell=shell)
      File "/usr/lib64/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'rpmbuild -bb --buildroot /root/cerbero/build/tmpk0u0dzp9/buildroot --target x86_64-redhat-linux /root/cerbero/build/tmpk0u0dzp9/base-system-1.0.spec' returned non-zero exit status 1.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "./cerbero/main.py", line 158, in run_command
        res = commands.run(command, self.config, self.args)
      File "./cerbero/commands/__init__.py", line 78, in run
        return _commands[command].run(config, args)
      File "./cerbero/commands/package.py", line 107, in run
        args.force, args.keep_temp)
      File "./cerbero/packages/linux.py", line 57, in pack
        self.pack_deps(output_dir, tmpdir, force)
      File "./cerbero/packages/linux.py", line 115, in pack_deps
        packager.pack(output_dir, self.devel, force, True, True, tmpdir)
      File "./cerbero/packages/linux.py", line 57, in pack
        self.pack_deps(output_dir, tmpdir, force)
      File "./cerbero/packages/linux.py", line 115, in pack_deps
        packager.pack(output_dir, self.devel, force, True, True, tmpdir)
      File "./cerbero/packages/linux.py", line 78, in pack
        paths = self.build(output_dir, tarname, tmpdir, packagedir, srcdir)
      File "./cerbero/packages/rpm.py", line 239, in build
        target, self.spec_path))
      File "./cerbero/utils/shell.py", line 160, in call
        raise FatalError(_("Error running command: %s") % cmd)
    cerbero.errors.FatalError: Fatal Error: Error running command: rpmbuild -bb --buildroot /root/cerbero/build/tmpk0u0dzp9/buildroot --target x86_64-redhat-linux /root/cerbero/build/tmpk0u0dzp9/base-system-1.0.spec
    ***** Error running 'package' command:
    Fatal Error: Error running command: rpmbuild -bb --buildroot /root/cerbero/build/tmpk0u0dzp9/buildroot --target x86_64-redhat-linux /root/cerbero/build/tmpk0u0dzp9/base-system-1.0.spec

Solution from https://wiki.mageia.org/en/Packaging_problems_and_solutions

Some packages do not have any Debug Files. This will result in the build error "error: Empty %files file …/debugfiles.list". Fix this by preventing the build or install steps from stripping the binaries (by removing a -s flag or a strip command, if present) or add the -g flag (to cause the compiler to generate the debug info to begin with). If the package has no binaries, then it should be changed to a noarch package. If all else fails, add this to prevent this error:

%define debug_package %{nil}

NOTE the problem also exists in centOS 8 (check !301 (merged))

Merge request reports