mltframework / shotcut

cross-platform (Qt), open-source (GPLv3) video editor
https://www.shotcut.org
GNU General Public License v3.0
10.84k stars 1.12k forks source link

Input not Loaded in Compiled Shortcut Application #1534

Closed thiru31 closed 5 months ago

thiru31 commented 5 months ago

Description: I have encountered an issue while compiling and building the Shortcut application on Windows. Despite successful compilation and build of the shortcut.exe file, the input is not loaded inside the Shortcut application. Upon reviewing the application logs, I noticed that the logs from the application I built and the logs from the portable version of the Shortcut application match exactly. However, the logs from my built application contain a few extra lines compared to the portable version.

[Info   ] <Util::isMemoryLow> available RAM =  4152780 KB
[Info   ] <Util::isMemoryLow> available RAM =  4041368 KB
[Debug  ] <MainWindow::closeEvent> begin
[Debug  ] <MainWindow::closeEvent> end

Expected Behavior: The compiled Shortcut application should load the input as expected.

Actual Behavior:

actual behaviour

Environment:

Logs of Application:

compiled version.txt working-portable version.txt

Could you please provide comprehensive instructions on how to:

Having clear documentation will greatly help me and other Windows users to contribute to the project and utilize its features effectively.

Thanks in advance for your assistance!

ddennedy commented 5 months ago

This is not a bug, and the template states this area is only for bugs. We provide a SDK with some instructions. Also, our GitHub Actions workflow provides precise step-by-step directions. Of course, that also involves a lengthy and complicate build script. Otherwise, it should be fairly easy as Shotcut only directly depends on Qt, MLT, and fftw. Most likely there is a problem with your MLT or FFmpeg. Your log makes it very clear:

[Warning] <MLT> mlt_repository_init: failed to dlopen C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt/libmltfrei0r.dll  ("C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt\libmltfrei0r.dll": The specified procedure could not be found.)
[Warning] <MLT> mlt_repository_init: failed to dlopen C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt/libmltopencv.dll  ("C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt\libmltopencv.dll": The specified module could not be found.)
[Warning] <MLT> mlt_repository_init: failed to dlopen C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt/libmltplus.dll  ("C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt\libmltplus.dll": The specified procedure could not be found.)
[Warning] <MLT> mlt_repository_init: failed to dlopen C:\msys64\home\mcw\shotcut\src\shotcut\build\lib\mlt/libmlt

I think the problem is that you are applying a *nix-like approach to your build of a Windows relocatable application. Our Windows build needs to target a classical Windows-style relocatable app. Relocatable means dependencies are resolved relative to the executable, and in Windows apps it is preferable to have DLLs in the same dir as the .exe. Our build script has to "deploy" the application. For Windows development, even I use the SDK! I am the primary user of the SDK. In the SDK instructions you can see that it does a "make install" or "ninja install" step to copy the exe and QML files to the staged directory. Then, you run the installed shotcut.exe. But I can see in your log that you are trying to run the uninstalled shotcut.exe: [Info ] <qMain> install dir = "C:/msys64/home/username/shotcut/src/shotcut/build/src"

Shotcut is not a simple project. It is not a standalone exe. Things need to be in expected locations for things to work in a non-simple project like this.

ddennedy commented 5 months ago

If you want documentation for a different approach than what we offer, then you need to figure them out and document it. It is not our responsibility to make build docs for you preferred method. What I have provided is what I use.

thiru31 commented 5 months ago

I followed the SDK method outlined in this guide for building Shotcut. However, during the build process, everything was successful except for the generation of the shotcut.exe file. The build process stopped with the error message: ninja: build stopped: subcommand failed.

