News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

cannot compile on linux [4e38217]

Started by Vladki, October 31, 2016, 07:07:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vladki

With the last commit: 4e3821770854621e1e8f17f386a1ea7b991f314f
I cannot compile on linux, gcc 4.9.2

simworld.cc: In member function 'void karte_t::destroy()':
simworld.cc:681:2: error: 'cities_to_process' was not declared in this scope
  cities_to_process = 0;

simworld.cc: In constructor 'karte_t::karte_t()':
simworld.cc:2285:2: error: 'cities_to_process' was not declared in this scope
  cities_to_process = 0;

common.mk:50: návod pro cíl ,,build/default/simworld.o" selhal (cannot build simworld.o)

The compilation throws huge amount of warnings (it always did), so I tried to find some errors and hope that I picked the culprits.

jamespetts

I am afraid that I cannot reproduce this with GCC 5.4.0 with the latest commit (albeit I have just pushed the latest commit). Do you want to try again with the latest version, and, if that does not work, see if you can upgrade your version of GCC?

You may also want to try using "make clean" before trying to build it again.
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.

Vladki

I did:
git pull
make clean
make.

I did not update gcc yet
Here is the full output of compiling simworld.cxx


===> CXX simworld.cc
In file included from simplan.h:12:0,
                 from simworld.h:32,
                 from path_explorer.h:14,
                 from simworld.cc:23:
