Several compile Issues on Windows 10, VC2015 64Bit

Use this forum to report bugs or ask for help

Moderator: kilo

Several compile Issues on Windows 10, VC2015 64Bit

Postby anet » Thu May 04, 2017 8:29 pm

Hello,

I tried to compile SpeedDreams on Windows 10 with Visual Studio 2015 64bit compiler and had some issues. I was able to solve all these issues, but I want to share the solutions and workarounds to all other interested users.

All notes are related to the tagged version 2.2.1-r6507

3rd Party compile issues
============================

First I want to emphasize, that the autonomic 3rd Party compile scripts are fantastic. I would gave up compiling a game with so much dependencies, when I were forced to compile all those libraries by myself.
However there were some issues I noticed.

1.) Install issues with the DirectX SDK

When installing the DirectX SDK the an error with the code "S1023" can happen. According to the Mircosoft support page https://support.microsoft.com/en-us/hel ... -june-2010 this error comes from compatibility issues with the Visual Studio 2010 C++ Redistributables.
You have to remove them from your system to install the SDK. This can be done with the GUI (Settings/Applications) or by command line (as administrator):
Code: Select all
MsiExec.exe /passive /X{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}

MsiExec.exe /passive /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}


2.) The Build type is not passed to the cmake sub-projects

Unfortunately all sub-projects (dependencies) are build in "Debug" configuration. This is because the build type is not correctly passed to them. To be able to build them in release configuration you first need to change the file "<repository-root>\packaging\3rdParty-devel\CMakeLists.txt" line 62 from:
Code: Select all
set(EXTERNALS_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALS_INSTALL_DIR} CACHE PATH "")

to
Code: Select all
set(EXTERNALS_CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNALS_INSTALL_DIR} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})


And then of course you need to set CMAKE_BUILD_TYPE accordantly.
Maybe the same issue appears, when the externals are build from the main project and not from the project in the directory "<repository-root>\packaging\3rdParty-devel\". So maybe the same change must be applied to the main CMakeLists.txt, I have not checked so far.

3.) When DirectX SDK is installed, SDL build fails for x64

The error looks like this:
[100%] Linking C shared library SDL.dll
Bibliothek "SDL.lib" und Objekt "SDL.exp" werden erstellt.
SDL_dx5events.c.obj : error LNK2001: unresolved external symbol "GUID_SysMouse".
SDL_dx5events.c.obj : error LNK2001: unresolved external symbol "GUID_SysKeyboard".
SDL_dx5events.c.obj : error LNK2001: unresolved external symbol "IID_IDirectInputDevice2A".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_XAxis".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_YAxis".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_ZAxis".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_RxAxis".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_RyAxis".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_RzAxis".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_Slider".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_Key".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "GUID_POV".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "IID_IDirectDraw2".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "IID_IDirectDrawSurface3".
SDL_dx5yuv.c.obj : error LNK2001: unresolved external symbol "IID_IDirectDrawSurface3".
SDL_dx5video.c.obj : error LNK2001: unresolved external symbol "IID_IDirectDrawGammaControl".
C:\PROGRA~2\MI5E29~1\\lib\x86\dxguid.lib : warning LNK4272:Bibliothekcomputertyp "X86" steht in Konflikt mit dem Zielcomputertyp "x64"

(Sorry for the German error messages in between)

This is because of a wrong library selection of the DirectX SDK libraries. It can be solved by changing in file "<build-dir>\externals\Source\SDL-1.2.15\CMakeLists.txt" the line 37 from
Code: Select all
link_directories($ENV{DXSDK_DIR}/lib/x86)

to
Code: Select all
link_directories($ENV{DXSDK_DIR}/lib/x64)


Attention: Changing it in this way, will break x86 build. Thus it is just a dirty workaround. For a real solution a conditional library selection must be implemented here.

4.) SDL2 build fails with debug-configuration and VC2015

The error looks like this:
Code: Select all
[  3%] Linking C shared library SDL2.dll
   Bibliothek "SDL2.lib" und Objekt "SDL2.exp" werden erstellt.
MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol "_CrtDbgReport" in Funktion "_CRT_RTC_INIT".
MSVCRTD.lib(_init_.obj) : error LNK2019: unresolved external symbol "_CrtDbgReportW" in Funktion "_CRT_RTC_INITW".
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol "__stdio_common_vsprintf_s" in Funktion "_vsprintf_s_l".
MSVCRTD.lib(_error_.obj) : error LNK2001: unresolved external symbol "__C_specific_handler".
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol "_wmakepath_s" in Funktion ""int __cdecl GetPdbDllPathFromFilePath(
wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)".
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol "_wsplitpath_s" in Funktion ""int __cdecl GetPdbDllPathFromFilePath
(wchar_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)".
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol "wcscpy_s" in Funktion ""int __cdecl GetPdbDllPathFromFilePath(wcha
r_t const *,wchar_t *,unsigned __int64)" (?GetPdbDllPathFromFilePath@@YAHPEB_WPEA_W_K@Z)".
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol "__vcrt_GetModuleFileNameW" in Funktion ""struct HINSTANCE__ * __cd
ecl GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)".
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol "__vcrt_GetModuleHandleW" in Funktion ""struct HINSTANCE__ * __cdec
l GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)".
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol "__vcrt_LoadLibraryExW" in Funktion ""struct HINSTANCE__ * __cdecl
GetPdbDll(void)" (?GetPdbDll@@YAPEAUHINSTANCE__@@XZ)".
SDL2.dll : fatal error LNK1120: 10 nicht aufgel÷ste Externe
LINK Pass 1 failed. with 1120

(Sorry for the German error messages in between)

For some reasons 3 additional libraries must be added to the cmake-script. This can be done by changing in file "<build-dir>\externals\Source\SDL2-2.0.3\CMakeLists.txt" line 879 from
Code: Select all
  # Libraries for Win32 native and MinGW
  list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)

to
Code: Select all
# Libraries for Win32 native and MinGW
  list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid msvcrtd vcruntimed ucrtd)


5.) The OpenAI cmake-script does not find the snprintf function

The error looks like this:
-- Looking for snprintf
-- Looking for snprintf - not found
-- Looking for _snprintf
-- Looking for _snprintf - not found
CMake Error at CMakeLists.txt:439 (MESSAGE):
No snprintf function found, please report!


-- Configuring incomplete, errors occurred!


Of course this function exists in VC2015, but for any reason it cannot be found by the cmake-script.
A workaround is here to change in file "<build-dir>\externals\Source\openal-soft-1.16.0\CMakeLists.txt" the code from line 435 from
Code: Select all
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
IF(NOT HAVE_SNPRINTF)
    CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
    IF(NOT HAVE__SNPRINTF)
        MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
    ENDIF()

    ADD_DEFINITIONS(-Dsnprintf=_snprintf)
ENDIF()

to
Code: Select all
#CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
#IF(NOT HAVE_SNPRINTF)
#    CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
#    IF(NOT HAVE__SNPRINTF)
#        MESSAGE(FATAL_ERROR "No snprintf function found, please report!")
#    ENDIF()
#
#    ADD_DEFINITIONS(-Dsnprintf=_snprintf)
#ENDIF()


Attention: This is just a workaround. There must be any reason why cmake cannot find the function and someone needs to investigate in this.

6.) Build error for OpenAI due to wrong type-definition

The Error looks like this:
[ 53%] Performing build step for 'openal-soft-1.16.0'

Microsoft (R) Program Maintenance Utility, Version 14.00.24210.0
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Scanning dependencies of target common
[ 1%] Building C object CMakeFiles/common.dir/common/atomic.c.obj
atomic.c
[ 3%] Building C object CMakeFiles/common.dir/common/rwlock.c.obj
rwlock.c
D:\Projects\Uni\SAM\speeddreams\svn-2.2.1\packaging\3rdParty-devel\build\win64\release\externals\Source\openal-soft-1.16.0\include\threads.h(38): error C2011
: "timespec": "struct" Typneudefinition

(Sorry for the German error messages in between)

This error has already been fixed at OpenAI code-base. The fix is here: https://github.com/kcat/openal-soft/com ... 84b76437c4

Just change in the file "<build-dir>\externals\Source\openal-soft-1.16.0\include\threads.h" the line 36 from
Code: Select all
#ifndef _TIMESPEC_DEFINED

