Page 1 of 1

Failed attempt at compiling with Visual Studio 2019

PostPosted: 06 Apr 2019, 02:00
by Danfun64
I recently did a fresh install of Windows 10. I found that Visual Studio 2019 had just been released, so I downloaded it instead of Visual Studio 2017. It appears to have been compiled in its entirety, but running it is another matter. Note that I'm using the latest windows_64bit dependencies.
Here's the compile log: http://paste.debian.net/1076393/

{l Code}: {l Select All Code}
---------------------------
SuperTuxKart crashed :/
---------------------------
SuperTuxKart crashed!
Please hit Ctrl+C to copy to clipboard and signal the problem
to the developers on our forum: http://forum.freegamedev.net/viewforum.php?f=16

Call stack:

 pngread.c:png_read_destroy:1092
 pngread.c:png_destroy_read_struct:973
 CImageLoaderPNG.cpp:irr::video::CImageLoaderPng::loadImage:249
 sp_texture.cpp:SP::SPTexture::getImageFromPath:137
 sp_texture.cpp:SP::SPTexture::getTextureImage:162
 sp_texture.cpp:SP::SPTexture::threadedLoad:456
 sp_texture_manager.cpp:<lambda_aa8069a420787a7c20c57f5569a1ece0>::operator():67
 thread:std::thread::_Invoke<std::tuple<<lambda_aa8069a420787a7c20c57f5569a1ece0> >,0>:39
 o_exp
 BaseThreadInitThunk
 RtlUserThreadStart
---------------------------
OK   
---------------------------

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 06 Apr 2019, 03:20
by benau
is it always reproducible?

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 06 Apr 2019, 18:25
by Danfun64
Yes it is. I get the error both when reopening the exe and when recompiling it.

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 06 Apr 2019, 18:37
by benau
possible to help debugging it?

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 06 Apr 2019, 22:37
by Danfun64
Unfortunately, I bumped into a weird problem. I get that crash message when I run a "Release" or "RelWithDebInfo" build, but "Debug" builds run correctly.

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 07 Apr 2019, 03:20
by Auria
Perhaps some compiler optimisation breaks the game... I do not have VS2019 at this time, but I would suggest trying to play with the optimisation level settings, disabling the riskier optimisations and keeping only the simplier optimisations.

Also, anything helpful in the logs? (they are in %appdata%\supertuxkart\config-0.10\stdout.log)

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 07 Apr 2019, 18:43
by Danfun64
The last shader Supertuxkart attempts to compile is "[info ] ShaderFilesManager: Compiling shader: C:/Users/Danfu/Documents/supertuxkart/stk-code/data/shaders/sp_normal_visualizer.frag"

Aside from that, there doesn't appear to be any useful info in the logs.

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 11 Apr 2019, 13:35
by deve
Does this patch work for you?

{l Code}: {l Select All Code}
diff --git a/lib/libpng/pngread.c b/lib/libpng/pngread.c
index b90e017e6..ca93ec870 100644
--- a/lib/libpng/pngread.c
+++ b/lib/libpng/pngread.c
@@ -1089,7 +1089,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
    free_fn = png_ptr->free_fn;
 #endif
 
-   png_memset(png_ptr, 0, png_sizeof(png_struct));
+   png_memset((png_voidp)png_ptr, 0, png_sizeof(png_struct));
 
    png_ptr->error_fn = error_fn;
 #ifdef PNG_WARNINGS_SUPPORTED

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 17 Apr 2019, 00:24
by Danfun64
Sorry for taking so long to respond. I can confirm that the problem has been fixed after the patch.

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 22 Apr 2019, 04:23
by Lyberta
Dunno how VS handle things, but this would be UB if compiled in C++ mode. memset is almost never legal in C++, in fact, I don't know when it is legal in C++.

Re: Failed attempt at compiling with Visual Studio 2019

PostPosted: 22 Apr 2019, 17:23
by deve
Illegal memset :-D