ScanTailor-Advanced / scantailor-advanced

ScanTailor Advanced is the version that merges the features of the ScanTailor Featured and ScanTailor Enhanced versions, brings new ones and fixes.
GNU General Public License v3.0
204 stars 8 forks source link

Suitable VC runtime #16

Closed beremour closed 2 years ago

beremour commented 2 years ago

Running binary on Windows 10 x64 gives: "ucrtbased.dll and vcruntime140d.dll not found. Where to get suitable runtime ? Latest "Visual Studio 2015, 2017, 2019 и 2022" from https://aka.ms/vs/17/release/vc_redist.x64.exe dosen't contain these DLLs.

vigri commented 2 years ago

Hi @beremour, sorry for the delay. ucrtbased.dll seems to be part of Win 10 SDK. vcruntime140d should be part of the runtime (https://aka.ms/vs/17/release/vc_redist.x64.exe).

I don't know if it's best practise to include those files in the release, but anyway check this out please and tell me if it works: ScanTailor-Advanced-1.0.18_II.x64.zip

JonasTrenkler commented 2 years ago

Hi @vigri, thank you for so much for forking, building and providing a space for further development!

I ran into the same issue and gave it a try on two Win 10 machines. The version you provided here that contains the dlls works on the second one of them, but not on the other.

The first machine is only missing the ucrtbased.dll. I reinstalled the most recent runtime you also linked above. The test version you provided here did not start either, same error. I noticed that Windows complains about ucrtbased.dll (debug?) not ucrtbase.dll, as it is found in the windows system folder (as it apparently should be) and included in the test version. Based on this: (https://social.msdn.microsoft.com/Forums/en-US/b621d064-0797-41ac-84db-aac491283995/ucrtbaseddll-is-missing) I installed the Windows 10 SDK. The portable v1.0.18, without the dlls included, now starts on this machine.

The second pc can't find VCRUNTIME140D.dll. I made sure the most recent runtime is installed. I reinstalled it (and rebooted ofc), but the error still persists. The version that includes the dlls, starts just fine though. This machine had various tools to build vc installed in the past. I uninstalled them a while ago to make some space. Maybe some files persisted over here.

I hope this will help to narrow down the issue, if it comes up for other users. Let me know if I can help investigate further. Having to install the Windows 10 SDK should probably not be required to run the Software, as it is rather large (2 GB). I suspect a lot of the people that end up trying your fork already have it installed for building purposes.

Thanks again for putting in the time. I really appreciate that.

beremour commented 2 years ago

Hi @vigri ! Thank you very much for you efforts! Version you've provided has "ucrtbase.dll" , not "ucrtbased.dll" - "d" is missing.

trufanov-nok commented 2 years ago

"ucrtbased.dll" - "d" is missing.

"d" stands for debug. These are debug versions of ucrtbase.dll and vcruntime140.dll which means executable was built in VS in Debug mode instead of Release mode.

beremour commented 2 years ago

@trufanov-nok thank you for clarification ! So we should ask @vigri to kindly build binaries with production DLLs and include them into release.

vigri commented 2 years ago

@beremour I'll try to help as good as I can but C++ is really not my main language :)

I'm a little bit surprised, becaused I've not build any debug release. I've followed the instruction provided here: https://github.com/vigri/scantailor-libs-build#build-instructions-for-qt-6

And this is what I ended up with (Win10, VS2022):

#x64 native tools command prompt for VS 2022

cmake -GNinja -S "%ZLIB_SRC_DIR%" -B "%SCANTAILOR_LIB_TEMP%\build_zlib_release" -D CMAKE_INSTALL_PREFIX="%SCANTAILOR_LIB_COMPILED%"
cmake --build "%SCANTAILOR_LIB_TEMP%\build_zlib_release" --config Release
cmake --install "%SCANTAILOR_LIB_TEMP%\build_zlib_release"

cmake -GNinja -S "%LIBPNG_SRC_DIR%" -B "%SCANTAILOR_LIB_TEMP%\build_libpng_release" -D CMAKE_PREFIX_PATH="%SCANTAILOR_LIB_COMPILED%" 
cmake --build "%SCANTAILOR_LIB_TEMP%\build_libpng_release" --config Release
cmake --install "%SCANTAILOR_LIB_TEMP%\build_libpng_release" --prefix "%SCANTAILOR_LIB_COMPILED%"

cmake -GNinja -S "%LIBTIFF_SRC_DIR%" -B "%SCANTAILOR_LIB_TEMP%\build_libtiff_release" -D CMAKE_PREFIX_PATH="%SCANTAILOR_LIB_COMPILED%"  -D CMAKE_INSTALL_PREFIX="%SCANTAILOR_LIB_COMPILED%"
cmake --build "%SCANTAILOR_LIB_TEMP%\build_libtiff_release" --config Release
cmake --install "%SCANTAILOR_LIB_TEMP%\build_libtiff_release" 

cmake -GNinja -S "%LIBJPEG_SRC_DIR%" -B "%SCANTAILOR_LIB_TEMP%\build_libjpeg_release" -D CMAKE_PREFIX_PATH="%SCANTAILOR_LIB_COMPILED%"
cmake --build "%SCANTAILOR_LIB_TEMP%\build_libjpeg_release" --config Release
cmake --install "%SCANTAILOR_LIB_TEMP%\build_libjpeg_release" --prefix="%SCANTAILOR_LIB_COMPILED%"

cmake -GNinja -S "%SCANTAILOR_SOURCE_DIR%" -B "%SCANTAILOR_LIB_TEMP%\build_scantailor-advanced_release" -DCMAKE_PREFIX_PATH="%QT_DIR%";"%BOOST_SRC_DIR%";"%SCANTAILOR_LIB_COMPILED%" -DCMAKE_BUILD_TYPE=Release
cmake --build "%SCANTAILOR_LIB_TEMP%\build_scantailor-advanced_release"
cmake --install "%SCANTAILOR_LIB_TEMP%\build_scantailor-advanced_release" --prefix "%SCANTAILOR_INSTALL_DIR%"

Maybe @kunzjacq has a clue, since he wrote these "new" steps.

Best regards

trufanov-nok commented 2 years ago

As far as I can tell from binaries by their dependencies - the Qt dlls and scantailor.exe are Release builds. But all dependency libs: tiff, jpeg, zlib, png - are Debug builds.

kunzjacq commented 2 years ago

Regarding the build of libraries in Debug configuration: indeed, build instructions are incorrect, I created a pull request to fix this. Release configuration should be requested at configure stage with "-D CMAKE_BUILD_TYPE=Release", not at build stage with "--config Release" (this should work with newer CMakefiles and I thought I had properly tested it, but apparently this was not the case).

Regarding the missing system libraries: in my case, ucrtbase.dll (not the debug version) is properly added at install stage by windeployqt which is the Qt tool that manages dependencies; vcruntime140.dll is not added but is present in %WINDIR%\system32. For reference, I use Visual Studio 2022 Community Edition with Windows 11.

vigri commented 2 years ago

Hello guys,

with the help of the PR from @kunzjacq I created a new build.

Please check if this will work: ScanTailor-Advanced-1.0.18_III [x64].zip

The build process copies much more dlls. However, I am not sure if those really need to be in the final ST folder. Just for reference, the included .dlls are marked.

image

JonasTrenkler commented 2 years ago

It's working on my end. I tried to launch it on two different machines, without Windows 10 SDK installation.

beremour commented 2 years ago

@vigri Thank you very much! App started.

vigri commented 2 years ago

The new compiled version is now under releases available.