Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install failed on ubuntu22.04 with python 3.8 on ffmpeg 3.4.9 #20

Open
hs150521 opened this issue Jan 17, 2024 · 1 comment
Open

Install failed on ubuntu22.04 with python 3.8 on ffmpeg 3.4.9 #20

hs150521 opened this issue Jan 17, 2024 · 1 comment

Comments

@hs150521
Copy link

I'm running
pip install .
and it went wrong, here is the output

yuanzl@yuanzl-pi5:~/h264decoder-master$ pip install .
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing /home/yuanzl/h264decoder-master
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: h264decoder
  Building wheel for h264decoder (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [69 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- The C compiler identification is GNU 9.5.0
      -- The CXX compiler identification is GNU 9.5.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
      -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.18", minimum required is "3.6")
      -- Found PythonLibs: /usr/lib/aarch64-linux-gnu/libpython3.8.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- Found pybind11: /home/yuanzl/.local/include (found version "2.11.1")
      Using existing pybind11 v2.11.1
      -- Configuring done
      -- Generating done
      -- Build files have been written to: /home/yuanzl/h264decoder-master/build/temp.linux-aarch64-3.8
      [ 25%] Building CXX object CMakeFiles/h264decoderlib.dir/src/h264decoder.cpp.o
      /home/yuanzl/h264decoder-master/src/h264decoder.cpp: In constructor ‘H264Decoder::H264Decoder()’:
      /home/yuanzl/h264decoder-master/src/h264decoder.cpp:40:28: error: ‘AV_CODEC_CAP_TRUNCATED’ was not declared in this scope; did you mean ‘AV_CODEC_CAP_HARDWARE’?
         40 |   if(codec->capabilities & AV_CODEC_CAP_TRUNCATED) {
            |                            ^~~~~~~~~~~~~~~~~~~~~~
            |                            AV_CODEC_CAP_HARDWARE
      /home/yuanzl/h264decoder-master/src/h264decoder.cpp:41:23: error: ‘AV_CODEC_FLAG_TRUNCATED’ was not declared in this scope; did you mean ‘AV_CODEC_FLAG_DROPCHANGED’?
         41 |     context->flags |= AV_CODEC_FLAG_TRUNCATED;
            |                       ^~~~~~~~~~~~~~~~~~~~~~~
            |                       AV_CODEC_FLAG_DROPCHANGED
      gmake[2]: *** [CMakeFiles/h264decoderlib.dir/build.make:76: CMakeFiles/h264decoderlib.dir/src/h264decoder.cpp.o] Error 1
      gmake[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/h264decoderlib.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/yuanzl/h264decoder-master/setup.py", line 79, 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.8/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 299, in run
          self.run_command('build')
        File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3.8/distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
          self.distribution.run_command(command)
        File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/home/yuanzl/h264decoder-master/setup.py", line 46, in run
          self.build_extension(ext)
        File "/home/yuanzl/h264decoder-master/setup.py", line 77, in build_extension
          subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
        File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' 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 h264decoder
  Running setup.py clean for h264decoder
Failed to build h264decoder
ERROR: Could not build wheels for h264decoder, which is required to install pyproject.toml-based projects

I'm quite confused because It seems to be a incompatible question on ffmpeg, which AV_CODEC_CAP_TRUNCATED has been removed on ffmpeg 6.0, but I'm using ffmpeg 3.4.9 and I don't know how to fix that.

@TSoli
Copy link

TSoli commented Mar 26, 2024

So the issue for me was that I had previously installed a newer version of ffmpeg (6.x) through a ppa and that required the newer version of libavcodec which caused this error. Once I uninstalled both and downgraded to ffmpeg 4.4.2 and libavcodec 58 (which I believe are the defaults for ubuntu 22.04?), the package compiled correctly. Had to remove the ppa, then sudo apt autoremove then sudo apt install ffmpeg. Check with ffmpeg -version and you can check the libavcodec you have installed with ls -l /usr/lib/x86_64-linux-gnu/libavcodec*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants