-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross compilation in mingw #363
Comments
Why are you disabling everything? But even beyond that, have you tried using the master branch? |
I decided to disable everything first to minimize the risk of errors. With the default options there is the same error. I'm using the master branch, I forgot to do a git checkout on release. |
I can't reproduce it here, even when disabling INTEL_SIMD and using CMAKE_BUILD_TYPE=Release. I vaguely remember an error with mmintrin from quite a while back, and I think it was actually a problem in MinGW-w64 that was fixed with one of their updates. The mmintrin intrinsics (which should have been disabled when disabling Intel SIMD) are provided inside of the compiler headers from MinGW-w64 or GCC. My cross toolchain is MinGW-w64 v10.0.0, multilib GCC 13.1.0. It would appear that Mageia is still on MinGW-w64 version 8. cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32 \
CMake toolchain file:
What exactly is the end goal, though? Building AviSynth+ to use it on Windows, or simply to enable support for it in a cross-compiled build of FFmpeg? |
I was able to compile in Debian 12 after I removed the packages Do I understand correctly that all plugins must also be compiled with mingw? I tried to use the ffms2 input plugin (which is built in msvc) and output in VirtualDub (wine), but got an error: No, I don't need the headers and ffmpeg.exe. I am interested in an exotic compilation of avisynth in mingw as an experiment. Few people do that. And because I don't have the space to install Visual Studio. |
Well, trying to open the avs script in ffmpeg.exe in wine I saw an error that libgcc_s_dw2-1.dll, libstdc++-6.dll and libwinpthread-1.dll are missing. I copied them from the debian mingw installation (without strip), the right posix version and i686 architecture, and put them in C:\windows (wine installation). |
Not all plugins have to be recompiled in that case. Only C++ plugins...which is the vast majority of them. C plugins will work fine. But standard i686 FFmpeg builds cannot use i686 MinGW builds of AviSynth+ because of win32 calling convention issues. It requires a separate build of FFmpeg that was built with |
Does this mean that AVISource (in VirtualDub) and MPC-HC (AVISource/directshowsource) will not work either? Despite the big difficulties I could not compile the ffms2 plugin. undefined reference. I must be confuse win32 and posix again in some dependency (ffms2 also needs win zlib). This made me tired. |
AVISource works fine (although getting VfW codecs configured under Wine is sometimes a challenge), DirectShowSource doesn't build with GCC so that's moot. VirtualDub and MPC-HC are not going to work with a 32-bit MinGW build of AviSynth+, because of the calling convention issue I mentioned earlier. Anything that assumes a normal MSVC build of 32-bit AviSynth won't work with 32-bit MinGW builds, and vice-versa. There's some issues when using ffms2's autotools system for cross-compiling. I normally use the C plugin's custom build system (https://github.com/qyot27/ffms2/ = 'cplugin_master' or 'patches' branch) for that; I hooked it up to allow building the C++ plugin several years ago. (assuming the FFmpeg that you're linking to FFMS2 is installed in $HOME/mpv-build-deps/ffmpeg_build_for_ffms2/i686)
Largely, MinGW-w64/GCC builds of AviSynth+ are best considered experimental, whether you're talking about 32-bit or 64-bit (but the 64-bit ones are more useful since you can use normal FFmpeg, VirtualDub, etc.). It was an important step to being able to build natively for *nix, but because on Windows there's so much historical inertia toward MSVC it's way more niche to use MinGW builds. |
Thank you for this helpful information. I understand that mingw compilation became possible after porting to Unix. |
The other way around: MinGW/GCC was added in 2016, native Linux/macOS/BSD support in 2020 (Haiku in 2021).
The |
I compiled ffms2 and also checked yours, everything works. I had to install the libz-mingw-w64-dev package and then copy zlib1.dll. You can apply i686-w64-mingw32-strip --strip-unneeded to reduce the size, I haven't done that yet. And the original installer must be installed first, of course. Maybe someone would like to develop the mingw branch (plugins). |
I was able to compile yadifmod2, but not TIVTC. |
I checked TIVTC readme.MD and it seems that I succeeded in compiling it (I don't remember exactly, but I usually try it before putting it into documentation) |
@pinterf You checked in Mingw running in Windows (-G "MinGW Makefiles" indicates this, as well as Msys). |
I managed to cross compile TIVTC 1.0.27 5fcdade5107e51e255fe3919a6a0361c29176d26 (posix threads) after the following edits:
|
Thanks, I'm going to integrate your findings |
Windows.h appears with capital W in my Window system in the original filename. Is yours really with small w letter? |
@pinterf |
@qyot27 |
Ubuntu, but I haven't used their cross toolchain in well over 10 years, if I ever did. I just build it myself so I can ensure the cross environment and FFmpeg/mpv dependency chain is as fully static as possible/feasible. And yes, I think it was MinGW-w64 7 or 8 that introduced the Secure API or made it default, and if the Secure API is enabled, the builds will not work on XP. Further, if you plan on building FFmpeg, which for a couple years now has required one or more of the functions from the Secure API and/or Vista+ cryptographic libraries, you have to really dig deep to revert changes to keep XP support in FFmpeg around and justify keeping MinGW's Secure API functionality disabled. At some point - if not already - it'll be easier to just tell people to go use ReactOS if they want an XP-ish desktop experience but not be bound by the incompatibility issues. |
Hello.
I am trying to cross compile avisynth with mingw in linux (mageia 8) for windows, but I get an error:
cmake .. -DBUILD_COFFVERTSTACKED:BOOL=OFF -DBUILD_DIRECTSHOWSOURCE:BOOL=OFF -DBUILD_IMAGESEQ:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_SHIBATCH:BOOL=OFF -DBUILD_TIMESTRETCH:BOOL=OFF -DBUILD_VDUBFILTER:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DENABLE_CUDA:BOOL=OFF -DENABLE_INTEL_SIMD:BOOL=OFF -DENABLE_PLUGINS:BOOL=OFF -DHEADERS_OFFLY:BOOL=OFF -DCMAKE_TOOLCHAIN_FILE=/home/denis/mingw.cmake
make
17% MTGuard error
mmintrin.h error: inlining failed in call to 'always_inline' 'void _mm_empty()': target specific option mismatch
Is this way of compiling not supported?
mingw.cmake:
The text was updated successfully, but these errors were encountered: