ATARI MiNT cross-compiler for Mac OS X
Based on the latest m68k-atari-mint cross-compiler work of Vincent Rivière (who is providing cygwin binaries on his site),
I have built the gcc cross-compiler with his patches on my computer (Intel iMac, Mac OS 10.7) and make them available here for other Mac OS X users.
The old description on how to build the cross-compiler yourself has been moved here.
If you want to build the cross-compiler yourself, you can checkout the Git repository with my scripts.
The cross-compiler must be installed into the directory /opt/cross-mint
. This directory can be created using the following Terminal commands (which require administrator privileges):
sudo mkdir -p /opt/cross-mint sudo chown $USER /opt/cross-mint
After this initial setup, the binaries can be extracted (with your standard user) using the following command:
tar xvzf m68k-cross-mint-bin-darwin-x86_64-20200621.tgz --directory /opt/
To avoid macOS complaining about unknown binaries, use the following command to clear the quarantine flag:
xattr -d -r com.apple.quarantine /opt/cross-mint
Cross-compiler binary
For simplicity only a single "all included" package m68k-cross-mint is provided here which runs on Apple Silicon based Apple Computers.
- m68k-cross-mint-bin-darwin-arm64-20231022.tgz (arm64 Mac; built on 22nd October 2023 using Xcode 14.3 and macOS 13.4.4)
Contains binutils 2.30, mintbin (29th November 2020), gcc 12 (mint/gcc-12 branch of https://github.com/th-otto/m68k-atari-mint-gcc.git), pml 2.03, mintlib and gemlib (Git master branch as of build date).
Please send me your feedback if you have any problems with the setup or installation.
Previous binary releases can be found here:
- m68k-cross-mint-bin-darwin-x86_64-20200621.tgz (Intel 64-bit Mac; built on 21st June 2020 using Xcode 11.5 and Mac OS 10.15.5)
Contains binutils 2.30, mintbin (CVS of 27th May 2011), gcc 4.6.4, pml 2.03, mintlib (Git of 3rd March 2017) and gemlib (Git of 21st June 2020). - m68k-cross-mint-bin-darwin-i386-20140730.tgz (Intel 64-bit Mac; built on 30th July 2014 using Xcode 5.1 and Mac OS 10.9.4)
Contains binutils 2.24, mintbin (CVS of 27th May 2011), gcc 4.6.4, pml 2.03, mintlib (CVS of 12rd March 2014) and gemlib (CVS of 30th July 2014). - m68k-cross-mint-bin-darwin-i386-20120511.tgz (Intel Mac; built on 11th May 2012)
Contains binutils 2.22, mintbin (CVS of 2th May 2011), gcc 4.6.3, pml 2.03, mintlib (CVS of 3rd May 2012) and gemlib (CVS of 11th May 2012). - m68k-cross-mint-bin-darwin-universal-20100127.tgz (Intel and PowerPC Mac built on 27 January 2010)
Contains binutils 2.20, mintbin 0.3, gcc 4.4.3, pml 2.03, mintlib 0.59.0 (CVS of 23th January 2010), gemlib 0.43.6 (CVS of 27th January 2010) and cflib (CVS of 27th January 2010).
Using the cross-compiler
After installation, you should create/modify your bash profile by enhancing ~/.zprofile
with the following lines:
# m68k-atari-mint cross compiler export PATH=$PATH:/opt/cross-mint/bin export MANPATH=$MANPATH:/opt/cross-mint/share/man
This allows you to use the cross-compiler using m68k-atari-mint-gcc
(or any other tool of it) and query its man pages.
The following simple "hello world" example can be compiled for TOS using the command: m68k-atari-mint-gcc hello.c -o hello.tos
This creates a hello.tos
application which can be run on a TOS compatible system (for example under MacAranym).
#include <stdio.h> int main(int argc, char* argv[]) { puts("Hello, world !"); return 0; }
Using the cross-compiler with Xcode 5
If you really want to use the cross-compiler from within Xcode (=not going down to the most basic Terminal level or using a Terminal based build system with make
), you have to build a Xcode plugin to drive the compilation of the C files.
To do this, follow these steps:
Download the GCC plugin from here: https://code.google.com/p/xcode-gcc-plugin/downloads/list. (No harm should come from this file, as it is a textual description of GCC 4.5 and its options.)
Create a directory
~/Library/Application Support/Developer/Shared/Xcode/Plug-ins
and put the extractedGCC 4.5.xcplugin
into this directory.Open the
GCC 4.5.xcplugin
using the context action to show the content of this package/bundle. Drill down to the Contents/Info.plist file and edit it using your preferred editor.
Add the following lines at the end of the Info.plist file:<key>DVTPlugInCompatibilityUUIDs</key>
<array>
<string>63FC1C47-140D-42B0-BB4D-A10B2D225574</string>
<string>37B30044-3B14-46BA-ABAA-F01000C27B63</string>
<string>640F884E-CE55-4B40-87C0-8869546CAB7A</string>
<string>A2E4D43F-41F4-4FB9-BB94-7177011C9AED</string>
</array>The codes shown above have to be amended everytime a new major version of Xcode is released, otherwise the plugin will not be activated during start-up of Xcode!
Start-up Xcode and open your preferred project (choose "OS X > Applications > Command Line Tool" if you have nothing else to test).
Go to the project settings and you should find now under "Build Settings > Build Options" a choice for GCC 4.5 as shown below:
If you choose this compiler and build the project, the compilation will still fail with an error:
Can't exec '/Applications/Xcode.app/Contents/Developer/usr/bin/gcc-4.5' (No such file or directory)
Go back to the package content of the
GCC 4.5.xcplugin
into theResources/GCC 4.5.xcspec
file.
Here we have to adjust the variable "ExecPath" to be the path and name to our cross-compiler.ExecPath = "/opt/cross-mint/bin/m68k-atari-mint-gcc";
If you go restart Xcode now again and try to build with your cross-compiler, you will probably end up with some unsupported options:
The error message
Unrecognized command line option '-mmacosx-version-min=10.9'
means that you are targeting the OS X 10.9 system and you must change your project settings. Set the "OS X Deployment Target" to "Compiler Default".The error message
Unrecognized command line option '-Wshorten-64-to-32'
means that you have an unsupported option enabled. Go to the project "Build settings" and use the search widget to find the reason by searching for "shorten". Disable the option "Implicit Conversion to 32 Bit Type" which turns up by this search.The error message
Target system does not support the "dwarf-2" debug format
is related to the "Debug Information Format" (where we can only select "DWARF" and "DWARF with dSYM File" and the option "Generate Debug Symbols" = "Yes".
To solve this we have to "hack" the compiler specs again, which will be done as part of the next step.Reopen the
Resources/GCC 4.5.xcspec
file from within the xcplugin file and adjust the following values:Remove unnecessary architectures (as our cross-compiler cannot handle more than 1):
Architectures = (
i386,
);
Adjust the following boolean flags:
SupportsHeadermaps = No;
"DashIFlagAcceptsHeadermaps" = No;
SupportsIsysroot = No;
SupportsZeroLink = No;
"SupportsPredictiveCompilation" = No;
"SupportsSeparateUserHeaderPaths" = No;
"SupportsSymbolSeparation" = No;
"SupportsMacOSXDeploymentTarget" = No;
"SupportsMacOSXMinVersionFlag" = No;
"UseCPlusPlusCompilerDriverWhenBundlizing" = No;
Looking for the following section, we are going to adjust the GCC default debugging format:
Name = "GCC_DEBUG_INFORMATION_FORMAT";
Type = Enumeration;
AllowedValues = (
stabs,
dwarf,
"dwarf-with-dsym",
);
CommandLineArgs = {
dwarf = (
"-gdwarf-2",
);
"dwarf-with-dsym" = (
"-gdwarf-2",
);
"<<otherwise>>" = ();
};
DefaultValue = "stabs";
Condition = "$(GCC_GENERATE_DEBUGGING_SYMBOLS)";
CommonOption = NO;
There are many more options we could fiddle with or tune, but we want a quick result and therefore restart Xcode to test compilation of our Command Line Tool: Major compilation errors are now gone. Errors appear during Linking phase:
m68k-atari-mint-gcc: error: x86_64: No such file or directory m68k-atari-mint-gcc: error: unrecognized option '-arch' Command /opt/cross-mint/bin/m68k-atari-mint-gcc failed with exit code 1
We are now stuck at the linking phase and it seems as if Apple does not support choosing the linker from within a "Drop Down" menu or even overriding the linker specifications from within a "simple plugin" (as the "GCC 4.5.xcplugin" is). The only working way I have currently found, is to copy the
CoreBuildTasks.xcplugin
to your local plugin directory~/Library/Application Support/Developer/Shared/Xcode/Plug-ins
and then modify the fileLd.xcspec
in theContents/Resources
subdirectory and removing the-arch
option:CommandLine = "[exec-path] [options] [special-args] @$(LINK_FILE_LIST_$(variant)_$(arch)) -o $(OutputPath)";
After fixing the unsupported
-arch
option I was stuck at the following fatal error:collect2: ld terminated with signal 11 [Segmentation fault: 11] Command /opt/cross-mint/bin/m68k-atari-mint-gcc failed with exit code 1
After more detailed analysis of the command line option which has been generated by Xcode to link the application, I concluded that there are more options which are not supported:
-filelist
: Disable the "Input file lists" handling completely by commenting the section./*
// Input file lists
{ Name = __INPUT_FILE_LIST_PATH__;
Type = Path;
DefaultValue = "$(LINK_FILE_LIST_$(variant)_$(arch))"; // this is set up for us as a read-only property
CommandLineFlag = "-filelist";
IsInputDependency = Yes;
},
*/
-Xlinker ... -dependency_info
: Disable the "Dependency Info file" handling:DependencyInfoFile = ""; //$(LD_DEPENDENCY_INFO_FILE)";
Finally: YOU ARE DONE. The simple hello world command line tool should now be compiling using your cross-compiler.
There are still a lot of options which could be modified (like the
-isysroot
which is still passed to our cross-compiler), but now you have more or less seen the major parts playing into the compilation and linking phases.
If you have any questions or comments or an even better way to do all this. Please let me know.