The International Simutrans Forum

 

Author Topic: Compiling No-Graphics server in linux  (Read 8942 times)

0 Members and 1 Guest are viewing this topic.

Offline deMangler

  • *
  • Posts: 68
Compiling No-Graphics server in linux
« on: May 17, 2011, 01:18:50 AM »
Hi,
I have been trying to compile a Compiling No-Graphics linux binary executable from the git repository.

I am using the options

BACKEND='posix' COLOUR_DEPTH=0 OSTYPE='linux'  

which from the makefile seem to be good for the options for the no graphics server.

However I am getting a LOT of undefined reference to *various display_ stuff* failure going on.

I can compile ok with options BACKEND='posix' COLOUR_DEPTH=16 OSTYPE='linux'  

Which would indicate I have a sane environment with all the libs I need.

So I am probably getting the options wrong.

Sorry - I am new to trying to compile simutrans.
Any help appreciated. Thanks.

dM
« Last Edit: May 17, 2011, 09:37:36 PM by deMangler »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10826
  • Languages: De,EN,JP
Re: Compiling Graphics-only server in linux
« Reply #1 on: May 17, 2011, 07:49:38 AM »
Sounds like the experimental Makefile is missing some of the later changes from standard. Or missing simgraph0.cc entirely; or rather its missing some of the changes from standard.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling Graphics-only server in linux
« Reply #2 on: May 17, 2011, 08:08:14 AM »
simgraph0.cc is there.

I will keep playing with it. I get the feeling there are lots of changes going on with experimental at the moment so I wouldn't expect to be able to chase down anything complicated with my severely limited experience of simutrans.

I was hoping it would be something simple. If I get it working I'll post here.

Thanks.


Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10826
  • Languages: De,EN,JP
Re: Compiling Graphics-only server in linux
« Reply #3 on: May 17, 2011, 11:11:08 AM »
I think there are some routines missing im simgraph0.cc which are needed for experimental.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #4 on: May 17, 2011, 10:48:08 PM »
I have been able to compile a no graphics Windows version without too many difficulties, so I do not think that this is the issue.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10826
  • Languages: De,EN,JP
Re: Compiling No-Graphics server in linux
« Reply #5 on: May 18, 2011, 08:12:20 AM »
THen I suspect the Makefile ...

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #6 on: May 31, 2011, 10:57:12 PM »
Well, I have attempted to fix this on a couple of my dev linux systems, one debian based and one slackware based, both 32 and 64 bit and with different versions of gcc.
In all cases I can compile the normal version ok, but not the CLI server (same errors).
I have very little experience with C so I will likely not come up with a solution to this, also - unfortunately I have run out of spare time for a while.
However, if a solution is found or a linux CLI no-graphics server of simutrans experimental is produced I will happily run a server.
 ???   :)

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #7 on: May 31, 2011, 11:06:41 PM »
deMangler,

thank you for your interest in this, and sorry that you are having difficulties. To help me to diagnose the problem, can you copy the compiler's actual output so that I can see the specific error messages? Thank you in advance.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #8 on: June 01, 2011, 04:58:38 PM »
deMangler,

thank you for your interest in this, and sorry that you are having difficulties. To help me to diagnose the problem, can you copy the compiler's actual output so that I can see the specific error messages? Thank you in advance.

Hi,
I have zipped up the logs of the compiler output. they can be downloaded here:

http://www.box.net/shared/1rputi8umh

Hope this helps. Thanks for all the simutrans-experimental work. It is appreciated.
dM

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Compiling No-Graphics server in linux
« Reply #9 on: June 01, 2011, 05:07:08 PM »
you have to compile with the option

-DCOMMAND_LINE_SERVER

Btw this compiler switch seems unnecessary.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #10 on: June 01, 2011, 05:25:25 PM »
you have to compile with the option

-DCOMMAND_LINE_SERVER

Btw this compiler switch seems unnecessary.

That option gives me the 'invalid option' error.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #11 on: June 01, 2011, 05:30:54 PM »
DeMangler and Dwachs,

thank you for that. The command line switch is necessary in MSVC++ to have different versions available easilyin the builds menu.

DeMangler - where do you get the "invalid option" error? What syntax do you use? The precompiler directive can be defined in the makefile.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #12 on: June 01, 2011, 05:46:47 PM »
I am including the switch in the command line, so where I would normally do:

Code: [Select]
make BACKEND='posix' COLOUR_DEPTH=0 OSTYPE='linux'
I am doing:
Code: [Select]
make BACKEND='posix' COLOUR_DEPTH=0 OSTYPE='linux' -DCOMMAND_LINE-SERVER
But actually it makes no difference where in the command line I put the -DCOMMAND_LINE-SERVER option it fails with the same error.

