English Amiga Board


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

 
 
Thread Tools
Old 24 February 2019, 00:40   #1101
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 119
GCC 6.2 toolchain for AmigaOS 3

I just checked. It works :-)

At first it crashed with newlib, but it ultimately turned out just to be a matter of not enough stacksize. Noixemul is still recommended as it produces a much smaller executable.

WRT vbcc: I don't know why vbcc is part of the toolchain at all (vasm is very useful to have in there, though!). In general, Bebbo is more concerned about making gcc great.

Last edited by pipper; 24 February 2019 at 03:02.
pipper is offline  
Old 24 February 2019, 15:26   #1102
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by midwan View Post
Thanks, I'll look into that and see.

Meanwhile, I found it strange that using the toolchains bundled "vbcc" it fails to compile (received an "Ouf of memory" error!), while it compiles normally with a standalone separate VBCC installation (e.g. following my guide here: https://blitterstudio.com/setting-up...ross-compiler/). Perhaps it has to do with the target configs? I didn't spend too much time to troubleshoot this.

@bebbo: could we get the target configs in the toolchain also, or otherwise "fix" the VBCC installation? It would be great if we could have one up-to-date toolchain that people can use, including both compilers.
Please provide a pull request for the fix.
bebbo is offline  
Old 26 February 2019, 10:32   #1103
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 38
Yesterday I used this toolchain to compile a bigger application I originally created with StormC4 / gcc 2.95 mode.

As expected the binary is bigger, but the program also runs faster, only taking about 80% of the time for its operation.

But one issue I noticed is that it crashed as soon as I changed the CPU to 68000 (WinUAE). On 68020-68040 it ran without problems. Binaries are attached.

Btw I don't open the libraries manually. As the StormC startup code allows to auto-open the libraries I used that feature. Could this be a problem with the toolchain?
Attached Files
File Type: zip adiffview.zip (162.2 KB, 10 views)
thyslo is offline  
Old 26 February 2019, 15:11   #1104
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by thyslo View Post
Yesterday I used this toolchain to compile a bigger application I originally created with StormC4 / gcc 2.95 mode.

As expected the binary is bigger, but the program also runs faster, only taking about 80% of the time for its operation.

But one issue I noticed is that it crashed as soon as I changed the CPU to 68000 (WinUAE). On 68020-68040 it ran without problems. Binaries are attached.

Btw I don't open the libraries manually. As the StormC startup code allows to auto-open the libraries I used that feature. Could this be a problem with the toolchain?
two improvements:
  • don't initialize static variables with constuctors inside of if.
    Why? It triggers a bunch of code to ensure that this variable is only initialized once.
  • provide an own 'operator new' (until I found an improvement), since the standard provides one which uses exceptions... tada ... -fno-exceptions does not really help.
Code:
static const SimpleString __s = "";
const SimpleString& DiffFilePartition::GetDiffLineText(size_t p_Index) const
{
  if(m_DiffLinesArray.IsEmpty()|| p_Index >= m_DiffLinesArray.Size())
  {
    return __s;
  }
and

Code:
void * operator new (std::size_t sz)
{
  void *p = malloc(sz);
  if (p)
    return p;
  perror("std::bad_alloc");
  abort();
}

both helps with code size plus it runs on 68000 too.
Attached Files
File Type: zip ADiffView.zip (29.1 KB, 12 views)
bebbo is offline  
Old 26 February 2019, 19:29   #1105
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 38
Wow, smaller and faster, great

Thanks for these hints!
thyslo is offline  
Old 01 March 2019, 10:28   #1106
thyslo
Registered User
 
Join Date: Apr 2018
Location: Germany
Posts: 38
Hi bebbo,

unfortunately I wasn't able to recreate the good binary result you posted here.

Using this flags
Code:
CXXFLAGS=-Wall -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -noixemul -Os
And doing the operator new() overloading globally in main.cpp.

Did you use some other magic there?
thyslo is offline  
Old 01 March 2019, 10:34   #1107
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by thyslo View Post
Hi bebbo,

unfortunately I wasn't able to recreate the good binary result you posted here.

Using this flags
Code:
CXXFLAGS=-Wall -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -noixemul -Os
And doing the operator new() overloading globally in main.cpp.

Did you use some other magic there?
yes magic: build all libraries with -Os. Do a
Code:
export CFLAGS_FOR_TARGET="-Os -fomit-frame-pointer"
before `make all`. Needs a `make clean-libnix` to get libnix build with that option. And so on.
bebbo is offline  
Old 02 March 2019, 10:46   #1108
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by bebbo View Post
  • provide an own 'operator new' (until I found an improvement), since the standard provides one which uses exceptions... tada ... -fno-exceptions does not really help.
Code:
void * operator new (std::size_t sz)
{
  void *p = malloc(sz);
  if (p)
    return p;
  perror("std::bad_alloc");
  abort();
}
From now on

Code:
gcc version 6.5.0b 190302093159 (GCC)
simply specify `-fno-exceptions` when linking and that simple new operator is used.
bebbo is offline  
Old 16 March 2019, 17:05   #1109
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,248
Has anyone been able to build vasm, vlink, and vbcc? I can get the gcc toolchain to build with no errors on macOS, but when I use it to build vasm I get errors like these:

Code:
amiga-gcc/m68k-amigaos/sys-include/stdio.h:66:9: error: unknown type name '__FILE'
 typedef __FILE FILE;

amiga-gcc/m68k-amigaos/sys-include/stdio.h:747:26: error: dereferencing pointer to incomplete type 'struct _reent'
  return (__sgetc_r(_ptr, _stdin_r(_ptr)));

amiga-gcc/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: cannot find ncrt0.o: No such file or directory
Leffmann is offline  
Old 16 March 2019, 21:30   #1110
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by Leffmann View Post
Has anyone been able to build vasm, vlink, and vbcc? I can get the gcc toolchain to build with no errors on macOS, but when I use it to build vasm I get errors like these:

Code:
amiga-gcc/m68k-amigaos/sys-include/stdio.h:66:9: error: unknown type name '__FILE'
 typedef __FILE FILE;

amiga-gcc/m68k-amigaos/sys-include/stdio.h:747:26: error: dereferencing pointer to incomplete type 'struct _reent'
  return (__sgetc_r(_ptr, _stdin_r(_ptr)));

amiga-gcc/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: cannot find ncrt0.o: No such file or directory
I suggest using -noixemul.

Plus you have to fix tfloat.h that strtod is used instead of strtold.

the attached Makefile.68k can be used directly with make -f Makefile.68k
Attached Files
File Type: 68k Makefile.68k (369 Bytes, 6 views)
bebbo is offline  
Old 19 March 2019, 20:14   #1111
Amiga68k
Registered User

Amiga68k's Avatar
 
Join Date: Oct 2017
Location: Amsterdam
Posts: 167
bebbo, I followed your guide at this url. I didn't build the toolchain myself, but used your installer.

After creating the helloworld project, I received the error messages that g++ and gcc are not in the PATH...

I did two things:
- Added the location where the bin folder is to the PATH environment variable in Windows system settings
- Renamed m68k-amigaos-g++.exe and m68k-amigaos-gcc.exe to respectively g++.exe and gcc.exe

The above steps make the error messages go away, but this can't be the idea behind it, can it?

Where you are stating /opt/amiga/bin in the guide, I assume you mean the 'amiga-gcc/bin' directory that your toolchain creates, right?

*EDIT: next error when rebuilding the project after change of settings as mentioned in the guide:
Code:
Program "make" not found in PATH
Went to the directory where your toolchain is installed and there is a file called _make.exe...

Am I missing an important additional step that is not mentioned in the guide? Should I have an installed cygwin environment that might add all these things to the PATH?

*EDIT2: the problems with make are gone after running the cmdline.bat file

Last edited by Amiga68k; 19 March 2019 at 23:18.
Amiga68k is online now  
Old 19 March 2019, 20:41   #1112
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,248
Quote:
Originally Posted by bebbo View Post
I suggest using -noixemul.

Plus you have to fix tfloat.h that strtod is used instead of strtold.

the attached Makefile.68k can be used directly with make -f Makefile.68k

Thanks, I've already tried -noixemul and the various -mcrt options, but I can't get it to work. I think the macOS build procedure somehow quietly fails, but I have no more useful info.
Leffmann is offline  
Old 20 March 2019, 12:25   #1113
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
[QUOTE=Amiga68k;1312071]bebbo, I followed your guide at this url. I didn't build the toolchain myself, but used your installer.

After creating the helloworld project, I received the error messages that g++ and gcc are not in the PATH...

I did two things:
- Added the location where the bin folder is to the PATH environment variable in Windows system settings
- Renamed m68k-amigaos-g++.exe and m68k-amigaos-gcc.exe to respectively g++.exe and gcc.exe
[/code]

I guess you skipped the step to enter the Cross Compiler Prefix and the Cross Compiler Path
* prefix is "m68k-amigaos-" and
* the path to the bin folder (e.g. "/opt/amiga/bin") depends on your installation

please undo the rename.

Quote:
Originally Posted by Amiga68k View Post
The above steps make the error messages go away, but this can't be the idea behind it, can it?

Where you are stating /opt/amiga/bin in the guide, I assume you mean the 'amiga-gcc/bin' directory that your toolchain creates, right?

*EDIT: next error when rebuilding the project after change of settings as mentioned in the guide:
Code:
Program "make" not found in PATH
Went to the directory where your toolchain is installed and there is a file called _make.exe...

Am I missing an important additional step that is not mentioned in the guide? Should I have an installed cygwin environment that might add all these things to the PATH?

*EDIT2: the problems with make are gone after running the cmdline.bat file
ah, yes - running the cmdline.bat is mandatory for now... since that script creates the make.exe wrapper for windows.
bebbo is offline  
Old 20 March 2019, 12:29   #1114
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by Leffmann View Post
Thanks, I've already tried -noixemul and the various -mcrt options, but I can't get it to work. I think the macOS build procedure somehow quietly fails, but I have no more useful info.
If I have access to an OSX system, I'll test it, but there's none around.
Maybe someone else can help here?
bebbo is offline  
Old 20 March 2019, 12:51   #1115
Amiga68k
Registered User

Amiga68k's Avatar
 
Join Date: Oct 2017
Location: Amsterdam
Posts: 167
Quote:
Originally Posted by bebbo View Post
I guess you skipped the step to enter the Cross Compiler Prefix and the Cross Compiler Path
* prefix is "m68k-amigaos-" and
* the path to the bin folder (e.g. "/opt/amiga/bin") depends on your installation

please undo the rename.
Nope, made sure I followed your guide to the letter... Just tested with and without quotes, but it's still complaining that "g++" and "gcc" are not in PATH when entering the values during the creation of the new project for the first time.

However, when I go to C/C++ Build Settings and do an additional "Apply and Close", the error messages are no longer there...

(perhaps a bug in Eclipse?)
Amiga68k is online now  
Old 21 March 2019, 11:27   #1116
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,248
Question

Quote:
Originally Posted by Leffmann View Post
Thanks, I've already tried -noixemul and the various -mcrt options, but I can't get it to work. I think the macOS build procedure somehow quietly fails, but I have no more useful info.
Quote:
Originally Posted by bebbo View Post
If I have access to an OSX system, I'll test it, but there's none around.
Maybe someone else can help here?

It's very picky about the build environment. I removed the manually installed dependencies and added them via Homebrew, and installed GCC instead of the older version of clang and its GCC wrapper, and it works better now. There are still unexpected linker errors about missing library bases, but I can just add those manually.
Leffmann is offline  
Old Today, 00:28   #1117
bebbo
botcher

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 357
Quote:
Originally Posted by Leffmann View Post
It's very picky about the build environment. I removed the manually installed dependencies and added them via Homebrew, and installed GCC instead of the older version of clang and its GCC wrapper, and it works better now. There are still unexpected linker errors about missing library bases, but I can just add those manually.
It s*cks as usual, but builds it...
... I updated https://franke.ms/download/amiga-gcc-macos.tgz

and vasm builds with the Makefile and changes from above.

PS: maybe you should try an absolute path as prefix...
bebbo 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 11:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 23:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 04:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 22:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 15: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 09:01.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.12197 seconds with 15 queries