Hello,

It looks like the current netsurf buildsystem isn't able to compile
correct executables for the atari target, this is especially bad when running
on coldfire, where the build failure results in illegal instructions
(when m68k CPU emulation is turned off).
(the sdk build maybe suffers the same problem, but that's another story)

On my local box I use Verbose mode of make, to see the actual compiler commands.

Let's have a look at the atari support within the netsurf buildsystem:

--- snip ---

# FreeMiNT / atari
ifeq ($(TARGET),atari)
  ifeq ($(HOST),atari)
    # Building on FreeMiNT
    # Nothing to do, as we assume the default tooling works
  else
    # Cross compiling for FreeMiNT

    ATARIARCH ?= 68020-60

    GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-atari-mint
    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-atari-mint/cross/bin
    CC__ := $(GCCSDK_INSTALL_CROSSBIN)/m68k-atari-mint-gcc
    CXX__ := $(GCCSDK_INSTALL_CROSSBIN)/m68k-atari-mint-g++
    AR__ := $(GCCSDK_INSTALL_CROSSBIN)/m68k-atari-mint-ar

    ifeq ($(ATARIARCH),68000)
       ARCHFLAGS :=
       ARCHDIR :=
    endif
    ifeq ($(ATARIARCH),68020-60)
       ARCHFLAGS := -m$(ATARIARCH)
       ARCHDIR := /$(ATARIARCH)
    endif
    ifeq ($(ATARIARCH),v4e)
       ARCHFLAGS := -mcpu=5475
       ARCHDIR := /m5475
    endif

CFLAGS := $(CFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include $(ARCHFLAGS) CXXFLAGS := $(CXXFLAGS) -U__STRICT_ANSI__ -I$(GCCSDK_INSTALL_ENV)/include $(ARCHFLAGS)
    LDFLAGS := $(LDFLAGS) -L$(GCCSDK_INSTALL_ENV)/lib$(ARCHDIR)

    PREFIX ?= $(GCCSDK_INSTALL_ENV)
  endif
endif

--- snip ---

First thing to notice is the fact that it assumes you do pass the environment variable ATARIARCH to specify the CPU type. If you do not specify this variable, the cpu defaults to 68020-60, which
is definitly wrong for coldfire compilation.

I'm assuming that the netsurf build system does not set ATARIARCH.
I'm open for suggestions, how to specify and resolve the CPU type differently, of course.

Also look at the output of libcss build:
http://ci.netsurf-browser.org/jenkins/job/libcss/TARGET=m5475-atari-mint,label=other/86/consoleText

You can not see which compiler was used. You can not see which CFLAGS/LDFLAGS where used.

Second thing to notice is the fact that it assumes the m68k-atari-mint toolchain to be used:
    CC__ := $(GCCSDK_INSTALL_CROSSBIN)/m68k-atari-mint-gcc
    CXX__ := $(GCCSDK_INSTALL_CROSSBIN)/m68k-atari-mint-g++
    AR__ := $(GCCSDK_INSTALL_CROSSBIN)/m68k-atari-mint-ar

When compiling for coldfire (the way it was meant to be: by setting ATARIARCH) it will fail to find the compiler because the m68k-atari-mint compiler is not located in the coldfire sdk dirs.

Of course the script could be adjusted like this:
    ifeq ($(ATARIARCH),v4e)
       ARCHFLAGS := -mcpu=5475
       ARCHDIR := /m5475
       CC__ := $(GCCSDK_INSTALL_CROSSBIN)/m5475-atari-mint-gcc
       CXX__ := $(GCCSDK_INSTALL_CROSSBIN)/m5475-atari-mint-g++
       AR__ := $(GCCSDK_INSTALL_CROSSBIN)/m5475-atari-mint-ar
    endif

But that would mean, that the average buildsystem user is not able to compile netsurf on his own box, when he doesn't want to use the m5475-atari-mint-xxx provided by the netsurf sdk build.

As an example, just take this simple make command and see how it fails:

/media/src/netsurf.git/libnsgif$ GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/m5475-atari-mint/cross/bin GCCSDK_INSTALL_ENV=/opt/netsurf/m5475-atari-mint make TARGET=atari ATARIARCH=v4e /bin/sh: /opt/netsurf/m5475-atari-mint/cross/bin/m68k-atari-mint-gcc: not found /bin/sh: /opt/netsurf/m5475-atari-mint/cross/bin/m68k-atari-mint-gcc: not found /opt/netsurf/m5475-atari-mint/share/netsurf-buildsystem/makefiles/Makefile.tools:466: *** Unable to detect toolchain. Schluss.

Using m68k-atari-mint-gcc to compile atari coldfire software is de facto standard and I don't want to explain people that things are different with netsurf ;) However, if this is the only way to implement clean coldfire support in the netsurf
buildsystem, I'm happy to take that pill.

Can we add the ATARIARCH environment variable, like it is done for the netsurf build?
Valid values:

ATARIARCH=68020-60
ATARIARCH=v4e

The coldfire build will be broken then (look at the example above), because it won't be able to find the toolchain (except it is explicitly set), however, when that happens, I probably already fixed the toolchain names for coldfire within the makefile.







Reply via email to