`FAILED: src/shotcut.exe 
cmd.exe /C "cd . && C:\Qt\Tools\mingw1120_64\bin\g++.exe -DQT_QML_DEBUG -g -mwindows @CMakeFiles\shotcut.rsp -o src\shotcut.exe -Wl,--out-implib,src\libshotcut.dll.a -Wl,--major-image-version,0,--minor-image-version,0  && cd ."
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/shotcut.dir/spatialmedia/box.cpp.obj: in function `Box::load(std::basic_fstream<char, std::char_traits<char> >&, unsigned int, unsigned int)':
C:/Projects/Shotcut/src/shotcut/src/spatialmedia/box.cpp:191: undefined reference to `std::istream::seekg(std::fpos<_Mbstatet>)'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/shotcut.dir/spatialmedia/box.cpp.obj: in function `Box::save(std::basic_fstream<char, std::char_traits<char> >&, std::basic_fstream<char, std::char_traits<char> >&, int)':
C:/Projects/Shotcut/src/shotcut/src/spatialmedia/box.cpp:254: undefined reference to `std::istream::seekg(std::fpos<_Mbstatet>)'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/shotcut.dir/spatialmedia/box.cpp.obj: in function `Box::index_copy(std::basic_fstream<char, std::char_traits<char> >&, std::basic_fstream<char, std::char_traits<char> >&, Box*, bool, int)':
C:/Projects/Shotcut/src/shotcut/src/spatialmedia/box.cpp:309: undefined reference to `std::istream::seekg(std::fpos<_Mbstatet>)'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/shotcut.dir/spatialmedia/container.cpp.obj: in function `Container::load(std::basic_fstream<char, std::char_traits<char> >&, unsigned int, unsigned int)':
C:/Projects/Shotcut/src/shotcut/src/spatialmedia/container.cpp:45: undefined reference to `std::istream::seekg(std::fpos<_Mbstatet>)'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Projects/Shotcut/src/shotcut/src/spatialmedia/container.cpp:95: undefined reference to `std::istream::seekg(std::fpos<_Mbstatet>)'
C:/Qt/Tools/mingw1120_64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/shotcut.dir/spatialmedia/container.cpp.obj:C:/Projects/Shotcut/src/shotcut/src/spatialmedia/container.cpp:98: more undefined references to `std::istream::seekg(std::fpos<_Mbstatet>)' follow
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
17:25:52: The process "C:\Qt\Tools\CMake_64\bin\cmake.exe" exited with code 1.
Error while building/deploying project shotcut (kit: Desktop Qt 6.7.0 MinGW 64-bit)
When executing step "Build"`

I would appreciate any guidance or assistance in troubleshooting this issue and successfully generating the shotcut.exe file.

ddennedy commented 5 months ago

I configured Qt Creator to use the gcc in msys2 since that is what is used for building the SDK

image

If you change the compiler in the Kit the project is already configured, you should clean or rebuild.

Your error seems to occur because libstdc++ is not included when linking since "undefined reference" is an under-linking error (missing lib), and std:: is libstdc++ for g++. However, when I look in my CMake-generated CMakeFiles\shotcut.rsp file in my build directory, I do not see an explicit c++ library. ...-ld3d11 -ld3dcompiler -lexchndl C:/Projects/Shotcut/lib/libmlt++-7.dll.a C:/Projects/Shotcut/lib/libmlt-7.dll.a C:/Projects/Shotcut/lib/libfftw3.dll.a C:/Qt/6.4.3/mingw_64/lib/libQt6OpenGLWidgets.a C:/Qt/6.4.3/mingw_64/lib/libQt6Widgets.a C:/Qt/6.4.3/mingw_64/lib/libQt6Quick.a C:/Qt/6.4.3/mingw_64/lib/libQt6OpenGL.a C:/Qt/6.4.3/mingw_64/lib/libQt6Gui.a -ld3d11 -ldxgi -ldxguid -luser32 C:/Qt/6.4.3/mingw_64/lib/libQt6QmlModels.a C:/Qt/6.4.3/mingw_64/lib/libQt6Qml.a C:/Qt/6.4.3/mingw_64/lib/libQt6Network.a -lws2_32 C:/Qt/6.4.3/mingw_64/lib/libQt6Core.a -lmpr -luserenv -lmingw32 C:/Qt/6.4.3/mingw_64/lib/libQt6EntryPoint.a -lshell32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

I am reading an old comment from gcc mailing list that suggests this problem can come from some glibc version mismatch. C:/Projects/Shotcut/lib/libmlt++-7.dll.a is compiled using msys2's g++ and glibc, and maybe that pulls in the libstc++ version that is incompatible with the Qt Creator's MinGW g++.

ddennedy commented 5 months ago

I created a project configuration similar to yours (Qt Creator MinGW 11.2 C++ compiler) plus my SDK directions, and it compiled and linked without a problem. I do not know exactly the cause of your problem.

thiru31 commented 5 months ago

Following your instructions proceeded [configured Qt Creator to use msys2 ] and landed up in successful compiling and building.

but unable to run the shotcut.exe Tried moving the dll files also to the same directory as of shotcut.exe but still the same Error

image

ddennedy commented 5 months ago

That might be because you downloaded and used the wrong version of Qt SDK. MLT and our SDK are built against 6.5.3, which might no longer be available in their installer. Our build workflow has a step to download that version of Qt from an archive in our S3 bucket.

ddennedy commented 5 months ago

If the SDK installer longer includes 6.5, I added a link to download 6.5.3 on our SDK page. (I will try to upgrade to 6.7 for the next version.)

thiru31 commented 5 months ago

Thanks for your guidance. Now I built shortcut successfully using the workflow scripts, and will try with qt creator too.

Edit: Works with QT creator too, Thanks