English Amiga Board


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

 
 
Thread Tools
Old 11 January 2019, 01:22   #1021
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,405
Quote:
Originally Posted by bebbo View Post
For those interested in my recent versions, I am providing now


Both do contain some stuff not yet on github...


Does anyone know if these all in one downloads are kept up to date with GitHub?

Thanks
NovaCoder is offline  
Old 11 January 2019, 10:36   #1022
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by NovaCoder View Post
Does anyone know if these all in one downloads are kept up to date with GitHub?

Thanks
Linux and Windows versions are built daily.
bebbo is offline  
Old 11 January 2019, 11:00   #1023
NovaCoder
Registered User
 
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,405
Cool, thanks
NovaCoder is offline  
Old 13 January 2019, 23:39   #1024
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Code:
m68k-amigaos-gcc version 6.5.0b 20190113225614 (GCC)
-flto should work now

PS:
Does this thread need a rename?
bebbo is offline  
Old 14 January 2019, 00:07   #1025
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
Quote:
Originally Posted by bebbo View Post
Code:
m68k-amigaos-gcc version 6.5.0b 20190113225614 (GCC)
-flto should work now

PS:
Does this thread need a rename?
Niiiice!!!
alpine9000 is offline  
Old 14 January 2019, 06:58   #1026
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,773
Quote:
Originally Posted by bebbo View Post
Linux and Windows versions are built daily.
Still willing to help with the Mac port if needed.
Hewitson is offline  
Old 15 January 2019, 00:05   #1027
Marlon_
AmigaDev.com
 
Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Stockholm, Sweden
Age: 35
Posts: 625
@bebbo Any chance of getting libatomic included?

EDIT:
Managed to compile it from your gcc repo.

Last edited by Marlon_; 15 January 2019 at 00:35.
Marlon_ is offline  
Old 15 January 2019, 08:07   #1028
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by Marlon_ View Post
@bebbo Any chance of getting libatomic included?

EDIT:
Managed to compile it from your gcc repo.

libatomic is already in there
bebbo is offline  
Old 15 January 2019, 10:23   #1029
Marlon_
AmigaDev.com
 
Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Stockholm, Sweden
Age: 35
Posts: 625
Quote:
Originally Posted by bebbo View Post

libatomic is already in there
Huh? It was saying it was missing when I tried to compile something that required it. So I compiled it by myself... I recompiled the toolchain about a month ago.

EDIT:
Code:
$ find /opt/m68k-amigaos/m68k-amigaos/ |grep atomic
/opt/m68k-amigaos/m68k-amigaos/sys-include/stdatomic.h
Marlon_ is offline  
Old 15 January 2019, 10:43   #1030
bebbo
bye
 
Join Date: Jun 2016
Location: Some / Where
Posts: 680
Quote:
Originally Posted by Marlon_ View Post
Huh? It was saying it was missing when I tried to compile something that required it. So I compiled it by myself... I recompiled the toolchain about a month ago.

EDIT:
Code:
$ find /opt/m68k-amigaos/m68k-amigaos/ |grep atomic
/opt/m68k-amigaos/m68k-amigaos/sys-include/stdatomic.h
try
Code:
find /opt/m68k-amigaos/ |grep atomic
bebbo is offline  
Old 15 January 2019, 11:45   #1031
Marlon_
AmigaDev.com
 
Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Stockholm, Sweden
Age: 35
Posts: 625
Quote:
Originally Posted by bebbo View Post
try
Code:
find /opt/m68k-amigaos/ |grep atomic
Odd, it is there (besides the one I compiled). It wasn't working before, but now it just accepts -latomic. lol
Nevermind then.
Marlon_ is offline  
Old 21 January 2019, 08:12   #1032
pipper
Registered User
 
Join Date: Jul 2017
Location: San Jose
Posts: 664
I got LTO working with ScummVM.

After a bit of digging I found a change that was surprisingly simple.
LTO with the gcc toolchain on Amiga currently does not deal with .a files.
As Bebbo suggested, we need to prevent ScummVM from building .a's and linking them into the executable. Instead link all individual .o files:
https://github.com/mheyer32/scummvm-...31ae49df5b1c1e
Maybe this helps others with their ScummVM ports as well.

The executable shrunk by almost 500kb. Not as much as I hoped for, but nevertheless a really good gain for 'just flicking a switch' :-)
It seems like it may even run faster, but that could be just placebo - I did not do measurements.

