The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: tom_l | Created: 2018-03-20 21:57:23
Subject: Building TORCS with VS 2017 Community
Hey TORCS community.

I'm trying to build the simulator with the Visual Studio 2017 Community edition. I followed the hints I found regarding building it under windows with different version of VS.

First thing I needed to fix was the #define of snprintf in portability.h
this is no longer needed and actually brakes the build.

Then I figured that the vs2008 libs provided for plib, libpng and zlib no longer worked. As far as I could find out TORCS 1.3.7 uses plib 1.8.5, libpng 1.5.7 and zlib 1.2.5, so I built those from sources.

I replaced the following libs with the newly built versions:
sg_vs2008_32.lib
ssg_vs2008_32.lib
ul_vs2008_32.lib
libpng15_vs2008_32.lib
zlib1_vs2008_32.lib

Now I'm left with linker issues. It's not /SAFESEH, that I changed to no.
I'm afraid the issues lies with zlib, this is the error I get (sorry it's German)
Fehler LNK2019 Verweis auf nicht aufgelöstes externes Symbol "_gzgets" in Funktion ""int __cdecl do_object(char *)" (?do_object@@YAHPAD@Z)". client C:\tools\torcs-1.3.7\src\libs\client\ssggraphlib.lib(grloadac.obj) 1

So the linker error is in "client" it refers to ssgraphlib.lib but that built just fine. The symbol should be defined in the zlib lib. The zlib.lib I get in the libpng project does not contain it. When I build the zlib project seperately I get a _gzgets symbol, but the naming(?) seems to be off, I only find _gzgets@12 in the respective zlib.lib

I think I just need to find the correct configuration to build zlib and the issue would be gone, but I'm lacking the specifics. Does any one of you have a hint on how to proceed?
Last Edited: 2018-03-20 21:57:23 by tom_l
    Author: tom_l | Created: 2018-03-26 14:29:01
    Subject: Re: Building TORCS with VS 2017 Community
    Finally I was able to follow through with building. I figured I need to get rid of the "ZLIB_WINAPI" preprocessor definition, it was set in the VS project file that came with the zlib sources. This fixed the weird symbol naming issue described in the previous post.

    Now I'm chasing a runtime error on startup, which is in libpng. My guts tell me I still didn't get the build right.
    Last Edited: 2018-03-26 14:29:01 by tom_l
      Author: firechief | Created: 2018-04-04 10:22:29
      Subject: Re: Building TORCS with VS 2017 Community
      You got further than I did - I spent a few hours last year trying to get a VS 2017 build happening and ended up abandoning it. I'm using VS 2013, but I don't know if that version's still available for download. The install documentation only discusses up to VS 2012.

      I did try to build this in cygwin many years ago, but didn't get very far - I'll give it another go tonight but my expectations are pretty low. EDIT: I can't even get plib to build under cygwin, so that's that I guess.

      Unfortunately it seems that unless this is addressed, TORCS is in danger of being relegated to linux only, which would obviously be a real pity.

      Last Edited: 2018-04-04 10:24:26 by firechief