Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

Compile FFmpeg with Bash on Windows 10

Troubleshooting compilation problems on all platforms.

Compile FFmpeg with Bash on Windows 10

Postby cybersinh » Fri Apr 14, 2017 9:43 pm

Hi,

In the Creators Update (1703), the Windows 10 bash linux (WSL) can run native windows tools. So, under Windows 10, you can now compile FFmpeg with Visual Studio and the required linux utilities, natively, without having to MinGW or other interop crap software.

Here is how I compiled FFmpeg (using MSVC 2017 toolchain).

You must start the bash shell from "Developer Command Prompt for VS 2017" to set PATH variable to find the MSVC compiler/linker.

If the "make" tool is not already installed, simply type "sudo apt-get install make".

To call Windows program from the bash shell, you have to not forget to type the command with its .exe extension. So, you must adapt the "configure" and "compat/windows/makedef" files to add ".exe" at the end of "cl", "link" (no confusion possible with the /usr/bin/link), "dumpbin" and "lib" executables:

configure

Code: Select all
cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
        if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
            cc_default="cl.exe"
        else
            cc_default="c99wrap cl"
        fi
        ld_default="link.exe"
        nm_default="dumpbin.exe -symbols"
        ar_default="lib.exe"


compat/windows/makedef

Code: Select all
lib.exe -out:${libname} $@ >/dev/null

arch=$(dumpbin.exe -headers ${libname} |
       tr '\t' ' ' |
       grep '^ \+.\+machine \+(.\+)' |
       head -1 |
       sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(...\)).*/\1/')

dump=$(dumpbin.exe -linkermember:1 ${libname})


I hope the FFmpeg build tool chain will be adapted to be better developer-friendly for compiling FFmpeg under bash on Windows...

If you want to set an absolute path for YASM in the "configure", you have to use the following pattern "/mnt/[letter_partition]/path/yasm.exe".

Code: Select all
./configure --toolchain=msvc --yasmexe='/mnt/e/Home/Important/Development/Toolkit/Tools/yasm-1.3.0-win32.exe' [all other settings you need]


The "make" command should generate the lib as expected.
Code: Select all
make


Then, I tried to type "make install" but I get the following error:
No rule to make the target "libavutil\x86\x86util.asm", needed for "libavutil/x86/cpuid.o".
I don't know what is wrong, but perhaps someone could give me an idea.

Because of native linux tools support, we can expect soon an easier compilation under Windows.
Compiling FFmpeg in Windows should be as easy as Linux.

Thanks Microsoft!

Feel free to share your own experience on compiling FFmpeg with the bash shell under Windows 10.

Regards,

Cyber Sinh
cybersinh
 
Posts: 1
Joined: Fri Apr 14, 2017 4:44 pm

Return to Compiling FFmpeg

Who is online

Users browsing this forum: No registered users and 1 guest