添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
傻傻的开水瓶  ·  C# .net ...·  2 天前    · 
开心的足球  ·  elasticsearch docker ...·  2 年前    · 

how to cross compile ffmpeg with nvidia cuda_sdk and libnpp #249

Closed
@hydra3333

Description

I know this is cross-site posting, but thought it's relevant here too plus someone may read this here if they don't visit zeranoe's site.

https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=5&t=5109&p=12505#p12505

Newbie alert. Googled an issue but couldn't find a solution. So, I am seeking advice from someone who may already have invented this particular wheel or be able to provide pointers on where to next.

Goal:
To cross compile ffmpeg with nvidia cuda_sdk and libnpp under mingw64 so the final .exe runs under windows 10 x64
eg using something like this on the ffmpeg configure commandline
--enable-cuda-sdk --enable-filter=scale_cuda --extra-cflags=-I/usr/cuda_8.0.61/cuda/include --extra-ldflags=-L/usr/cuda_8.0.61/cuda/lib/x64

Issue:
Using a version of rdp's fantastic cross-compile script, which is based on Zeranoe's toolchain, with the above flags it eventually yields this error:

CC	libavfilter/vf_scale_cuda.o
NVCC	libavfilter/vf_scale_cuda.ptx
ERROR: No supported gcc/g++ host compiler found, but clang-3.8 is available.
       Use 'nvcc -ccbin clang-3.8' to use that instead.
ffbuild/common.mak:95: recipe for target 'libavfilter/vf_scale_cuda.ptx' failed
make: *** [libavfilter/vf_scale_cuda.ptx] Error 1

Any suggestions on where to from here to cross-compile it ?

Roughie Process so far:

  • Install this package under an ubuntu 17.04 VM, to get access to the nvcc compiler. It isn't the latest version, but should still work.
    sudo apt-get install -y nvidia-cuda-toolkit
  • This isn't enough, we also need the Windows libs and includes, so download the relevant cuda toolkit exe under Windows 10
    from the nvidia developer site, https://developer.nvidia.com/cuda-downloads
    cuda_8.0.61_win10.exe
  • Then run cuda_8.0.61_win10.exe in Windows 10.
    It'll extract the files to a temporary folder before it then tries to install the stuff.
    After it's finished extracting and then whilst it's figuring out how to install, copy the full extracted folder tree to another place so we have our own copy if it.
    After our own folder copies have finished, cancel the installation.
  • Locate folders cuda/include and cuda/lib/x64 in the newly copied folder tree and copy them to somewhere else alongside one another.
    Then also locate folders /npp/include and /npp/lib/x64 and also copy them to somewhere else alongside one another.
  • Back under Linux Ubuntu, use sudo to create folder cuda_8.0.61 under /usr and then set permissions on it sort of like this
    [code]sudo mkdir /usr/cuda_8.0.61
    chmod +777 -R /usr/cuda_8.0.61[/code]
  • Copy those 4 folder trees we copied earlier, from Windows to the Ubuntu box to become like these
    [code]/usr/cuda_8.0.61/cuda/include
    /usr/cuda_8.0.61/cuda/lib/x64
    /usr/cuda_8.0.61/npp/include
    /usr/cuda_8.0.61/npp/lib/x64[/code]
  • Now we should be able to type nvcc and see it try to compile something and fail which is OK
    By now the necessary folders and whatnot exist (well, nearly) for ffmpeg to be built (cross-compiled) with cuda sdk.
  • Edit the ffmpeg cross-compile build script and add these flags to the ffmpeg configure, to cross-compile stuff with the cuda sdk
    [code]--enable-cuda-sdk --enable-filter=scale_cuda --extra-cflags=-I/usr/cuda_8.0.61/cuda/include --extra-ldflags=-L/usr/cuda_8.0.61/cuda/lib/x64 [/code]
  • Then if you're game, also add these flags to the ffmpeg cross-compile configure line
    [code]--enable-libnpp --extra-cflags=-I/usr/cuda_8.0.61/npp/include --extra-ldflags=-L/usr/cuda_8.0.61/npp/lib/x64[/code]
  • Try to cross-compile ffmpeg and see how the luck holds. [i](edit: it blows up, hence this post)[/i]
  • edit: interesting info here. i think i'm stuck
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862522