News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Compile Help?

Started by AndHobbes, December 26, 2017, 01:51:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AndHobbes

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:
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."

jamespetts

Hello - sorry that you are having trouble. May I ask what platform that you are using?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

AndHobbes

Windows 10 64-bit.  I downloaded all dependencies in 32-bit and am compiling for Win32 target in Visual Studio.

jamespetts

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

AndHobbes

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:
Quote from: laos on December 28, 2016, 06:50:03 AM
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.

jamespetts

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?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Frank

#6
set in simuconf.tab saveformat zipped

# 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




Quote from: AndHobbes 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: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

AndHobbes

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.

AndHobbes

Confirmed that this is set in simuconf.tab:

saveformat = bzip2

jamespetts

I can only guess that this is some bzip2 compatibility issue, perhaps a bad version. May I suggest trying the library/dll versions here?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

DrSuperGood

With exception of PThread, I suggest building your own dependencies. Most have a MSVC compatible build process which requires only minor property changes.