how to compile open source software to Windows executables using mingw64

Hi I am Rupesh from India. I have installed opensuse leap 42.2 and Windows 8. I have installed mingw64 packages like gcc on opensuse and Windows 8.

I have some open source software like ffmpeg and lame which I want to compile and create Windows executables and dlls.

I have tried to compile in Windows by running ./configure using mingw64 compiler but I got lot of errors like option -X not found for “/usr/bin/uname -X”.

I want to compile these open source software in opensuse. When I press something like X86 in terminal I am able to see file list containing X86_64mingw64_gcc etc.,.

You may tell that just run ./configure from the root of source code folder but I have posted this content because when I run ./configure it will consider gcc version of linux not gcc version of mingw64.

I think that software written using gcc is better to compile in Linux than Windows. I am trying to compile these software in Windows from the past two weeks but never succeeded.

Please suggest how to cross compile to Windows executable. When I run ./configure from terminal can you suggest how to consider gcc version of mingw64.

As a rule of thumb,
Compiling and packaging should be done on the system of your packaging target.

So, if you’re creating packages that will be installed on Windows, you should be packaging on Windows.
And, if you’re creating packages that will be installed on Linux, then you should be packaging on Linux.

If you’re packaging for Windows on a Linux box, then you should be running a Windows environment on Linux… but that involves some risk that the package won’t be built properly to run on Windows.

An alternative is to package for Linux, but then run in a Linux environment on Windows… like Cygwin.

Another alternative is to build your application on a cross-platform environment… Like Mono/.NET or Java.
Or, another popular alternative nowadays is to write your app in a cross-platform language… Practically all scripting languages are cross-platform, you have choices to run in a browser which typically supports the same on any OS(like Javascript) or a scripting language which might require some additional installation like Python and NoeJS.


If you don’t know how to configure to point to a speciic gcc,
You can create an update-alternatives to switch your entire system temporarily between different gcc.

I wrote the following which describes how to do this so you build will use the desired gcc

Since gcc is only used when actually building, it’s safe to do this as long as you switch back to the original gcc when you’re done with your special task.


If it is not feasible to create Windows executables in Linux then please suggest how to install and configure cygwin or mingw64+msys2 in Windows 8.

From the past two weeks I am trying to configure these but never succeeded.

I doubt these forums are the best place to ask something about Windows.

Many people here know not much about Windows at all (except when the newspapers talk about viruses again).

Ok sorry for that can you suggest how to cross compile to Windows executables

For ffmpeg see

It’s all in the configure options… if you are never sure, always check with;

./configure --help

try this
they have a 32 and 64bit builds of mingw and msys for windows
there is a windows crosscompiler for leap here
for making 64bit win binaries
for 32bit

but I think your best choice is using msys2 under windows

A link in Malcolm’s post suggests how to do what you want

Instructions at that link describe how to build on Linux, and should include openSUSE.
If you decide to run on Windows instead, then you will need to install Cygwin, ie

I haven’t installed Cygwin for a very long time, IIRC I was unhappy how much longer things took to run.


no need for cygwin unless you need some exotic features like running X on windows
msys2 is all you need
I recently installed it and used it to rebuild a few tools
just one thing msys2 is a minimal system and does not include gcc after installing msys2 you’d need to start the msys conslole update it and then pull mingw from it’s repo’s
to get 64bit mingw

pacman -Syuu
pacman -S mingw-w64-x86_64-toolchain

for 32 bit you’d need the i686 packages

pacman -Syuu
pacman -S mingw-w64-i686-toolchain

they’ve ported pacman from arch as a package manager
if you don’t want the latest mingw or are uncomfortable with pacman as a package manager you can get a mingw bundle from xhmikosr (one of the mpc-hc devs)
he’s got 2 builds of 2 gcc versions gcc 6.3 and 7.1