Author Topic: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)  (Read 2416 times)

0 Members and 1 Guest are viewing this topic.

Offline Simon Small

Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« on: February 09, 2014, 10:42:21 AM »
The configuration options in Makefile and config files offer selection of OS, but not of Architecture. This may not have been a problem in the past, but might become so in the future. I also note a few posts regarding 32 / 64 bit systems.

When I set the OS to Linux, the Makefile includes "-minline-all-stringops" which is X86 specific. I have 'fixed' my Makefile to be able to compile on ARM by commenting out that line, but I don't have the skills to offer a more long term solution. The lines affected are:

Code: [Select]
ifneq ($(OPTIMISE),)
    CFLAGS += -O3
    ifneq ($(OSTYPE),mac)
        ifneq ($(OSTYPE),haiku)
            ifneq ($(OSTYPE),amiga)
                CFLAGS += -minline-all-stringops
            endif
        endif
    endif
else
    CFLAGS += -O
endif

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4633
  • Total likes: 168
  • Helpful: 107
  • Languages: EN, NO
Re: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« Reply #1 on: February 09, 2014, 12:27:47 PM »
A selection of non-x86 platform should also force USE_C. Things will become more difficult if we need to port the assembly code to ARM as well. (x64 builds don't seem to miss the handoptimized assembly code, so that might not be an issue.)

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8725
  • Total likes: 303
  • Helpful: 228
  • Languages: De,EN,JP
Re: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« Reply #2 on: February 10, 2014, 12:09:36 PM »
x64 would miss it, but then those builds are anyway not provided. Same as ARM, btw ...

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4633
  • Total likes: 168
  • Helpful: 107
  • Languages: EN, NO
Re: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« Reply #3 on: February 10, 2014, 03:32:08 PM »
x64 would miss it, but then those builds are anyway not provided. Same as ARM, btw ...

I guess the issue here is providing those, even if not as official releases. x64 builds of Simutrans seems to have become more widespread since I first got it to run, although possibly limited to Linux.

Offline Simon Small

Re: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« Reply #4 on: February 10, 2014, 08:05:25 PM »
I raised this issue because I tried to compile and hit a problem that I thought has a simple solution for others (i.e. change your own Makefile). I have a running version of the game that I got from the Linux repositories as a package, that I assume does not have to come from the Simutrans community. What I think we need to do is to provide the compile instructions so others can compile, rather than providing compiled binaries. Improving the Makefile would be a way to make the compile process a little simpler. I only wish that I knew more about compiling and Makefiles so I could do it myself

I also hit a problem with USE_C now you mention it. It seems to get set and unset in the code (simgraph16.cc), so it is not as simple as setting something in the Makefile (again, a bit beyond me)

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4633
  • Total likes: 168
  • Helpful: 107
  • Languages: EN, NO
Re: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« Reply #5 on: February 10, 2014, 08:29:36 PM »
I'm not sure why USE_C is unset then immediately defined again. It might be to avoid redefinition warnings/errors. In any case, if it is set, it ends up set. If it isn't set, it might end up set anyway, such as for x64 as well as non-GCC.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4201
  • Total likes: 157
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Makefile problem compiling on Linux + ARM (e.g. Raspberry Pi)
« Reply #6 on: February 10, 2014, 08:58:43 PM »
USE_C can be set by Makefile, no need to worry about simgraph6.cc. Compiling will issue a more or less senseless warning.
Parsley, sage, rosemary, and maggikraut.