English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 20 April 2017, 13:42   #1
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
Help with gcc cross-compiling

Hello,

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.
MartinW is offline  
Old 20 April 2017, 15:55   #2
wawa
Registered User
 
Join Date: Aug 2007
Location: berlin/germany
Posts: 1,054
like here ?

http://amigadev.elowar.com/

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

http://aros.sourceforge.net/document...pers/autodocs/
wawa is offline  
Old 20 April 2017, 18:09   #3
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
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.
MartinW is offline  
Old 20 April 2017, 18:14   #4
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,188
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.
Samurai_Crow is offline  
Old 20 April 2017, 19:23   #5
wawa
Registered User
 
Join Date: Aug 2007
Location: berlin/germany
Posts: 1,054
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..
wawa is offline  
Old 20 April 2017, 20:30   #6
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
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:

Code:
cmake_minimum_required(VERSION 3.7)
project(gcc_test C)

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

set(CMAKE_C_STANDARD 90)

link_directories(/opt/m68k-amigaos/m68k-amigaos/libnix/lib/libnix)
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

Last edited by MartinW; 20 April 2017 at 20:35. Reason: spelling
MartinW is offline  
Old 20 April 2017, 20:52   #7
wawa
Registered User
 
Join Date: Aug 2007
Location: berlin/germany
Posts: 1,054
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.
wawa is offline  
Old 21 April 2017, 13:22   #8
MartinW
Registered User
 
Join Date: Mar 2017
Location: Minehead / UK
Posts: 608
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.
MartinW is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross compiling to the Amiga with Sozobon RedskullDC Coders. Language 2 08 December 2016 03:25
Cross Compiling / Environment Info Zetr0 Coders. General 10 09 November 2016 20:28
cross-compiling Basic for Amiga nitrofurano Coders. Language 4 19 November 2013 20:47
cross dos Dave_wb support.Hardware 15 27 March 2005 18:04
cross dos help fastflange request.Apps 2 19 June 2002 17:56

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:00.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13171 seconds with 13 queries