I have been compiling some command line programs to run on the classic Commodore Amiga. I started with GCC on WinUAE which worked but I realised I didn't have the understanding of the memory stack and more to avoid difficulties ("software failure" crashes) presumably due to me not being careful with the limited resources. I then thought about cross-compiling instead using a host with more resources, installed CygWin on Windows, but eventually settled on Raspbian on a Pi and different flavo(u)rs of GCC following what I was reading online.
From Google and this below from here on Retrocomputing Stack Exchange:
Are there any modern compilers that can generate Amiga/m68k executables?
I could see much appreciation for this GCC set with Amiga output support:
https://github.com/bebbo/amiga-gcc
Using the created m68k-amigaos-gcc / m68k-amigaos-c++ / m68k-amigaos-cpp worked great š for simple programs tried so far. I'm on the learning curve with make / cmake from others' more complex code and amended CMakeLists.txt / CMakeCache.txt to the appropriate paths for the alternative Amiga compilers but making steady progress.
There is a C++ program I'd like to try cross-compiling that has some dependencies that use Fortran (it's doing some data processing.) I can build and run it in Raspbian, but Bebbo's amiga-gcc doesn't have a Fortran compiler (understandable as it's rather niche) so I can't make an Amiga version this way. I then found this other GCC "with M68K regparm support" which does seem to contain a Fortran compiler but I'm not clear if this is what I want:
https://github.com/mooli/gcc-amiga/
I'm struggling how to configure the build of this GCC for an Amiga target without more specific documentation - commenters on Github have already asked for details on functionality and how to build. Trying with a target listed in the documentation but no other arguments:
../configure --target=m68k-elf
../../gcc/config/m68k/m68k.c:1514:21: error: āmodeā was not declared in this scope; did you mean āPmodeā?
1514 | return gen_rtx_REG(mode, reg);
| ^~~~
| Pmode
../../gcc/config/m68k/m68k.c: In function āvoid m68k_function_arg_advance(cumulative_args_t, const function_arg_info&)ā:
../../gcc/config/m68k/m68k.c:1528:8: error: no match for āoperator+=ā (operand types are āCUMULATIVE_ARGSā {aka ām68k_argsā} and ālong long intā)
1528 | *cum += (arg.promoted_size_in_bytes () + 3) & ~3;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../gcc/config/m68k/m68k.c: In function ātree_node* m68k_handle_cconv_attribute(tree_node**, tree, tree, int, bool*)ā:
../../gcc/config/m68k/m68k.c:358:7: warning: control reaches end of non-void function [-Wreturn-type]
358 | sorry("m68k_handle_cconv_attribute saw unexpected attribute %qE", name);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:2404: m68k.o] Error 1
make[2]: Leaving directory '/home/pi/gcc-amiga/objdir/gcc'
make[1]: *** [Makefile:4428: all-gcc] Error 2
make[1]: Leaving directory '/home/pi/gcc-amiga/objdir'
make: *** [Makefile:957: all] Error 2
and troubleshooting this may be beyond me.
I also spotted GCC with Fortran running directly on Amiga PowerPC / OS4, but I wanted to stick with M68k era. https://www.amigans.net/modules/newbb/viewtopic.php?post_id=111858 I also briefly looked at converting the Fortran into something else, but that may not be the easiest path either.
So after all that, are there any pointers or suggestions for how to generate classic Amiga executables from C++/Fortran code. Should I stick with cross compiling, or go back to compiling direct on the machine or WinUAE? Or am I reaching too far? Thank-you.