xiaojin093 2023-11-15 21:26 采纳率: 53.3%
浏览 5

windows编译ffmpeg报cl.exe未找到

ffmpeg6.01代码在windows编译,按下面步骤
1.安装了MSYS2及vs2022社区版,
2.参照网上说的打开MSYS2 MINGW64,执行了pacman -S mingw-w64-x86_64-toolchain和pacman -S base-devel,
3.接着进入ffmpeg源代码目录,执行 ./configure --prefix=./install --toolchain=msvc --arch=x86 --enable-shared --enable-gpl --enable-libx264 --enable-libx265 --enable-dxva2 --enable-cross-compile
提示错误如下:
Admin@DESKTOP-BR9VGL7 MINGW64 /d/bj/ffmpeg6
$ ./configure --prefix=./install --toolchain=msvc --arch=x86 --enable-shared --enable-gpl --enable-libx264 --enable-libx265 --enable-dxva2 --enable-cross-compile
cl.exe is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

config.log中错误如下,

zRQbBq
WARNING: Unknown C compiler cl.exe, unable to select optimal CFLAGS
test_ld cc
test_cc
BEGIN ./ffconf.br6QZA64/test.c
    1    int main(void){ return 0; }
END ./ffconf.br6QZA64/test.c
cl.exe -c -o ./ffconf.br6QZA64/test.o ./ffconf.br6QZA64/test.c
./configure: line 995: cl.exe: command not found
C compiler test failed.

在环境变量path中添加cl.exe的路径"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64",还是报一样的错误,请问是什么原因,vs2022也重新安装过重启过电脑了

  • 写回答

2条回答 默认 最新

  • 虫鸣@蝶舞 2023-11-16 08:33
    关注

    在 MSYS2 MinGW 64-bit 环境中,通常不使用 Visual Studio 的 cl.exe 编译器,而是使用 GCC 编译器。如果你希望在 MSYS2 中使用 cl.exe,这通常不是标准做法,因为 MSYS2 和 MinGW 是为了 GCC 编译器设计的。

    不过,如果你有特殊的理由需要使用 cl.exe,你可以尝试以下步骤:

    1. 确保你的系统已安装 Visual Studio 并且有 C/C++ 支持。

    2. 找到 cl.exe 的路径。通常,它位于 C:\Program Files (x86)\Microsoft Visual Studio\{version}\{edition}\VC\Tools\MSVC\{version}\bin

    3. cl.exe 的路径添加到 MSYS2 的 PATH 环境变量中。这可以在 MSYS2 的 shell 中临时通过以下命令完成:

      export PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/{version}/{edition}/VC/Tools/MSVC/{version}/bin
      

      请根据你的 Visual Studio 安装路径调整上述命令中的 {version}{edition}

    4. 然后,在 MSYS2 中运行 FFmpeg 的 ./configure 脚本,并使用 --cc 选项指定 cl.exe

      ./configure --cc='cl.exe' ...
      
    5. 请注意,FFmpeg 可能需要其他 Visual Studio 环境变量和库才能正确编译。在这种情况下,更推荐的方法是使用 Visual Studio 的“开发者命令提示符”来设置环境变量。

    如果你不需要特定地使用 cl.exe,建议你在 MSYS2 MinGW 64-bit 环境中使用默认的 GCC 编译器来编译 FFmpeg。这样可以通过简单地运行 ./configure 无需额外的配置步骤。如果你有特殊需求必须使用 cl.exe,可能需要更多的配置工作,而且这样的设置并不常见。

    评论

报告相同问题?

问题事件

  • 创建了问题 11月15日

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大