to
Code: Select all
#if !defined(_TIMESPEC_DEFINED) && !(defined(_MSC_VER) && (_MSC_VER >= 1900))



Speed-Dreams compile issues
===============================

1.) Wrong suffix for literals in TGF

The error looks like this:
Code: Select all
[  3%] Building CXX object src/libs/tgf/CMakeFiles/tgf.dir/modinfo.cpp.obj
cl : Befehlszeile warning D9025 : "/W3" wird durch "/W4" überschrieben
modinfo.cpp
D:\Projects\Uni\SAM\speeddreams\svn-2.2.1\src\libs\tgf\modinfo.cpp(45): error C3688: ungültiges Literalsuffix "DLLEXT"; Literaloperator oder Literaloperator-
Vorlage "operator ""DLLEXT" nicht gefunden

(sorry for the German error message)

Basically it says, that there is no operator called "DLLEXT", which is obviously true.
The intention of this code is to concatenate a string literal with another string-literal DLLEXT, however for Visual C++ 2015 there must be a space in between both string literals.
Thus in file "<repository-dir>\src\libs\tgf\modinfo.cpp" you have to change line 45 from
Code: Select all
static const size_t SOFileExtLen = strlen("."DLLEXT);

to
Code: Select all
static const size_t SOFileExtLen = strlen("." DLLEXT);


The same error exists also for many places in the file "<repository-root>\src\libs\tgf\windowsspec.cpp". For example line 34, 217, 308 ... but also other lines, you should search for DLLEXT and change add a space at every place where you find it.

2.) Non existing define symbol "CMAKE_INTDIR"

The error looks like this:
[ 3%] Building CXX object src/libs/tgf/CMakeFiles/tgf.dir/tgf.cpp.obj
cl : Befehlszeile warning D9025 : "/W3" wird durch "/W4" überschrieben
tgf.cpp
D:\Projects\Uni\SAM\speeddreams\svn-2.2.1\src\libs\tgf\tgf.cpp(511): error C2065: "CMAKE_INTDIR": nichtdeklarierter Bezeichner

(Sorry for the German error messages)
It basically says, that there is no symbol with the name "CMAKE_INTDIR".

This happens, because CMAKE_INTDIR is only available for some Visual Studio targets, but not in general for Visual C++ target. If you build makefiles for "nmake" with CMake, you still use Visual C++, but not Visual Studio and then the name is simply not defined by cmake.
Thus changing in file "<repository-root>\cmake\config.h.in.cmake" line 160 from
Code: Select all
#if defined(_MSC_VER)
# define SD_BUILD_INFO_CONFIGURATION CMAKE_INTDIR
#else
# define SD_BUILD_INFO_CONFIGURATION "${CMAKE_BUILD_TYPE}"
#endif

to
Code: Select all
#define SD_BUILD_INFO_CONFIGURATION "${CMAKE_BUILD_TYPE}"


Attention: Maybe this breaks the original intention of the conditional definition. However I don't see any reasons, why "${CMAKE_BUILD_TYPE}" is wrong here for Visual Studio.

Run time errors with speed-dream on Win10 64bit
================================================

1.) Wrong handle for _findfirst/_findnext directory-operations

When starting the game, it immediately crashes while loading all configuration files. Sometime you can hear one second of the background music, before it crashes. This happens due to a segmentation fault in file "<repository-root>\src\libs\tgf\windowsspec.cpp". There are several lines that look like this:
long Dirent = _findfirst(Dir_name, &FData);


The problem here is, that "_findfirst(...)" returns a handle, which is like a address. For the "_findnext(...)" function you need to pass this handle back to find the next file. On 64 bit systems those handles are also 64 bit long.
However a long has only 32 bits, thus the first 32 bit of the handle is just discarded. When passing the half address to "_findnext(...)" it tries to read or write from this wrong address, thus a segmentation fault happens.
Thus changing those lines to:

auto Dirent = _findfirst(Dir_name, &FData);


Solves the issue.

Attention: There are tons of warnings during compilation, that size_t datatypes are assigned to long or int and thus the values are truncated. It seems not to lead to any bad errors like this one here, but it should be in general good practise to solve those warning. 64bit systems and compilers are very common nowadays, thus every line of code should be 64bit ready, from my point of view.