As I say above, compiling with:

Code: [Select]
make BACKEND='posix' COLOUR_DEPTH=16 OSTYPE='linux' works fine.


If I add the option to the makefile like:

Code: [Select]
CCFLAGS += -DUSE_INDEPENDENT_PATH_POOL -DDEBUG_SIMRAND_CALLS -DCOMMAND_LINE-SERVER
And then do:

Code: [Select]
make BACKEND='posix' COLOUR_DEPTH=0 OSTYPE='linux'
Then I get the same errors as when I compile without adding the -DCOMMAND_LINE-SERVER option.

I can sucessfully compile a binary with the modified makefile and the COLOUR_DEPTH=16 option but it is exactly the same binary as with the unmodified makefile.



Sorry for my unfamiliarity with compiling C. I am popbably just doing something silly.
dM
« Last Edit: June 01, 2011, 09:34:40 PM by deMangler »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #13 on: June 01, 2011, 09:58:38 PM »
Ahh, I'm afraid that I can't access the error logs from my smartphone, so I shall have to wait until I get home from holiday to try to work out what is going on. Thank you for the inforamtion, though.

Offline Vonjo

  • *
  • Posts: 273
Re: Compiling No-Graphics server in linux
« Reply #14 on: June 02, 2011, 07:28:58 AM »
Hello,

I use simgraph0.cc from standard and it works.
https://github.com/aburch/simutrans/blob/v110.0.1/simgraph0.cc

Or, in simgraph0.cc, remove :
Code: [Select]
#ifdef COMMAND_LINE_SERVER from line 11
and
Code: [Select]
#endif from the last line
« Last Edit: June 02, 2011, 08:03:46 AM by vonjo »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #15 on: June 02, 2011, 08:13:39 AM »
Vonjo,

that's interesting - thank you. The only change in simgraph0.cc between Experimental and Standard is the inclusion of the #ifdef COMMAND_LINE_SERVER precompiler directive to enable the source file to be included in the MSVC++ project without being compiled in a normal build. There seems to be an issue with passing the precompiler directive to the compiler in DeMangler's case, which I am not sure that I really understand.

DeMangler - can you try, as a workaround, using the Standard simgraph0.cc? I should be interested in your results.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Compiling No-Graphics server in linux
« Reply #16 on: June 02, 2011, 08:18:01 AM »
I think make does not recognize when compiler directives change. That said, before compiling with DCOMANDLINESERVER one must delete the old simgraph0.o

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #17 on: June 02, 2011, 03:35:11 PM »
Vonjo,

that's interesting - thank you. The only change in simgraph0.cc between Experimental and Standard is the inclusion of the #ifdef COMMAND_LINE_SERVER precompiler directive to enable the source file to be included in the MSVC++ project without being compiled in a normal build. There seems to be an issue with passing the precompiler directive to the compiler in DeMangler's case, which I am not sure that I really understand.

DeMangler - can you try, as a workaround, using the Standard simgraph0.cc? I should be interested in your results.

Using the standard simugraph0.cc I can compile a working server binary.  :)
Thanks everyone.
dM

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #18 on: June 06, 2011, 10:30:12 PM »
Now that you have managed to get this working, do you think that you could upload your binaries somewhere? At present, the automatic nightly builds for Linux do not seem to be working, and in any event do not support the no graphics server.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #19 on: June 07, 2011, 12:44:41 AM »
Here are Linux binaries for Simutrans Experimental version 9.8.

Normal x86

Normal x64

Server x86

The only one of these binaries I have actually tested is the x86 server.
I am at present unable to compile an x64 server binary without errors, so it is possible my x64 compile environment has become wobbly.
Download and run these binaries entirely at your own risk, and so-on and so-forth.
:)
dM


Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #20 on: June 07, 2011, 08:59:59 AM »
Thank you very much - I have updated the links on the release page.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #21 on: June 24, 2011, 03:20:41 PM »
Hi,
Having pulled the latest git master (24/06/11)
When I try to compile with :

Code: [Select]
make BACKEND='posix' COLOUR_DEPTH=0 OSTYPE='linux'
Which is how I compiled the previously running 9.8 server.

It fails with:

Code: [Select]
===> CXX gui/message_frame_t.cc
In file included from gui/message_frame_t.cc:8:
gui/../simwin.h:167: error: 'size_t' has not been declared
make: *** [build/default/gui/message_frame_t.o] Error 1

dM

Offline inkelyad

  • Devotees (Inactive)
  • *
  • Posts: 482
  • Languages: EN, RU
