Page 1 of 1

Cross-Compile STK on Linux with MinGW | Issue

PostPosted: 12 May 2019, 08:57
by PT400C
Hello,

when trying to compile STK with MinGW on Debian9 for Windows-64, I encounter lots of errors within the Irrlicht lib.

Example 1:
{l Code}: {l Select All Code}
lib/irrlicht/CMakeFiles/stkirrlicht.dir/build.make:138: recipe for target 'lib/irrlicht/CMakeFiles/stkirrlicht.dir/source/Irrlicht/CBoneSceneNode.cpp.obj' failed
make[2]: *** [lib/irrlicht/CMakeFiles/stkirrlicht.dir/source/Irrlicht/CBoneSceneNode.cpp.obj] Error 1
In file included from /usr/supertux/stk-code/lib/irrlicht/source/Irrlicht/CAttributes.cpp:6:0:
/usr/supertux/stk-code/lib/irrlicht/source/Irrlicht/CAttributeImpl.h: In member function ‘virtual irr::core::stringw irr::io::CUserPointerAttribute::getStringW()’:
/usr/supertux/stk-code/lib/irrlicht/source/Irrlicht/CAttributeImpl.h:2022:33: error: ‘_snwprintf’ was not declared in this scope
   swprintf(buf, 32, L"%p", Value);


Example 2:
{l Code}: {l Select All Code}
lib/irrlicht/CMakeFiles/stkirrlicht.dir/build.make:113: recipe for target 'lib/irrlicht/CMakeFiles/stkirrlicht.dir/source/Irrlicht/CBillboardSceneNode.cpp.obj' failed
make[2]: *** [lib/irrlicht/CMakeFiles/stkirrlicht.dir/source/Irrlicht/CBillboardSceneNode.cpp.obj] Error 1
In file included from /usr/supertux/stk-code/lib/irrlicht/include/matrix4.h:14:0,
                 from /usr/supertux/stk-code/lib/irrlicht/include/IAttributes.h:18,
                 from /usr/supertux/stk-code/lib/irrlicht/source/Irrlicht/CAttributes.h:8,
                 from /usr/supertux/stk-code/lib/irrlicht/source/Irrlicht/CAttributes.cpp:5:
/usr/supertux/stk-code/lib/irrlicht/include/irrString.h: In instantiation of ‘irr::core::string<T, TAlloc>::string(double) [with T = wchar_t; TAlloc = irr::core::irrAllocator<wchar_t>]’:
/usr/supertux/stk-code/lib/irrlicht/source/Irrlicht/CAttributeImpl.h:171:37:   required from here
/usr/supertux/stk-code/lib/irrlicht/include/irrString.h:109:11: error: ‘_snprintf’ was not declared in this scope
   snprintf(tmpbuf, 255, "%0.6f", number);


Any idea what could be wrong with these parts of irrlicht? And what did I do wrong?

Thanks in advance

PT400C

Re: Cross-Compile STK on Linux with MinGW | Issue

PostPosted: 13 May 2019, 22:59
by Auria
We do not officially support cross-compiling so I'm afraid you're going off the beaten path here and we won't be able to provide much help, unfortunatley

Re: Cross-Compile STK on Linux with MinGW | Issue

PostPosted: 14 May 2019, 12:54
by deve
Assuming that you have g++-mingw-w64 and gcc-mingw-w64 installed, and you have "dependencies" directory (the same as for normal mingw compilation on windows) you can just use:
{l Code}: {l Select All Code}
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw-64bit.cmake
make

I was doing it multiple times on ubuntu and I think that it should work on debian in the same way. I can check on debian buster later.

The only thing is that on some mingw versions 32bit complation fails when building angelscript, so maybe better use 64bit version.

Re: Cross-Compile STK on Linux with MinGW | Issue

PostPosted: 14 May 2019, 22:25
by deve
I just checked and 64-bit compilation works without issues on debian buster using mingw from repositories.

For 32-bit compilation it still needs this patch:
https://github.com/supertuxkart/stk-cod ... a0d03fb7e4