2.) Corrupted Stack when quitting a race.

When you press ESC during a race, an exit menu is shown. This leads on my system to an error due to a corrupted stack.
The error is in file "<repository-root>\src\modules\userinterface\legacymenu\racescreens\racestopmenu.cpp", line 308, where a string buffer with size 100 is declared. If you start this game from a deep directory structure (like I did), 100 characters are not enough to store the full path, thus a buffer overflow happens, since sprintf is writing too much characters to the buffer.

My suggestion is here to never use sprintf exactly due to those issues. And of course, one can simply increase the buffer size from 100 to 1024 to solve this problem.


Unresolved issues on my system
=================================

Unfortunately there are still some unresolved issues, which are no blocking points (like the others). For example:

1.) During a race I see a lot of "Default Warning refresh: ssgCullAndDraw start invalid value" messages on the console. Thus no other debug-messages are readable any more. I think it comes somehow from the file "<repository-root>/src/modules/graphic/ssggraph/grscene.cpp" around line 236, but I need to investigate further. The message appears independently of the track and car I select for my race.

2.) I sometimes see messages like "Default Error OpenALMusicPlayer: OpenAL error was raised: 40961". However the music is available...

3.) Also errors like
00:12:50.822 Default Error Can't unregister module in d:/Projects/Uni/SAM/speeddreams/svn-2.2.1/install/win64/dbg/lib64/modules/track/trackv1.dll (not yet
registered)
00:12:50.822 Default Error Can't unregister module in d:/Projects/Uni/SAM/speeddreams/svn-2.2.1/install/win64/dbg/lib64/modules/userinterface/legacymenu.d
ll (not yet registered)
00:12:50.823 Default Error Can't unregister module in d:/Projects/Uni/SAM/speeddreams/svn-2.2.1/install/win64/dbg/lib64/modules/racing/standardgame.dll (n
ot yet registered)

Appear on exit the application.

4.) Also "libpng warning: iCCP: known incorrect sRGB profile" appears sometimes...

5.) Messages like
Code: Select all
00:00:01.258 Default  Error   No usable 'kilo2008' driver (kilo2008.xml not found or not readable)
00:00:01.259 Default  Error   No usable 'shadow' driver (shadow.xml not found or not readable)
00:00:01.259 Default  Error   No usable 'shadow_36GP' driver (shadow_36GP.xml not found or not readable)
00:00:01.260 Default  Info    Ignoring 'shadow_67GP' driver #1 (not defined or empty name)
00:00:01.260 Default  Error   No usable 'shadow_lp1' driver (shadow_lp1.xml not found or not readable)
00:00:01.260 Default  Error   No usable 'shadow_ls1' driver (shadow_ls1.xml not found or not readable)
00:00:01.261 Default  Error   No usable 'shadow_ls2' driver (shadow_ls2.xml not found or not readable)
00:00:01.261 Default  Error   No usable 'shadow_mp5' driver (shadow_mp5.xml not found or not readable)
00:00:01.264 Default  Error   No usable 'shadow_ref' driver (shadow_ref.xml not found or not readable)
00:00:01.266 Default  Error   No usable 'shadow_srw' driver (shadow_srw.xml not found or not readable)
00:00:01.266 Default  Error   No usable 'shadow_trb1' driver (shadow_trb1.xml not found or not readable)

are also strange, since this is a fresh installation. I don't know why those files are missing. Maybe some needs to clean up any configurations?


Ok, that's all so far. I hope it helps other users to compile the game on Windows. Maybe I can provide some patches later.
anet
 
Posts: 2
Joined: Thu May 04, 2017 3:53 pm

Re: Several compile Issues on Windows 10, VC2015 64Bit

Postby anet » Sat May 06, 2017 2:43 pm

No comments so far? This project actually seems to be almost dead, right?
Too bad, it is a good alternative for TORCS.

However I have prepared all patches needed to get the project compiling out of the box. I really want to add it here to the thread, but the board attachment quota is reached, so not chance.
If someone need them, just write a PN to me. Or maybe someone wants to host the patch files on a private space?

Best regards
anet
 
Posts: 2
Joined: Thu May 04, 2017 3:53 pm


Return to Problems, Fixes & Help

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests