Compiling hello world for Icarus distro

muibase · 2619

muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
on: December 25, 2021, 09:10:50 PM
Hi folks,

I am looking into making a new version of MUIbase available for AROS.  To get started, I just wanted to compile and run a simple "void main(void) { printf("Hello world\n"); }" on the Icarus distro.

I downloaded IcarosLive_2_3_0.zip and the ISO image is running nicely under VirtualBox.  Success!

Next, I followed the instructions on https://aros.sourceforge.io/documentation/developers/app-dev/introduction.php and tried downloading the AROS cross-compiler but the link to http://www.zerohero.se/cross/aros.html no longer works (someone, please update the docs!).

Thus, I tried "Compiling on Linux with the "fake" GCC".  I had a hard time finding the mentioned "i386-all-sdk" download.  I think I went through all of https://sourceforge.net/projects/aros/files/ and the only suitable download seems to be AROS-20190503-pc-i386-sdk (BTW, I find it confusing to call downloads a nightly build when in fact there are only downloads for a very sparse set of days).

I am using a Ubuntu Xenial x86_64 Linux box and managed to install the AROS SDK.  I am able to compile the hello-world program (using -m32 to generate i386 binaries).  The resulting executable seems to match the AROS specs: ELF 32-bit LSB relocatable, Intel 80386, version 1, not stripped

However, when running it on the Icarus distro, the program simply crashes w/o printing the hello-world string.

Is it because AROS-20190503-pc-i386-sdk is using ABIv1 (whatever that means, it would be great to describe how the ABI was changed)?  Is Icarus using ABIv0?  How do I find out?

Any advice on how to make progress?



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #1 on: December 25, 2021, 09:42:59 PM
hello

Maybe you can compile the program via the Build System under Linux, these are the most up-to-date sources by deadwood

https://axrt.org/index.php?tab=download-aros



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #2 on: December 25, 2021, 09:55:46 PM
There have been changes in these years about the AROS ABIV0 code has been updated by Deadwood, regarding ABIV1 it is working at a stable branch that takes the name of ABIV11

https://ae.amigalife.org/index.php?topic=797.0



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #3 on: December 26, 2021, 12:10:28 AM
hello

Maybe you can compile the program via the Build System under Linux, these are the most up-to-date sources by deadwood

https://axrt.org/index.php?tab=download-aros

Thanks Salvo!

ArRuntime sounds very promising!   I just went through the INSTALL.md file and ran the instructions.  Unfortunately, the last command "./rebuild.sh" gives me the following error message:


===================cut-here===================
...
checking what specific target gcc version to use... checking gcc version... ../AROS/configure: line 9809: toolchain_cpp_opts: command not found
../AROS/configure: line 9809: /home/steffen/comp/aros/aros-repro/dummy/nonegcc: No such file or directory

6.5.0
checking version string style... release
checking llvm version... ../AROS/configure: line 9901: toolchain_cpp_opts: command not found
../AROS/configure: line 9901: /home/steffen/comp/aros/aros-repro/dummy/nonegcc: No such file or directory
....
===================cut-here===================

Any idea what is wrong here?

Steffen




miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #4 on: December 26, 2021, 12:44:32 AM
@muibase

I'm rebuilding my ABIv11 sources at the moment. So far the build is going well with the older sources. Then I have to update sources then build it again. Hopefully all will go well with that.

Tomorrow I will setup a build of ALT-ABIv0 to build the toolchain and then compile the sources. Maybe I can help at that point.

By the way on IcarosDesktop 2.3.0 in the shell you can compile your "hello world" app using gcc.

For anything more substantial with more than one code module you may need a working build system. That's the point I have reached. Now I have to compile MultiView and several datatypes. So the shell method won't work well for me.



« Last Edit: December 26, 2021, 01:14:11 AM by miker1264 »



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #5 on: December 26, 2021, 01:36:20 AM
Hello Steffen,

Since you are building under Linux, you will be able to use "linux-hosted" AROS to debug the application using GDB.

I assume you want to build it for ABIv0 (so that it runs on Icaros). Please follow these instructions:

https://github.com/deadw00d/AROS/blob/alt-abiv0/INSTALL.md

Specifically, in a section "Linux-i386", be sure first to build the cross-compiler (toolchain-alt-abiv0-i386) and only then AROS itself (alt-abiv0-linux-i386).

The errors you posted are a bit confusing, because ABIv0 still uses 4.x GCC while you indicate problems with 6.5.0 GCC.



