The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: jamespetts on January 02, 2009, 11:32:01 pm

Title: How to compile makeobj?
Post by: jamespetts on January 02, 2009, 11:32:01 pm
How does one compile the makeobj sources that come with the svn? I have been following the instructions here (http://forum.simutrans.com/index.php?topic=652.0;all) successfully when compiling Simutrans itself, but they do not explain how to compile makeobj. Any help would be appreciated.
Title: Re: How to compile makeobj?
Post by: prissi on January 03, 2009, 09:48:44 am
You need cygwin or mingw. I did not bother with a MSVC script.
Title: Re: How to compile makeobj?
Post by: jamespetts on January 03, 2009, 04:24:18 pm
Prissi,

thank you for your reply. However, I am having great difficulties compiling with either of the utilities that you suggested. There is no setting in the makefile for cygwin, and using the mingw settings, the output complains of a missing mingw file. I have tried all of the other settings, but all produce missing file errors. Using mingw, I get the following output:

Code: [Select]
F:\My Documents\Development\Simutrans\Sources\simutrans\trunk\makeobj>mingw32-make
cc -O -g -DMAKEOBJ  -o makeobj makeobj.o ../besch/writer/obj_node.o ../simmem.o ../dataobj/freelist.o ../dataobj/tabfile.o ../utils/cstring_t.o ../utils/simstring.o ../utils/searchfolder.o ../tpl/debug_helper.o ../utils/dr_rdpng.o ../besch/writer/building_writer.o ../besch/writer/good_writer.o ../besch/writer/skin_writer.o ../besch/writer/image_writer.o ../besch/writer/imagelist2d_writer.o ../besch/writer/imagelist_writer.o ../besch/writer/obj_writer.o ../besch/writer/root_writer.o ../besch/writer/xref_writ
er.o ../besch/writer/text_writer.o ../besch/writer/tree_writer.o ../besch/writer/factory_writer.o ../besch/writer/bridge_writer.o ../besch/writer/vehicle_writer.o ../besch/writer/way_writer.o ../besch/writer/way_obj_writer.o ../besch/writer/ground_writer.o  ../besch/writer/sound_writer.o ../besch/writer/crossing_writer.o  ../besch/writer/tunnel_writer.o ../besch/writer/citycar_writer.o  ../besch/writer/pedestrian_writer.o ../besch/writer/sim_writer.o ../besch/writer/roadsign_writer.o ../besch/writer/groundo
bj_writer.o ../besch/writer/get_waytype.o ../besch/writer/get_climate.o ../simdebug.o ../utils/log.o ../simtools.o -lmingw32 -lpng -lz -lstdc++
process_begin: CreateProcess(NULL, cc -O -g -DMAKEOBJ -o makeobj makeobj.o ../besch/writer/obj_node.o ../simmem.o ../dataobj/freelist.o ../dataobj/tabfile.o ../utils/cstring_t.o ../utils/simstring.o ../utils/searchfolder.o ../tpl/debug_helper.o ../utils/dr_rdpng.o ../besch/writer/building_writer.o ../besch/writer/good_writer.o ../besch/writer/skin_writer.o ../besch/writer/image_writer.o ../besch/writer/imagelist2d_writer.o ../besch/writer/imagelist_writer.o ../besch/writer/obj_writer.o ../besch/writer/root_
writer.o ../besch/writer/xref_writer.o ../besch/writer/text_writer.o ../besch/writer/tree_writer.o ../besch/writer/factory_writer.o ../besch/writer/bridge_writer.o ../besch/writer/vehicle_writer.o ../besch/writer/way_writer.o ../besch/writer/way_obj_writer.o ../besch/writer/ground_writer.o ../besch/writer/sound_writer.o ../besch/writer/crossing_writer.o ../besch/writer/tunnel_writer.o ../besch/writer/citycar_writer.o ../besch/writer/pedestrian_writer.o ../besch/writer/sim_writer.o ../besch/writer/roadsign_w
riter.o ../besch/writer/groundobj_writer.o ../besch/writer/get_waytype.o ../besch/writer/get_climate.o ../simdebug.o ../utils/log.o ../simtools.o -lmingw32 -lpng -lz -lstdc++, ...) failed.
make (e=2): The system cannot find the file specified.
mingw32-make: *** [makeobj] Error 2

Edit:

This is the output that I get with cygwin:

Code: [Select]
$ make ->makelog.txt
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find
 -lmingw32
collect2: ld returned 1 exit status
make: *** [makeobj] Error 1

I should be most grateful for any ****istance.
Title: Re: How to compile makeobj?
Post by: VS on January 03, 2009, 04:43:37 pm
I can tell that cygwin compiled succesfully but linker can't find mingw32.o or mingw32.a or whatever extension it has. You must find it and add that folder to path, then it might work. Or complain about other not found files... :(
Title: Re: How to compile makeobj?
Post by: jamespetts on January 03, 2009, 05:23:53 pm
VS,

thank you for your reply. Where might I find those files?
Title: Re: How to compile makeobj?
Post by: VS on January 03, 2009, 05:37:23 pm
Errrrm, dunno.

But if you have msvc all set up for Simturans, I just now updated the sticky introductory thread (its first post) with project files for Makeobj ;)
Title: Re: How to compile makeobj?
Post by: jamespetts on January 03, 2009, 05:53:32 pm
VS,

