3
votes

I want to compile ffmpeg project with mingw-w64 compiler in cygwin environment. I took the following steps:

  1. installed cygwin and mingw-w64 package with the setup-x86_64.exe and git clone the ffmpeg project from https://git.ffmpeg.org/ffmpeg.git.

  2. entered into ffmpeg folder, executed the folloing commands.

./configure --host-os=x86_64-w64-mingw32 --enable-shared --disable-static

make

I found the make command didn't invoke the compiler from mingw-w64, instead it invoked the compiler from cygwin, I have tried the command "make CC=x86_64-w64-mingw32-gcc", but it failed with some errors about missing header files as follows:

fatal error: sys/ioctl.h: No such file or directory

I think these header files have been installed. which command is correct? direct invocation of command make or the command with CC option? I want to use the compiler from mingw-w64 to compile ffmpeg, how can I achieve my goal?

1
I don't know about building with mingw-w64 toolchains in a Cygwin environment, but the build is successful in a MSYS2 MinGW-w64 Win64 build environment without any special ./configure options.Ian Abbott
sys/ioctl.h belongs to cygwin-devel package. Not sure it is used by the cross compiler. I think you need mingw64-x86_64-headers and possibly w32api-headersmatzeri
@matzeri, I have installed both of the headers you mentioned. but I don't know where are the header files located, I searched the whole file system, only one file found, the ioctl.h for cygwin, where is the header files for mingw64-x86_64-headers?Jinlxz Liu
Use the package search for that info cygwin.com/packages/x86_64/mingw64-x86_64-headers/…matzeri
Did you manage to fix this? Pretty sure that your problem is you're using --host-os to cross-compile when you should be using --target-os.Hashim Aziz

1 Answers

1
votes

Use apt-cyg with:

# apt-cyg packageof ioctl.h
cygwin-devel: usr/include/sys/ioctl.h

mingw64-x86_64-headers: usr/x86_64-w64-mingw32/sys-root/mingw/include/ddk/usbstorioctl.h
mingw64-x86_64-headers: usr/x86_64-w64-mingw32/sys-root/mingw/include/devioctl.h
mingw64-x86_64-headers: usr/x86_64-w64-mingw32/sys-root/mingw/include/usbioctl.h
mingw64-x86_64-headers: usr/x86_64-w64-mingw32/sys-root/mingw/include/winioctl.h

w32api-headers: usr/include/w32api/ddk/usbstorioctl.h
w32api-headers: usr/include/w32api/devioctl.h
w32api-headers: usr/include/w32api/usbioctl.h
w32api-headers: usr/include/w32api/winioctl.h

Thus the file belong to the cygwin-devel package. Install with apt-cyg install cygwin-devel.