The International Simutrans Forum

Simutrans Extended => Simutrans-Extended gameplay discussion => Topic started by: Milko on November 02, 2016, 03:07:06 PM

Title: Problem compiling using MinGW
Post by: Milko on November 02, 2016, 03:07:06 PM
Hello

Now I have problem compiling using MingW.

Problem with other compilers?

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: Ves on November 02, 2016, 08:19:46 PM
I am not sure wether that error has anything to do with my patch (nerveusly looking at James....  ::'( )?
Title: Re: Problem compiling using MinGW
Post by: jamespetts on November 02, 2016, 08:32:03 PM
Giuseppe - sorry that you are having trouble. This error is indeed unrelated to Ves's patch. You need a more recent version of MinGW/GCC to compile this, I think, since I am using now the "thread_local" keyword, which is a new addition to C++ (relatively).
Title: Re: Problem compiling using MinGW
Post by: Milko on November 03, 2016, 10:50:40 AM
Thank's James

I will try to upgrade MingW.

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: Ves on December 28, 2016, 03:42:37 PM
I noticed that I had made a typo in the previous version of the signal infowindow. I have fixed that and pushed in this commit: https://github.com/VictorErik/Simutrans-Experimental-Ves/commit/8739bbcf3f21a37185b1e7d7df461ec80c77d271 (https://github.com/VictorErik/Simutrans-Experimental-Ves/commit/8739bbcf3f21a37185b1e7d7df461ec80c77d271)
Also, some initial swedish translations (modifying the original swedish file) to the signal states to see that they works as intended.
Title: Re: Problem compiling using MinGW
Post by: Milko on January 07, 2017, 10:23:11 PM
Hello James

I update MingW. Now I'm able to build simutrans experimental, but Makefile need an update, James could you insert the line for me?:

    CFLAGS +=  -std=gnu++11


I insert CFLAGS between
          LIBS    += -lmingw32
and
        endif
in the block:

# BeOS (obsolete)
  ifeq ($(OSTYPE),beos)
    LIBS += -lnet
  else
    ifneq ($(findstring $(OSTYPE), cygwin mingw),)
      ifeq ($(OSTYPE),cygwin)
        CFLAGS  += -I/usr/include/mingw -mwin32
      else
        ifeq ($(OSTYPE),mingw)
          CFLAGS  += -DPNG_STATIC -DZLIB_STATIC
          LDFLAGS += -static-libgcc -static-libstdc++ -Wl,--large-address-aware
          LIBS    += -lmingw32
        CFLAGS +=  -std=gnu++11
        endif
      endif
      SOURCES += simsys_w32_png.cc
      CFLAGS  += -DNOMINMAX -DWIN32_LEAN_AND_MEAN -DWINVER=0x0501 -D_WIN32_IE=0x0500
      LIBS    += -lgdi32 -lwinmm -lws2_32 -limm32
      # Disable the console on Windows unless WIN32_CONSOLE is set or graphics are disabled
      ifneq ($(WIN32_CONSOLE),)
        LDFLAGS += -mconsole

Thanks.

I attach the makefile I'm using, the difference is only line CFLAGS +=  -std=gnu++11

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 07, 2017, 10:36:33 PM
Thank you for that. I had added these specifications in config.default/config.template instead. Do you think that they need to be in the makefile instead?
Title: Re: Problem compiling using MinGW
Post by: Milko on January 07, 2017, 11:03:11 PM
Hello James

I think yes, but I need to try. Do you push the update?

Thanks
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 07, 2017, 11:05:51 PM
I have not done that yet; may I ask the reason that you think that it is necessary to have this in the makefile itself rather than config.default?
Title: Re: Problem compiling using MinGW
Post by: Milko on January 07, 2017, 11:09:35 PM
Hello James

In config.template, the line
FLAGS = -fno-delete-null-pointer-checks -fno-strict-aliasing -std=gnu++11
work (without modifing makefile).

But attention, is -std=gnu++11, not -std=c++11

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 07, 2017, 11:16:25 PM
I had already modified config.template to contain the line necessary to make it work (and it does work for me); did my modification not work for you? The config.template file thus modified should already be on Github.
Title: Re: Problem compiling using MinGW
Post by: Milko on January 19, 2017, 04:43:08 PM
Hello James

Quote from: jamespetts on January 07, 2017, 11:16:25 PM
I had already modified config.template to contain the line necessary to make it work (and it does work for me); did my modification not work for you? The config.template file thus modified should already be on Github.

I make new test.

I's ok to modifiy only config.template, but in this mode:

1)
FLAGS = -fno-delete-null-pointer-checks -fno-strict-aliasing -std=c++11
does'nt work for me, but works the line below
FLAGS = -fno-delete-null-pointer-checks -fno-strict-aliasing -std=gnu++11
Could you test if second line work for you?

2)
I have to comment:
#MULTI_THREAD = 1 # Enable multithreading

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 19, 2017, 11:45:55 PM
Sorry that you are having difficulty. I have split this from the topic about Ves's patch, as it is unrelated to that.

Thank you for letting me know the issue with the gnu++11 rather than c++11: that was my error in config.template, I think: in my actual Linux compile, it is indeed set to gnu++11. I have decided to put this specification in the actual makefile after all to avoid any possible confusion with editing config.template.

Incidentally, what happens if you do not comment out MULTI_THREAD = 1? Multi-threading can make a significant difference to performance now (and a single-threaded build can no longer stay in sync with a multi-threaded server in Experimental).
Title: Re: Problem compiling using MinGW
Post by: Milko on January 23, 2017, 03:46:50 PM
Hello James

Actually (github 22/01/2017 version) I have this error and I'm unable to test. May be related to last modify to makeobj besch -> desc?

Giuseppe

Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 23, 2017, 09:32:04 PM
My apologies for the error. I think that I have found and fixed the problem; would you be able to re-test?
Title: Re: Problem compiling using MinGW
Post by: Milko on January 24, 2017, 11:04:17 AM
Hello James

Now similar problem on other file: file export_desc.o

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 24, 2017, 11:19:37 AM
My apologies for the difficulties. I think that I have fixed it now; would you be able to re-test?
Title: Re: Problem compiling using MinGW
Post by: Milko on January 24, 2017, 11:33:58 AM
Hello James

Now compile ok.

But using MULTI_THREAD = 1 # Enable multithreading problem I get an error (see the attach image).

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 24, 2017, 11:39:25 AM
May I ask what version of MinGW that you are using?
Title: Re: Problem compiling using MinGW
Post by: Milko on January 24, 2017, 12:59:49 PM
Hello James

Fresh install 1 month ago.

Giuseppe
Title: Re: Problem compiling using MinGW
Post by: jamespetts on January 24, 2017, 01:02:18 PM
There are two different branches of MINGW, however, one of which is now very out of date and does not handle multi-threading very well; are you using the newer MINGW32?