thank you. I downloaded the files (incidentally, it seems that the makeobj files should go in the makeobj subdirectory, not the trunk directory, as all of the relative paths to the trunk directory start with "../"), but, when I go to build makeobj, I get the following linker errors:

Code: [Select]
1>------ Build started: Project: makeobj, Configuration: Debug Win32 ------
1>Linking...
1>makeobj.obj : error LNK2019: unresolved external symbol "public: void __thiscall root_writer_t::copy(char const *,int,char * * const)" (?copy@root_writer_t@@QAEXPBDHQAPAD@Z) referenced in function __catch$_main$0
1>makeobj.obj : error LNK2019: unresolved external symbol "public: void __thiscall root_writer_t::uncopy(char const *)" (?uncopy@root_writer_t@@QAEXPBD@Z) referenced in function __catch$_main$0
1>makeobj.obj : error LNK2019: unresolved external symbol "public: void __thiscall root_writer_t::list(int,char * * const)" (?list@root_writer_t@@QAEXHQAPAD@Z) referenced in function __catch$_main$0
1>makeobj.obj : error LNK2019: unresolved external symbol "public: void __thiscall root_writer_t::dump(int,char * * const)" (?dump@root_writer_t@@QAEXHQAPAD@Z) referenced in function __catch$_main$0
1>makeobj.obj : error LNK2019: unresolved external symbol "public: void __thiscall root_writer_t::write(char const *,int,char * * const)" (?write@root_writer_t@@QAEXPBDHQAPAD@Z) referenced in function _main
1>makeobj.obj : error LNK2019: unresolved external symbol "public: void __thiscall root_writer_t::capabilites(void)" (?capabilites@root_writer_t@@QAEXXZ) referenced in function _main
1>makeobj.obj : error LNK2019: unresolved external symbol "void __cdecl init_logging(char const *,bool,bool)" (?init_logging@@YAXPBD_N1@Z) referenced in function _main
1>makeobj.obj : error LNK2019: unresolved external symbol "private: static cl**** root_writer_t root_writer_t::the_instance" (?the_instance@root_writer_t@@0V1@A) referenced in function "public: static cl**** root_writer_t * __cdecl root_writer_t::instance(void)" (?instance@root_writer_t@@SAPAV1@XZ)
1>makeobj.obj : error LNK2019: unresolved external symbol "private: static int image_writer_t::img_size" (?img_size@image_writer_t@@0HA) referenced in function "public: static void __cdecl image_writer_t::set_img_size(int)" (?set_img_size@image_writer_t@@SAXH@Z)
1>Debug\makeobj.exe : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://f:\My Documents\Development\Simutrans\Sources\simutrans\makeobj\Debug\BuildLog.htm"
1>makeobj - 10 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Edit: When I opened the file on its own, rather than adding it to the Simutrans project, it seemed to work, except, for some reason, I had to change the order of certain lines of code in dr_rdpng.c (putting png_uint_32 widthpu32,heightpu32; above the pngptr lines, or else it would give me unfathomable syntax errors).
Title: Re: How to compile makeobj?
Post by: VS on January 03, 2009, 06:18:22 pm
Here I am not so sure I understand what you are saying.

You can build either Simutrans or Makeobj. Not both. -> Two project files

For Makeobj, you need to define MAKEOBJ (most likely cause of this problem) and link with zlib and libpng. The project file should take care of that... If you want to set this yourself, it's somewhere in the menus. I don't remember where - once set, you (or I) can forget about it.

Folder is correct since I have a folder with all project files, thus separated from actual code so that svn does not complain all the time. But anything that has path .. leading to trunk works.