boden/grund.h:243:2: warning: "/*" within comment [-Wcomment]
  /**
^
In file included from vehicle/simvehicle.h:23:0,
                 from vehicle/simroadtraffic.h:15,
                 from simcity.h:22,
                 from simworld.cc:25:
vehicle/../boden/grund.h:243:2: warning: "/*" within comment [-Wcomment]
  /**
^
In file included from boden/boden.h:11:0,
                 from simworld.cc:59:
boden/grund.h:243:2: warning: "/*" within comment [-Wcomment]
  /**
^
In file included from obj/wayobj.h:15:0,
                 from simworld.cc:72:
obj/../boden/grund.h:243:2: warning: "/*" within comment [-Wcomment]
  /**
^
In file included from boden/grund.h:19:0,
                 from simplan.h:12,
                 from simworld.h:32,
                 from path_explorer.h:14,
                 from simworld.cc:23:
boden/wege/weg.h:60:41: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
  static const uint32 get_all_ways_count();
                                         ^
In file included from simworld.cc:30:0:
simfab.h:131:32: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
  const sint32 get_in_transit() const { return statistics[0][FAB_GOODS_TRANSIT]; }
                                ^
In file included from simworld.cc:40:0:
simmenu.h:322:31: warning: unused parameter 'y_diff' [-Wunused-parameter]
  virtual void rotate90(sint16 y_diff) { return; }
                               ^
In file included from simtool.h:15:0,
                 from simworld.cc:50:
boden/wege/schiene.h:27:26: warning: scoped enums only available with -std=c++11 or -std=gnu++11
  enum reservation_type : uint8  { block = 0, directional, priority };
                          ^
simworld.cc: In member function 'void karte_t::destroy()':
simworld.cc:685:2: error: 'cities_to_process' was not declared in this scope
  cities_to_process = 0;
  ^
simworld.cc:686:2: error: 'step_passengers_delta_t' was not declared in this scope
  step_passengers_delta_t = 0;
  ^
simworld.cc:667:7: warning: unused variable 'empty_depot_list' [-Wunused-variable]
  bool empty_depot_list = depot_t::get_depot_list().empty();
       ^
simworld.cc: In member function 'void karte_t::distribute_cities(const settings_t*, sint16, sint16)':
simworld.cc:931:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(city_population.get_count() < city_population_target_count) {
                                    ^
simworld.cc:940:65: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   } while ( city_population.get_count() <  number_of_big_cities && (population <= max_small_city_size  || population > max_city_size) ||
                                                                 ^
simworld.cc:969:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pos->get_count() < new_anzahl_staedte) {
                        ^
simworld.cc:989:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(  unsigned i=0;  i<new_anzahl_staedte;  i++  ) {
                          ^
simworld.cc:1035:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(  current_bev < citizens  ) {
                         ^
simworld.cc:1041:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if(  current_bev > citizens/2  &&  not_updated  ) {
                       ^
simworld.cc:988:11: warning: unused variable 'tbegin' [-Wunused-variable]
    uint32 tbegin = dr_time();
           ^
simworld.cc: In constructor 'karte_t::karte_t()':
simworld.cc:2347:2: error: 'cities_to_process' was not declared in this scope
  cities_to_process = 0;
  ^
simworld.cc:2348:2: error: 'step_passengers_delta_t' was not declared in this scope
  step_passengers_delta_t = 0;
  ^
simworld.cc: In member function 'const char* karte_t::can_lower_to(const player_t*, sint16, sint16, sint8, sint8, sint8, sint8, bool) const':
simworld.cc:3034:11: warning: unused variable 'gr' [-Wunused-variable]
  grund_t *gr = lookup_kartenboden_nocheck(x,y);
           ^
simworld.cc:3035:14: warning: unused variable 'water_hgt' [-Wunused-variable]
  const sint8 water_hgt = get_water_hgt_nocheck(x,y);
              ^
simworld.cc: In member function 'void karte_t::step()':
simworld.cc:4696:3: error: 'cities_to_process' was not declared in this scope
   cities_to_process = min(cities_awaiting_private_car_route_check.get_count() - 1, parallel_operations);
   ^
simworld.cc: In member function 'void karte_t::generate_passengers_or_mail(const ware_besch_t*)':
simworld.cc:5345:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int n = 0; n < destination_count && route_status != public_transport && route_status != private_car && route_status != on_foot; n++)
                    ^
simworld.cc:5361:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if(n < destination_count - 1)
           ^
simworld.cc:5389:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(n < destination_count - 1)
          ^
simworld.cc:5666:141: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if((route_status == no_route || route_status == too_slow || route_status == overcrowded || route_status == destination_unavailable) && n < destination_count - 1)
                                                                                                                                             ^
simworld.cc:5684:9: warning: enumeration value 'initialising' not handled in switch [-Wswitch]
   switch(route_status)
         ^
simworld.cc: In member function 'void karte_t::save(loadsave_t*, bool)':
simworld.cc:7006:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
    char *motd = "";
                 ^
simworld.cc: At global scope:
simworld.cc:8101:63: warning: unused parameter 'player' [-Wunused-parameter]
halthandle_t karte_t::get_halt_koord_index(koord k, player_t *player, bool create_halt)
                                                               ^
simworld.cc: In member function 'void karte_t::process_network_commands(sint32*)':
simworld.cc:8790:16: warning: unused variable 'offset2' [-Wunused-variable]
      const int offset2 = offset + nwt->last_checklist.print(buf + offset, "initiator");
                ^
simworld.cc: In member function 'void karte_t::do_network_world_command(network_world_command_t*)':
simworld.cc:8849:13: warning: unused variable 'offset2' [-Wunused-variable]
   const int offset2 = offset + LCHKLST(server_sync_step).print(buf + offset, "client");
             ^
simworld.cc:8865:15: warning: unused variable 'offset2' [-Wunused-variable]
     const int offset2 = offset + LCHKLST(nwt->last_sync_step).print(buf + offset, "executor");
               ^
simworld.cc: In member function 'void karte_t::update_weight_of_building_in_world_list(gebaeude_t*)':
simworld.cc:9456:33: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if(!gb || gb->get_is_factory() && gb->get_fabrik() == NULL)
                                 ^
simworld.cc: In member function 'sint64 karte_t::get_land_value(koord3d)':
simworld.cc:9614:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(city->get_city_population() >= settings.get_city_threshold_size())
                                  ^
simworld.cc:9618:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   else if(city->get_city_population() >= settings.get_capital_threshold_size())
                                       ^
common.mk:50: návod pro cíl ,,build/default/simworld.o" selhal
make: *** [build/default/simworld.o] Chyba 1

jamespetts

That is very odd. Does anyone know what differences that there are between the two versions of GCC (and Visual Studio) that might cause this discrepancy?
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.

Vladki

compilation of the latest commit (801c403aec914bf894350b8130183bf2e65e50ba) failed on server (gcc 6.2.0).
I had to delete the sources and clone the git repository again as I was unable to get the sources back in sync with latest commits after switching between commits. Thus I lost my config.default. Comparing with config at my home computer I noticed that the default FLAGS have changed, but it did not help with compiling..

simworld.cc: In member function 'void karte_t::destroy()':
simworld.cc:685:2: error: 'cities_to_process' was not declared in this scope
  cities_to_process = 0;
  ^~~~~~~~~~~~~~~~~
simworld.cc:686:2: error: 'step_passengers_delta_t' was not declared in this scope
  step_passengers_delta_t = 0;
  ^~~~~~~~~~~~~~~~~~~~~~~


simworld.cc: In constructor 'karte_t::karte_t()':
simworld.cc:2347:2: error: 'cities_to_process' was not declared in this scope
  cities_to_process = 0;
  ^~~~~~~~~~~~~~~~~
simworld.cc:2348:2: error: 'step_passengers_delta_t' was not declared in this scope
  step_passengers_delta_t = 0;
  ^~~~~~~~~~~~~~~~~~~~~~~

jamespetts

#5
That really is very odd indeed - I do not understand how multiple versions of GCC can produce the same error whereas mine do not. Does anyone have any clues about this at all?

Edit: Incidentally, is MULTI_THREAD = 1 set?

Edit 2: I think that these problems were related to not having MULTI_THREAD = 1 set. If your server is a multi-processor/multi-core machine, I do recommend that you compile it with MULTI_THREAD = 1 set. However, I have now fixed compiling for single threaded builds.
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.

Vladki

Oh yes, MULTI_THREAD=1 solved the problem

server is now running the latest commit

jamespetts

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.

Vladki

I can't compile again: commit 9a7696bc7064aacb52737d236b3165f386768245


simworld.cc: In function 'void* step_individual_convoi_threaded(void*)':
simworld.cc:1699:48: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void'
    convois_next_step[thread_number].is_bound() ? convois_next_step[thread_number]->threaded_step() : true /* do nothing */;
                                                ^

jamespetts

Thank you for the report - I have pushed what I think should be a fix. Can you try this again?
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.

Vladki

I have successfully compiled the last commit on server (3ca46d949e2071631b628604913d388fc4ea650f)

EDIT:
I have noticed that you removed -fpermissive from config.default. So I have tried to recompile without and failed.
Putting -fpermissive back allowed me to finish compilation.


simworld.cc: In function "void* step_individual_convoi_threaded(void*)":
simworld.cc:1708:23: error: invalid conversion from "void (*)()" to "void (*)(void*)" [-fpermissive]
  pthread_cleanup_push(&route_t::TERM_NODES, NULL);
                       ^~

Vladki

Just to bump up, the above error is still there in latest commit (884e5b0ce3fcc11ce210353172f3c1fdaf9488cd)

jamespetts

I am working on this now - it is one of those things that Visual Studio will allow me to compile, but not GCC (at least, not without -fpermissive, which is not advisable). You can still compile with -fpermissive enabled, I trust?

Edit: This should now be fixed on the latest commit.
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.

Vladki

Yes, it compiles now correctly, and also the problem with automatic savegame seems to be gone.

jamespetts

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.