Re: Compiling No-Graphics server in linux
« Reply #22 on: June 24, 2011, 03:37:20 PM »
Add
Code: [Select]
#include <stddef.h>

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #23 on: June 24, 2011, 03:52:32 PM »
Add
Code: [Select]
#include <stddef.h>
Thanks - I gave it a try.
However - I still get the same error.
dM

Offline inkelyad

  • Devotees (Inactive)
  • *
  • Posts: 482
  • Languages: EN, RU
Re: Compiling No-Graphics server in linux
« Reply #24 on: June 24, 2011, 04:04:32 PM »
Hm. size_t defined in stddef.h.

Where do you add it?

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #25 on: June 24, 2011, 04:13:18 PM »
Hm. size_t defined in stddef.h.

Where do you add it?
Well, first I tried adding it to the makefile, then I tried adding it to the command line.
Both times was the same output.

Sorry - but I am not very familiar with compiling C programs.
 :::)

dM

Offline inkelyad

  • Devotees (Inactive)
  • *
  • Posts: 482
  • Languages: EN, RU
Re: Compiling No-Graphics server in linux
« Reply #26 on: June 24, 2011, 04:21:42 PM »
Add it here:
simwin.h
Code: [Select]
#ifndef simwin_h
#define simwin_h
#include <stddef.h>
#include "simtypes.h"
#include "simconst.h"

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #27 on: June 24, 2011, 04:55:33 PM »
Add it here:
simwin.h
Code: [Select]
#ifndef simwin_h
#define simwin_h
#include <stddef.h>
#include "simtypes.h"
#include "simconst.h"

Thanks.
That solved that problem.
:)
I now have the problem I had before at the beginning of this thread (with 9.8 ), which was fixed by replacing the simgraph0.cc with the one from standard. I don't know if that would work again.
I don't have any more time to spend on it now, but I will look into it when I can and hopefully get a server up and running again.

dM

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #28 on: June 25, 2011, 09:44:15 AM »
Attempting to compile with the above changes and using the simgraph0.cc from standard fails with the error:

Code: [Select]
===> CXX simgraph0.cc
simgraph0.cc: In function 'sint16 display_set_height(KOORD_VAL)':
simgraph0.cc:92: error: new declaration 'sint16 display_set_height(KOORD_VAL)'
besch/../simgraph.h:112: error: ambiguates old declaration 'void display_set_height(KOORD_VAL)'
simgraph0.cc: In function 'void display_multiline_text(KOORD_VAL, KOORD_VAL, const char*, PLAYER_COLOR_VAL)':
simgraph0.cc:279: error: new declaration 'void display_multiline_text(KOORD_VAL, KOORD_VAL, const char*, PLAYER_COLOR_VAL)'
besch/../simgraph.h:254: error: ambiguates old declaration 'int display_multiline_text(KOORD_VAL, KOORD_VAL, const char*, PLAYER_COLOR_VAL)'
make: *** [build/default/simgraph0.o] Error 1



dM

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #29 on: June 25, 2011, 01:16:19 PM »
deMangler,

sorry that you have been having trouble, and thank you for the report. Inkelyad - I have applied your suggested change on my 9.x branch: thank you for that. The 9.x branch now compiles satisfactorily with MinGW.

I am not sure, however, why there are still problems with compiling in GCC; any thoughts would be most welcome.

Offline deMangler

  • *
  • Posts: 68
Re: Compiling No-Graphics server in linux
« Reply #30 on: June 28, 2011, 07:58:14 AM »
My latest attempts to compile (with git master on 28/6/11 0730 UTC) fail with:
Code: [Select]
===> CXX vehicle/simverkehr.cc
make: *** No rule to make target `build/default/simgraph0.o', needed by `build/default/simutrans-experimental'.  Stop.

dM



Offline dustNbone

  • *
  • Posts: 100
Re: Compiling No-Graphics server in linux
« Reply #31 on: July 02, 2011, 03:51:17 PM »
Good work on the new release boys :)  I built 32 bit Linux binaries again for SDL and Posix Server, using the same method as before.  I did remember to strip the symbols from the binaries this time and they're much smaller (3.4ish MB each) as a result.  I packaged them together this time, here is the MU URL

http://www.megaupload.com/?d=HK6XYLX0

I am excited to see how revenue is working now.  Thanks again for all the effort you guys put into this project, I don't want to say how many hours I have expended enjoying your work.  Several :)

Dustin

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20918
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Compiling No-Graphics server in linux
« Reply #32 on: July 02, 2011, 04:57:12 PM »
dustNbone - thank you very much for that: that is most kind.