new123

  • Newbie
  • *
    • Posts: 29
    • Karma: +38/-0
Reply #6 on: December 26, 2021, 10:36:56 AM
Icaros distribution has built in development environment based on GCC, but you need to unpack it manually and make some assigns:

Code: [Select]
; add this to user-startup
execute aros:development/s/package-startup
« Last Edit: December 26, 2021, 11:32:12 AM by new123 »



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #7 on: December 26, 2021, 05:59:58 PM

===================cut-here===================
...
checking what specific target gcc version to use... checking gcc version... ../AROS/configure: line 9809: toolchain_cpp_opts: command not found
../AROS/configure: line 9809: /home/steffen/comp/aros/aros-repro/dummy/nonegcc: No such file or directory

6.5.0
checking version string style... release
checking llvm version... ../AROS/configure: line 9901: toolchain_cpp_opts: command not found
../AROS/configure: line 9901: /home/steffen/comp/aros/aros-repro/dummy/nonegcc: No such file or directory
....
===================cut-here===================

Actually, I think there is something wrong in this script, e.g. toolchain_cpp_opts should be used using curly braces ${toolchain_cpp_opts} but it is used with parentheses $(toolchain_cpp_opts).  One I fixed that I have one error message less, but it still fails later.

In any case I am trying the suggested ABIv0 install in the previous comment next.



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #8 on: December 27, 2021, 12:57:52 AM
Hello Steffen,

Since you are building under Linux, you will be able to use "linux-hosted" AROS to debug the application using GDB.

I assume you want to build it for ABIv0 (so that it runs on Icaros). Please follow these instructions:

https://github.com/deadw00d/AROS/blob/alt-abiv0/INSTALL.md

Specifically, in a section "Linux-i386", be sure first to build the cross-compiler (toolchain-alt-abiv0-i386) and only then AROS itself (alt-abiv0-linux-i386).

The errors you posted are a bit confusing, because ABIv0 still uses 4.x GCC while you indicate problems with 6.5.0 GCC.

Ok, that worked!

I am able to run AROS and also compile and run code. 

Some caveats, though.  The helloworld.c example in https://aros.sourceforge.io/documentation/developers/app-dev/introduction.php with the mmakefile.src does not seem to work.  Here is the output:

----------------------snip--------------------
steffen@singapore:~/comp/aros/aros-repro-abiv0/alt-abiv0-linux-i386-d$ ls local/helloworld/
helloworld.c  mmakefile.src
steffen@singapore:~/comp/aros/aros-repro-abiv0/alt-abiv0-linux-i386-d$ make local-helloworld
[MMAKE] Building AROS.local-helloworld
[MMAKE] Read vars...

[MMAKE] Scanning dirs...
...

[MMAKE] Scanning makefiles...
...
[MMAKE] Collecting targets...
[MMAKE] Nothing known about target local-helloworld in project AROS
----------------------snip--------------------

But I am able to compile helloworld.c this way:

../toolchain-alt-abiv0-i386/i386-aros-gcc --sysroot bin/linux-i386/AROS/Development local/helloworld/helloworld.c -o local/helloworld/helloworld

And it runs both on the freshly compiled AROS system and the Icarus one.

Using this recipe, I was also able to compile sqlite-3.34.0-amiga and MUIbase.



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #9 on: December 27, 2021, 01:37:10 AM
Glad it worked for you :)

It seems documentation is out of date. Use this "include" in mmakefile.src instead of the existing one:

Code: [Select]
include $(SRCDIR)/config/aros.cfg
or steal a working mmakefile.src file, for example from workbench/c/R ;)



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #10 on: December 27, 2021, 03:13:35 AM
Great! Steffen thank you :)



AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #11 on: December 27, 2021, 03:56:55 AM
Hi Steffen, now will the new MUI4.4 be available also for AROS x86 ?

I will be happy to update MUIbase on my AROS One x86 stopped at version 2.9


Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #12 on: December 27, 2021, 05:47:14 AM
yes amigasystem I contacted Mr. Steffen to ask him if he could compile the latest version of Muibase :)
« Last Edit: December 27, 2021, 06:01:26 AM by salvo »



miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #13 on: December 27, 2021, 07:19:40 AM
yes amigasystem I contacted Mr. Steffen to ask him if he could compile the latest version of Muibase :)


All is well that benefits AROS. We appreciate the effort on all sides for software development.

We also appreciate the hard work and dedication of those who maintain distros such as Paolone and others! Thank you.



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #14 on: December 27, 2021, 08:12:09 AM
 ;)