Thanks for all the good work, Bebbo!!
pipper is offline  
Old 21 January 2019, 21:49   #1033
Megatron-UK
Registered User
 
Join Date: Aug 2009
Location: UK
Posts: 30
Hi,

I'm trying to get started with this cross compile toolchain and I'm struggling to find various bits and pieces that I'm used to on other platforms where GCC is available with a vaguely posix-like libc.

I'm developing primarily on Linux using GCC 7.3.0 and am already testing on TOS using the GCC 8.2.1 m68k-atari-mint toolchain from http://tho-otto.de/crossmint.php and have some code up and running using libSDL on a basic emulated ST class machine using Hatari (still to test using my actual 520 STE, but hey ho)... and I wanted to try and get the same codebase running on Amiga OS (and later, Risc OS).

I've got the latest pre-compiled Linux release unpacked to /opt/amiga, but I'm struggling to work out which c libraries and include files I need to point at in order to get some basic directory/file operation type stuff working.

I'm looking for what I need to set my include path to in order to get <dirent.h> and associated directory routines such as readdir() and opendir().

The includes for standard unix-type platforms for the code which breaks looks like:

Code:
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <dirent.h>
#include <sys/types.h>
... and I include these additions for GCC on Atari TOS:

Code:
#ifdef TOS
#include <unistd.h>
#include <sys/stat.h>
#endif
In my code I can then switch in a posix-type check on directory entry, or one which works on TOS via a stat() call:

Code:
#ifdef POSIX
				if (ep->d_type == DT_REG){
#endif
#ifdef TOS
				stat(filename, &stat_buf);
				if (S_ISREG(stat_buf.st_mode) != 0){
#endif
... and of course, stat(), opendir() and readdir() which get and read those data structures are available on both.

The standard include and library paths for what I assume would be the standard c library with this toolchain don't appear to have a <dirent.h> header:

Code:
/opt/amiga/bin/m68k-amigaos-gcc -Wall -Wno-unused-function -Os -I/opt/amiga/m68k-amigaos/include  -DAMIGAOS -DDIR_SEP=\"/\" -DGAMEDIR=\"./GAMES\" -DCSV_FILE=\"MENU.CSV\" -DLOGGING=   -c -o src/gamedata.o src/gamedata.c
In file included from /opt/amiga/m68k-amigaos/sys-include/dirent.h:7:0,
                 from src/gamedata.c:4:
/opt/amiga/m68k-amigaos/sys-include/sys/dirent.h:10:2: error: #error "<dirent.h> not supported"
 #error "<dirent.h> not supported"
  ^~~~~
... and other bits and bobs like missing definitions for DIR.

Some of these symbols and defines are present in the 'clib' and 'libnix' sub-directories, but I don't know how they relate to building something with the vanilla libc and I assume that it will end badly trying to use part of one c libary and bits of another!

Where should I be looking at in the various c libraries to get more or less the same functionality as I'm using above for unix/linux/posix and TOS?
Megatron-UK is offline  
Old 22 January 2019, 08:22   #1034
pipper
Registered User
 
Join Date: Jul 2017
Location: San Jose
Posts: 664
You don't need to supply any include paths to the compiler, it has a built-in list of include paths.

The gcc toolchain actually comes with 3 libc like implementations
1) 'newlib' which is the default, no additional commandline parameter needed
2) 'noixemul' which is enabled supplying '-noixemul' during compiling and linking
3) 'clib2' which is enabled by supplying '-mcrt=clib2' during compiling and linking

More info here:
https://github.com/bebbo/amiga-gcc/wiki/Libraries
pipper is offline  
Old 22 January 2019, 10:11   #1035
Megatron-UK
Registered User
 
Join Date: Aug 2009
Location: UK
Posts: 30
Wow! Thank you for that pointer. I'm not used to that type of operation with GCC, several decades of setting include and library locations via CFLAGS and LDFLAGS are hardcoded in my brain

My code does now compile without error - I have lots of warnings compared to GCC 7.x and 8.x, but I can work on that later.

My full makefile now looks like:

Code:
# Names of the compiler and friends
CC = /opt/amiga/bin/m68k-amigaos-gcc
STRIP = /opt/amiga/bin/m68k-amigaos-strip

# libraries and paths
APP_LIB = -L/opt/amiga/m68k-amigaos/lib -lSDL -ldebug
APP_INCLUDE = 

