Closed flossy83 closed 8 months ago
Oh I tried putting #include <memory>
in info.h and info.cpp like the compiler error suggested and it works now, I get a TIVTC.dll file.
But, Avisynth doesn't see it:
edit: I tried LoadPlugin() and LoadCPlugin(), no effect.
I guess it must have built wrongly - here is the built file.
It looks like the first make command autodetected my CPU as AMD - "-- Detected target processor as: AMD64". Is that correct? My CPU is Intel i5-4570. Are there some makefile switches I can set to tell it to try building a different version?
Here is the successful second build output:
# cmake --build . --config Release
[ 2%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/TCommonASM.cpp.obj
[ 5%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/fixedfonts.cpp.obj
[ 7%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/info.cpp.obj
In file included from C:\TIVTC-master\src\common\info.cpp:27:
C:/TIVTC-master/src/include/avs/win.h:44: warning: "STRICT" redefined
44 | #define STRICT
|
In file included from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from C:\TIVTC-master\src\common\internal.h:12,
from C:\TIVTC-master\src\common\info.h:30,
from C:\TIVTC-master\src\common\info.cpp:23:
C:/msys64/mingw64/include/minwindef.h:11: note: this is the location of the previous definition
11 | #define STRICT 1
|
[ 10%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/__/common/internal.cpp.obj
[ 12%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/Cache.cpp.obj
[ 15%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/Cycle.cpp.obj
[ 17%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/FieldDiff.cpp.obj
[ 20%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/FrameDiff.cpp.obj
[ 22%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/IsCombedTIVTC.cpp.obj
[ 25%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/MergeHints.cpp.obj
[ 27%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/PlanarFrame.cpp.obj
[ 30%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/PluginInit.cpp.obj
[ 32%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/RequestLinear.cpp.obj
[ 35%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TDecimate.cpp.obj
[ 37%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TDecimateASM.cpp.obj
[ 40%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TDecimateBlur.cpp.obj
[ 42%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TDecimateMode2.cpp.obj
[ 45%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TDecimateMode7.cpp.obj
[ 47%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TDecimateOut.cpp.obj
[ 50%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TFM.cpp.obj
[ 52%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TFMASM.cpp.obj
[ 55%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TFMD2V.cpp.obj
[ 57%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TFMPP.cpp.obj
[ 60%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TFMPlanar.cpp.obj
[ 62%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/TFMYUY2.cpp.obj
[ 65%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/calcCRC.cpp.obj
[ 67%] Building CXX object TIVTC/CMakeFiles/TIVTC.dir/profUtil.cpp.obj
[ 70%] Linking CXX shared library TIVTC.dll
[ 70%] Built target TIVTC
[ 72%] Building CXX object TDeint/CMakeFiles/TDeint.dir/__/common/TCommonASM.cpp.obj
[ 75%] Building CXX object TDeint/CMakeFiles/TDeint.dir/__/common/fixedfonts.cpp.obj
[ 77%] Building CXX object TDeint/CMakeFiles/TDeint.dir/__/common/info.cpp.obj
In file included from C:\TIVTC-master\src\common\info.cpp:27:
C:/TIVTC-master/src/include/avs/win.h:44: warning: "STRICT" redefined
44 | #define STRICT
|
In file included from C:/msys64/mingw64/include/windef.h:9,
from C:/msys64/mingw64/include/windows.h:69,
from C:\TIVTC-master\src\common\internal.h:12,
from C:\TIVTC-master\src\common\info.h:30,
from C:\TIVTC-master\src\common\info.cpp:23:
C:/msys64/mingw64/include/minwindef.h:11: note: this is the location of the previous definition
11 | #define STRICT 1
|
[ 80%] Building CXX object TDeint/CMakeFiles/TDeint.dir/__/common/internal.cpp.obj
[ 82%] Building CXX object TDeint/CMakeFiles/TDeint.dir/TDBuf.cpp.obj
[ 85%] Building CXX object TDeint/CMakeFiles/TDeint.dir/TDeintASM.cpp.obj
[ 87%] Building CXX object TDeint/CMakeFiles/TDeint.dir/TDeinterlace.cpp.obj
[ 90%] Building CXX object TDeint/CMakeFiles/TDeint.dir/TDeinterlacePlanar.cpp.obj
[ 92%] Building CXX object TDeint/CMakeFiles/TDeint.dir/TDeinterlaceYUY2.cpp.obj
[ 95%] Building CXX object TDeint/CMakeFiles/TDeint.dir/THelper.cpp.obj
[ 97%] Building CXX object TDeint/CMakeFiles/TDeint.dir/TSwitch.cpp.obj
[100%] Linking CXX shared library TDeint.dll
[100%] Built target TDeint
If I move the TIVTC.dll to another location, eg. C:\ and do a LoadPlugin("C:\TIVTC.dll") then I get a meaningful error message code 126:
I don't know why it shows it as forward slash, it's definitely a backslash in my script
Seems to be missing some libgcc dependencies...
I think I need to tell GCC to include those dependencies in the compilation, but I don't know how
According to a StackOverflow post I need to compile with flags: -static-libstdc++ -static-libgcc
But I'm not sure how to do that -- do I need to modify the makefiles?
Tried putting set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
inside all CMakeLists.txt files to no effect
Are you using mingw built Avisynth+? Mingw and Windows-style DLLs are not ABI compatible. Plugin using C interface has no problems, but they are very rare. The real expert of MSys2/Mingw64 is @qyot27, I'd ask him.
Are you using mingw built Avisynth+?
I'm using the current latest public release from the GitHub repository, so I guess that means no.
I managed to include all those GCC dependencies in TIVTC.dll by putting set(CMAKE_CXX_FLAGS "-static")
inside all CMakeLists.txt files - in this case Avisynth Info Tool reports no problems with the .dll but I still get the "no function named TDecimate" when trying to call TDecimate().
But LoadPlugin("C:\TIVTC.dll") doesn't throw an error anymore, and the TIVTC.dll is bigger so I know it included those GCC dependencies.
So I guess the GCC builds just aren't compatible with the public release build of Avisynth, so I probably have to use Visual Studio to compile it instead, have I got that right? How are you compiling it?
Yes, mingw built C++ plugins are compatible only with mingw build Avisynth+. (following the README.md build instructions I've encountered the missing header, so I fixed it). As for Visual Studio: open the solution file (.sln) in the IDE and build the project. I usually do this.
(As for mingw built DLL / Load error 126: The missing DLLs (standard c++ library, posix threads, library (but I don't think TIVTC is using that) are somewhere in your gcc directory. The command ldd <your_dll_name>
can list the dependencies if they are not statically linked (as you finally did).
It looks like the first make command autodetected my CPU as AMD - "-- Detected target processor as: AMD64". Is that correct? My CPU is Intel i5-4570. Are there some makefile switches I can set to tell it to try building a different version?
Using VS through the command-line CMake interface can be done by first launching the Visual Studio Command Prompt and specifying "Visual Studio XX 20YY" as the generator, where the XX and YY refer to whatever version of VS is being used (16 2019, for example).
Overriding/appending CMAKE_CXX_FLAGS or CMAKE_SHARED_LINKER_FLAGS doesn't usually involve needing to edit CMakeLists.txt, as virtually every sort of thing you can set()
inside of them can also be passed to the CLI at configure time, e.g. -DCMAKE_CXX_FLAGS="-static"
or -DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc"
.
But yes, as stated, GCC and MSVC use incompatible C++ ABIs and you can't mix and match host and plugins across compilers. And by default, GCC-built AviSynth+ actually looks in a completely different set of directories for plugins (plugins_gcc and plugins64_gcc), so as not to cause load errors.
Thanks, a bit disappointing as I was trying to avoid using the Visual Studio GUI . I tried the 2019 Community version and it's ok but it only lets me compile the CLang version due to missing compilation tools. Guess I need the 2022 version?
The solution and project files are set to v143 platform toolset, this is what vs2022 uses. For vs2019 go into config and change that to v142 toolset, that must be fine.
I'm trying to make a small tweak/fix to TDecimate's hybrid=3 mode (details here) and have managed to set up the whole MSys2/Mingw64 environment just now for the first time.
The first of the two build commands seems ok:
But the second command fails:
The only thing that stands out to me is the last 3 lines "mingw32-make" - shouldn't that be mingw64?
Here are my installed MinGW packages btw:
Any help appreciated