The International Simutrans Forum

 

Author Topic: Compile Help?  (Read 759 times)

0 Members and 1 Guest are viewing this topic.

Offline AndHobbes

  • *
  • Posts: 5
Compile Help?
« on: December 26, 2017, 01:51:35 PM »
With the instructions in the pinned post and some trial and error, I was able to get the game to compile and launch the latest stable pak128.Britain-Ex.  However, the application crashes when clicking Load Game.

I'm getting an error in loadsave_t::rd_open on this line:
Code: [Select]
if(  BZ2_bzRead( &fd->bse, fd->bzfp, buf, sizeof(SAVEGAME_PREFIX) )==sizeof(SAVEGAME_PREFIX)  &&  fd->bse==BZ_OK  ) {The error is "An invalid parameter was passed to a function that considers invalid parameters fatal."

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compile Help?
« Reply #1 on: December 26, 2017, 02:01:25 PM »
Hello - sorry that you are having trouble. May I ask what platform that you are using?

Offline AndHobbes

  • *
  • Posts: 5
Re: Compile Help?
« Reply #2 on: December 26, 2017, 02:54:17 PM »
Windows 10 64-bit.  I downloaded all dependencies in 32-bit and am compiling for Win32 target in Visual Studio.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compile Help?
« Reply #3 on: December 26, 2017, 03:02:27 PM »
Ahh, yes, I have not set up 64-bit compilation for Windows yet, although I may have to do so soon as memory requirements for large maps may be enough to require 64-bit code. You can always use the pre-compiled executable for Windows if you cannot get it to compile yourself.

Offline AndHobbes

  • *
  • Posts: 5
Re: Compile Help?
« Reply #4 on: December 26, 2017, 03:26:16 PM »
I am compiling a 32-bit executable (Win32 build target in Visual Studio), it's just the operating system that's 64-bit, which shouldn't be a problem.

The debug build launches and runs fine, except for saving and loading games, so I suspect that I may not have the bzip2 dependency referenced correctly.  I downloaded bzip2-dev-1.0.6-win-x86.zip and bzip2-dll-1.0.6-win-x86.zip as suggested here:
https://github.com/philr/bzip2-windows/releases
From those files, I made sure that bzlib.h was in the includes path and libbz2.lib was in the library path, before which it didn't compile.  Then I made sure libbz2.dll was in the same directory as the compiled.exe, before which it didn't run.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compile Help?
« Reply #5 on: December 26, 2017, 03:33:32 PM »
That is odd. It is difficult for me to check my own arrangement in detail at present, as I am staying away from home for Christmas and thus have no access to my development computer. Are you using the supplied Visual Studio project file? If so, can I check that you are using the correct one - may I ask what the filename of the one that you are using is?

Offline Frank

  • Inactive/Retired
  • *
  • Posts: 1431
  • Languages: DE
Re: Compile Help?
« Reply #6 on: December 26, 2017, 03:48:08 PM »
set in simuconf.tab saveformat zipped

Code: [Select]
# compress savegames?
# "binary" means uncompressed, "zipped" means compressed
# "bzip2" uses another compression algorithm
# other options are "xml", "xml_zipped" and "xml_bzip2"
# xml detects more errors of broken savegames but files are much larger
# bzip2 savegames are smaller than zipped but saving/loading takes longer
saveformat = bzip2

I think than save and load savegames



I am compiling a 32-bit executable (Win32 build target in Visual Studio), it's just the operating system that's 64-bit, which shouldn't be a problem.

The debug build launches and runs fine, except for saving and loading games, so I suspect that I may not have the bzip2 dependency referenced correctly.  I downloaded bzip2-dev-1.0.6-win-x86.zip and bzip2-dll-1.0.6-win-x86.zip as suggested here:From those files, I made sure that bzlib.h was in the includes path and libbz2.lib was in the library path, before which it didn't compile.  Then I made sure libbz2.dll was in the same directory as the compiled.exe, before which it didn't run.

Quote
...
All binaries depend on the Visual Studio 2013 C Runtime Library (msvcr120.dll). This can be installed using the Visual C++ Redistributable Packages for Visual Studio 2013 installer.

the dll-file from page is for VS 2013

http://www.bzip.org/index.html
« Last Edit: December 26, 2017, 03:59:07 PM by Frank »

Offline AndHobbes

  • *
  • Posts: 5
Re: Compile Help?
« Reply #7 on: December 26, 2017, 04:09:16 PM »
No problem, I appreciate the assistance!  I opened Simutrans-Extended.sln which references Simutrans-Extended.vcxproj.  It was correctly opened as a Visual Studio 2015 project, with VS2015 (v140) platform toolset and 8.1 target platform version.

Offline AndHobbes

  • *
  • Posts: 5
Re: Compile Help?
« Reply #8 on: December 26, 2017, 04:14:12 PM »
Confirmed that this is set in simuconf.tab:

Code: [Select]
saveformat = bzip2

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compile Help?
« Reply #9 on: December 26, 2017, 04:18:32 PM »
I can only guess that this is some bzip2 compatibility issue, perhaps a bad version. May I suggest trying the library/dll versions here?

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2727
  • Languages: EN
Re: Compile Help?
« Reply #10 on: December 27, 2017, 04:47:33 AM »
With exception of PThread, I suggest building your own dependencies. Most have a MSVC compatible build process which requires only minor property changes.