# Compiler flags
CFLAGS = -Wall -Wno-unused-function -mcrt=nix13 -noixemul -Os $(APP_INCLUDE) -DAMIGAOS -DDIR_SEP=$(DIR_SEP) -DGAMEDIR=$(GAMEDIR) -DCSV_FILE=$(CSV_FILE) -DLOGGING=$(LOGGING)
LINK_CFLAGS = -Wall -Wno-unused-function -mcrt=nix13 -Os
APP_LDFLAGS = $(APP_LIB)

# What our application is named
EXE = menu.amiga

include Makefile.common 
OBJFILES = src/bmp2text.o src/csvlib.o src/gamedata.o src/menu.o
all: $(EXE)

$(EXE):  $(OBJFILES)
	$(CC) $(LINK_CFLAGS) -o $(EXE) $(OBJFILES) $(APP_LDFLAGS)
	$(STRIP) --strip-all $(EXE)
	$(STACKMOD)
	
menu.o: src/menu.c
	$(CC) -c $(CFLAGS) $< -o src/$@
	
bmp2text.o: src/bmp2text.c
	$(CC) -c $(CFLAGS) $< -o src/$@

gamedata.o: src/gamedata.c
	$(CC) -c $(CFLAGS) $< -o src/$@

csvlib.o: src/csvlib.c
	$(CC) -c $(CFLAGS) $< -o src/$@
	
clean:
	rm -f src/*.o src/*.a $(EXE) core
... ignore $(STACKMOD), it's a utility that increases or decreases the stack allocation size of a TOS binary - the default of 64kbyte wasn't enough to get my libSDL functions to run correctly.

Interestingly the resultant binary is a good 120kbytes smaller than the TOS version which is still using a.out format, and, I guess, the size of the libc implementation using libnix.

Next to see how far it runs before blowing up - I'm sure it won't run first time
Megatron-UK is offline  
Old 22 January 2019, 10:30   #1036
Marlon_
AmigaDev.com
 
Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Stockholm, Sweden
Age: 35
Posts: 625
Quote:
Originally Posted by Megatron-UK View Post

Code:
# Compiler flags
CFLAGS = -Wall -Wno-unused-function -mcrt=nix13 -noixemul -Os $(APP_INCLUDE) -DAMIGAOS -DDIR_SEP=$(DIR_SEP) -DGAMEDIR=$(GAMEDIR) -DCSV_FILE=$(CSV_FILE) -DLOGGING=$(LOGGING)
LINK_CFLAGS = -Wall -Wno-unused-function -mcrt=nix13 -Os
Don't mix -mcrt=nix13 and -noixemul, nix13 is only useful for development for Kickstart 1.3, and I believe one or the other overrides eachother. It's better to just choose one. I'd suggest to just go with -noixemul
Marlon_ is offline  
Old 22 January 2019, 11:09   #1037
Megatron-UK
Registered User
 
Join Date: Aug 2009
Location: UK
Posts: 30
Quote:
Originally Posted by Marlon_ View Post
Don't mix -mcrt=nix13 and -noixemul, nix13 is only useful for development for Kickstart 1.3, and I believe one or the other overrides eachother. It's better to just choose one. I'd suggest to just go with -noixemul
Will a binary compiled with -noixemul still run on ks1.3? I'd like to target the 500 as well.
Megatron-UK is offline  
Old 22 January 2019, 11:10   #1038
Marlon_
AmigaDev.com
 
Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Stockholm, Sweden
Age: 35
Posts: 625
Quote:
Originally Posted by Megatron-UK View Post
Will a binary compiled with -noixemul still run on ks1.3? I'd like to target the 500 as well.
then only use -mcrt=nix13
Marlon_ is offline  
Old 22 January 2019, 12:26   #1039
Megatron-UK
Registered User
 
Join Date: Aug 2009
Location: UK
Posts: 30
Thanks, that's great.
Megatron-UK is offline  
Old 22 January 2019, 17:06   #1040
BastyCDGS
Registered User
 
Join Date: Nov 2015
Location: Freiburg / Germany
Age: 44
Posts: 201
Send a message via ICQ to BastyCDGS
Just a question:

Is it enough to recompile bgdbserver 0.5 with -mcrt=nix13 in order to get it working with OS1.3? I tried running the standard download, but it immediately returns to CLI without even printing the help info.
BastyCDGS 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
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 10:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 22:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 03:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 21:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 14:45

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 10:23.

Top

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