English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. C/C++ (http://eab.abime.net/forumdisplay.php?f=118)
-   -   Help with gcc cross-compiling (http://eab.abime.net/showthread.php?t=86864)

MartinW 20 April 2017 14:42

Help with gcc cross-compiling

I've just come back to the Amiga after a couple of years gap. Previously I had an environment set up on my A1200 but TBH, with just a largely vanilla setup it was kinda painful so this time round I thought I'd give in and try cross compiling.

I'm using macOS Sierra (the latest). Are there ANY binary distributions of gcc available to just install via nix or brew or something, or do they all need to be built?

I've read through the thread on the gcc v6 port thats going on at the moment and that was a really interesting read, but is there any preference? I built cahir's gcc toolchain the other night but I'm really not sure that it built correctly. Which leads me to...

Is there some place that explains the different Amiga libs and such in gcc? A tutorial maybe? I was able to build some samples but the lib paths I had to put in to get them to build seemed far more convoluted to me than I would have expected.

As background I've been a developer for 25 years. For my sins I'm currently heavily involved in maintenance of a large Java EE application but in the past have done a lot of C so I need a good chunk of refresher but should be OK once I get going.

I am thinking gcc because I can then use JetBrains CLION IDE and CMake.

wawa 20 April 2017 16:55

like here ?


and here a platform portable equivalent for aros, but should be corrensponding on 68k:


MartinW 20 April 2017 19:09

Not really, no. They're great Amiga resources but don't really do anything to introduce you to cross-compiling from Mac (or Linux since it will be similar), what options / libs you need to use, how the directory structure of the cross-compiler needs to be setup etc.

Samurai_Crow 20 April 2017 19:14

The Python script that was modified to make the GCC 6 port has an option to download and install some software developer kits. It should be like compiling the normal way except you have to run the executables on an Amiga or emulator like FS-UAE on Mac.

wawa 20 April 2017 20:23

i dont remember cahirs version very well, since i have installed it only once as far as i remember, but after you build it (almost) everything should be in place, except maybe for amigaos sdk (or whatever it is called) and particular libs and headers for certain libs you might have to acquire separately.

in case you use bebbos gcc-6.2 the script takes care of everything, including the basic system libs in headers inclusive mui. everything needed to know is contained in the readme and the thread. i advise to install it to user space rather than to /opt, to have straight forward access handling the headers and libs.

other than that i have not very much experience with both these toolchains since i use the aros crosscompiler and build system all the time. have just checked if the native amiga-m68k gcc-4.6.4 it produces works, and a helloworld did, straight away. i assume native 6.3.0 will also work, probably along with the complete toolchain. now, at some point it would be nice to copy over the amiga extensions..

MartinW 20 April 2017 21:30

Thank you for the info. I'll take a look at bebbos gcc. I didn't dig very deep the other night as it was getting late.

Since I'm now at the computer I was working on, here's an example from my attempt with cahirs toolchain:


cmake_minimum_required(VERSION 3.7)
project(gcc_test C)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -noixemul -fbaserel32 -m68020 -msmall-code")


set(SOURCE_FILES main.c)

add_executable(gcc_test ${SOURCE_FILES})
target_link_libraries(gcc_test libnix.a)

Note the double 'm68k-amigaos' and the seemingly double 'libnix' in that path. Just doesn't seem right but there were no instructions or guide so ??? Like I say, a MUI 'Hello World' built fine and ran on FS-UAE just fine. But I didn't really know what I was doing and it all seemed a bit fragile.

One slight oddity was the intellisence in CLion telling me that printf has too many arguments as it was expecting 0 - err??!! But hey!

I will go read up on bebbos gcc later.

oh, PS: no problem installing to /opt. That's non standard for Mac so the only thing that's there is this and I can give it whatever permissions l like :)

wawa 20 April 2017 21:52

im sorry i dont remember details on cahirs build, i only used it for netsurf once afair, but the paths are not necessarily wrong like that, i think. you can certainly adjust that. unfortunatelly i cannot check any further here, all my available space on this surface tablet i have here is eaten up by multiple aros targets inclusive 68k i need to cross check between. :(

MartinW 21 April 2017 14:22

I built the gcc6 toolchain last night. It was late by the time it finished so I've not done anything with it yet but despite the readme saying that it is currently broken on OS X, it built fine. Maybe it does build and something else is broken.

Will try and build the few simple examples that I have.

All times are GMT +2. The time now is 15:02.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.

Page generated in 0.06551 seconds with 11 queries