Giter VIP home page Giter VIP logo

m68k-atari-mint-cross-tools's Introduction

m68k-atari-mint cross compiler scripts for macOS

This is a collection of Makefiles I'm using to build the m68k-atari-mint cross-compiler tools for macOS based on Vincent Rivières cross-tools description. The cross-compiler can be used to develop applications for the Atari ST and compatible systems. It is based on the works of the FreeMiNT project

The collection consists of the following:

Host tools:

  • GNU Binutils: assembler and linker
  • MiNTbin: supplemental MiNT specific tools for the GNU Binutils
  • GNU Compiler Collection (GCC): the C and C++ compiler, which depends on the following libraries:
    • GMP is the GNU Multiple Precision Arithmetic Library
    • MPFR is the GNU Multiple-precision floating-point rounding library, which depends on GMP.
    • MPC is the GNU Multiple-precision C library, which depends on GMP and MPFR.

Target libraries and applications:

  • MiNTLib which is the standard C library for FreeMiNT
  • PML, portable math library for C programs for FreeMiNT
  • GEMlib GEM bindings for writing GEM apps (=library to access AES and VDI layers)
  • CFLib GEM utility library (used by QED)
  • QED GEM text editor, a good test application to check the cross-compiler

Prerequisites

To use the Makefiles, you will have to install:

The scripts/Makefiles are automatically going to download the required sources and MiNT specific patches from Vincents page. For a few parts, I had to adjust the patches respectively write macOS specific patches. Those are stored in the archive folder.

GCC depends on three additional libraries (GMP, MPFR and MPC). As we want to statically link them to the compiler, they are also automatically built and stored in the gcclibs subfolder.

Goal

The goal of this package/bundle of scripts is to have a single command to build and install the whole cross-compiler tools.

The tools are installed in the /opt/cross-mint folder. You need administration rights to create this directory on your system.

Build

First, ensure that the /opt/cross-mint directory exists and is writable by your user.

To create the directory and take full ownership of it, you can use the following commands:

sudo mkdir -p /opt/cross-mint
sudo chown $USER /opt/cross-mint

To build and install the cross-compiler toolset, you should simply checkout this repository to a local folder and type make:

git clone https://github.com/pd95/m68k-atari-mint-cross-tools.git m68k-atari-mint
cd m68k-atari-mint
make

This will build and install the tool in /opt/cross-mint and will produce a "distribution package" in the packages directory.

Known problems

On older macOS versions (e.g. macOS Sierra 10.13) where the tar command is unable to extract bz2 or lz compressed files, you will encounter the error message tar: Unrecognized archive format while gcclibs is being executed.

To fix this you have to install gnu-tar and lzip using brew:

brew install gnu-tar lzip

Usage

To use the cross-compiler, you will have to add the compiler binary/manual pages location to your search path:

export PATH=$PATH:/opt/cross-mint/bin
export MANPATH=$MANPATH:/opt/cross-mint/share/man

Here is a primitive TOS program

hello.c:

#include <stdio.h>

int main(int argc, char* argv[])
{
    puts("Hello, world !");
    return 0;
}

It can be compiled with the command:

m68k-atari-mint-gcc hello.c -o hello.tos

Here is a simple AES test application:

alert.c:

#include <gem.h>

int main()
{
    appl_init();
    form_alert( 1, "[1][Hi there!][[Hi!|B[ye!]" );
    appl_exit();
    return 0;
}

which can be compiled with

m68k-atari-mint-gcc alert.c -lgem -o alert.prg

m68k-atari-mint-cross-tools's People

Contributors

niepiekm avatar pd95 avatar thefakemontyontherun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

m68k-atari-mint-cross-tools's Issues

HTTP mintbin return 404

Hi,

It seems that the link used for mintbin is dead and replaced by another one.
Here the error I've got:

curl -O -f "http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/mintbin-CVS-20110527.tar.gz" ; else echo "** Patch file mintbin-CVS-20110527.tar.gz already load." ; fi
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
make[2]: *** [fetch] Error 22

I think may be the new link should be http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/mintbin-Git-20201129.tar.gz

If you use the right link you'll then get a build error:

gcc -arch x86_64 -DHAVE_CONFIG_H -I. -I../../mintbin-Git-20201129/lib -I.. -I../../mintbin-Git-20201129 -I../../mintbin-Git-20201129/lib -I.. -I../intl -I../../mintbin-Git-20201129/intl    -D_POSIX_SOURCE -Wno-implicit-function-declaration -MT error.o -MMD -MP -MF .deps/error.Tpo -c -o error.o ../../mintbin-Git-20201129/lib/error.c
../../mintbin-Git-20201129/lib/error.c:93:31: error: use of undeclared identifier 'sys_nerr'
  if (errnum > 0 && errnum <= sys_nerr)
                              ^
../../mintbin-Git-20201129/lib/error.c:94:20: error: use of undeclared identifier 'sys_errlist'
    return (char *)sys_errlist[errnum];

So it may be related to libc:

* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
  are no longer available to newly linked binaries, and their declarations
  have been removed from from <stdio.h>.  They are exported solely as
  compatibility symbols to support old binaries.  All programs should use
  strerror or strerror_r instead.

I guess a new patch need to be done.

GCC internal error

Hi, the g++ built with this repo hit an internal error while building the https://github.com/mooli/openkick.git

during RTL pass: expand
src/exec/debugger.cpp: In member function 'virtual void exec::Formatter::output_repeat(char, size_t)':
src/exec/debugger.cpp:69:15: internal compiler error: in invalid_rtx_rtx_rtx_rtx, at config/m68k/sync.md:129
69 | output(buffer, buffer + outputsize);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See https://gcc.gnu.org/bugs/ for instructions.
make: *** [src/exec/debugger.o] Error 1

Makefile fails to detect compilers...that are present

Hello!
This project seems very nice, but it fails to detect the working compilers:

checking whether /Users/monty/gnu-tools/m68000/bin/m68k-atari-mint-gcc is gcc... yes
checking compiler /Users/monty/gnu-tools/m68000/bin/m68k-atari-mint-gcc -m32 -O2 -pedantic -fomit-frame-pointer ... no
checking compiler /Users/monty/gnu-tools/m68000/bin/m68k-atari-mint-gcc -O2 -pedantic -fomit-frame-pointer ... no, program does not run
configure: error: could not find a working compiler, see config.log for details
make[1]: *** [/Users/monty/git/m68k-atari-mint-cross-tools/compile/gmp-6.2.0-bin-darwin-x86_64/Makefile] Error 1
make: *** [/Users/monty/git/m68k-atari-mint-cross-tools/archive/gcclibs/i386] Error 2

Meanwhile, I'm pretty capable of calling (with the exception of the parameter -m32 not being supported).

MontyMacBookAir% ~/gnu-tools/m68000/bin/m68k-atari-mint-gcc                                                                                                                                                               on branch master
m68k-atari-mint-gcc: fatal error: no input files
compilation terminated.
MontyMacBookAir% /Users/monty/gnu-tools/m68000/bin/m68k-atari-mint-gcc -m32 -O2 -pedantic -fomit-frame-pointer                                                                                                            on branch master
m68k-atari-mint-gcc: error: unrecognized command line option '-m32'
m68k-atari-mint-gcc: fatal error: no input files
compilation terminated.
MontyMacBookAir% /Users/monty/gnu-tools/m68000/bin/m68k-atari-mint-gcc -O2 -pedantic -fomit-frame-pointer                                                                                                                 on branch master
m68k-atari-mint-gcc: fatal error: no input files
compilation terminated.

This is MacOS Mojave 10.14.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.