AROS World Exec

Development => Development (General) => Topic started by: muibase on December 25, 2021, 09:10:50 PM

Title: Compiling hello world for Icarus distro
Post by: muibase 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?
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell 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
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell 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
Title: Re: Compiling hello world for Icarus distro
Post by: muibase 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

Title: Re: Compiling hello world for Icarus distro
Post by: miker1264 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.



Title: Re: Compiling hello world for Icarus distro
Post by: deadwood 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.
Title: Re: Compiling hello world for Icarus distro
Post by: new123 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
Title: Re: Compiling hello world for Icarus distro
Post by: muibase 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.
Title: Re: Compiling hello world for Icarus distro
Post by: muibase 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.
Title: Re: Compiling hello world for Icarus distro
Post by: deadwood 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 ;)
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell on December 27, 2021, 03:13:35 AM
Great! Steffen thank you :)
Title: Re: Compiling hello world for Icarus distro
Post by: AMIGASYSTEM 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
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell 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 :)
Title: Re: Compiling hello world for Icarus distro
Post by: miker1264 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.
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell on December 27, 2021, 08:12:09 AM
 ;)
Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 28, 2021, 02:44:36 AM
Thanks folks, trying my best to get MUIbase running on AROS.

What is the best way to report bugs?

I found the following one:

A call to fread(buffer, size, 0, file) sets the EOF flag of the file descriptor.  This is because of how AROS/compiler/posixc/fread.c (https://github.com/aros-development-team/AROS/blob/master/compiler/posixc/fread.c) is implemented:

Code: [Select]
   
    else if (cnt == 0 || cnt < nblocks)
    {
stream->flags |= __POSIXC_STDIO_EOF;
    }

The fix would be to change the condition to "else if (cnt < nblocks)" only, or do an early return 0 similar to how it is done in AROS/compiler/stdc/fread.c

Of course, it is easy to work around this by simply not calling fread when there is nothing to be read.

Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 28, 2021, 04:08:20 AM
Here is the i386-AROS version of MUIbase: https://muibase.sourceforge.io/files/amiga/MUIbase-4.4-i386-aros.lha.  It runs fine under the Icaros AROS version or the i386-linux hosted version.

It would be great to get some feedback from interested folks here before I put this version live.

BTW, I will also publish an AROS version of sqlite-3.34.0-amiga later as MUIbase is build on top of it.
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell on December 28, 2021, 04:54:55 AM
thank you work fine

(https://i.ibb.co/6PqLFzP/base.jpg)
Title: Re: Compiling hello world for Icarus distro
Post by: AMIGASYSTEM on December 28, 2021, 05:43:30 AM

It would be great to get some feedback from interested folks here before I put this version live.


I have installed the new MUIBase on my AROS One x86 and it works perfectly.

I created a datatypes descriptor and a def_bbs.info (see screenshot, all demo files are associated to the def_bbs.info)
I started all the Demos at the same time without getting any errors, i would say perfect on AROS.

If you want my icons to be included in your archive I can attach them here, if you want I can also create the icons inDualPNG version OS3 and OS4
Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 28, 2021, 11:08:40 AM
I have installed the new MUIBase on my AROS One x86 and it works perfectly.

I created a datatypes descriptor and a def_bbs.info (see screenshot, all demo files are associated to the def_bbs.info)
I started all the Demos at the same time without getting any errors, i would say perfect on AROS.

If you want my icons to be included in your archive I can attach them here, if you want I can also create the icons inDualPNG version OS3 and OS4

Thanks for the quick testing.  Regarding icons, I am planning on updating all imagery in an upcoming release and already have a good new set of new PNG icons.

However, can you tell me more about these DualPNG versions for OS3 and OS4?  The installer script still proposes non-PNG icons for OS3 and OS4.  Is there a way to have PNG icons for toese systems now?
Title: Re: Compiling hello world for Icarus distro
Post by: AMIGASYSTEM on December 28, 2021, 11:22:38 AM
The OS4.1 icons I created directly on OS 4.1 Emulated with the Icon Editor software, while the AROS One and OS3.9 Icons I created with the same Icon Editor but on OS 3.9 (my AfA One).

If you want to examine them I enclose the package that includes OS4, OS3.9 and AROS One x86/68k icons.



Title: Re: Compiling hello world for Icarus distro
Post by: miker1264 on December 28, 2021, 11:51:22 AM
The OS4.1 icons I created directly on OS 4.1 Emulated with the Icon Editor software, while the AROS One and OS3.9 Icons I created with the same Icon Editor but on OS 3.9 (my AfA One).

If you want to examine them I enclose the package that includes OS4, OS3.9 and AROS One x86/68k icons.

I believe the OS4.1 icons are " fake" OS3.5 Glow Icons with ARGB Data Chunks. DualPNG icons are just two PNG files stacked in a .info file. OS 3.x are typically OS3.5 Glow Icons.
Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 29, 2021, 01:41:15 AM
One other problem/feature I noticed on AROS.  AROS has different semantics w.r.t MUIA_Application_Sleep and newly created windows.

There are 2 differences which I in the following I will call open-window-only and sleep-underflow

open-window-only: In classic MUI (m68k, AOS4, MorphOS) one can create a new window, set the application to sleep and then open the new window, which will not be put to sleep (but all other windows are).  On AROS though the newly created window is also put to sleep.  Classic MUI only sets open windows to sleep whereas AROS seems to also set hidden/closed windows to sleep.

It is easy to work-around this by first setting the application to sleep before creating and opening the new window.

sleep-underflow Classic MUI allows to unsleep the application and windows that weren't put to sleep are still in their no-sleep state.  Said differently, the sleep counter of a window does not drop below 0 when calling MUIA_Application_Sleep, FALSE.  On AROS though it seems this sleep counter underflows, thus when creating and opening a new window and unsleeping the application, the new window is set to sleep.  It gets even more weird when calling MUIA_Application_Sleep, TRUE as this can make a window to get a zero sleep counter and allow user input.

It is possible to work around this by making sure that between every call to MUIA_Application_Sleep, TRUE and MUIA_Application_Sleep, FALSE, no new window is created.  But it is not a trivial one.  Often it is just very convenient to set the whole application to sleep, do whatever changes are necessary, which might include adding new windows, and then unsleep the application.

I just did an audit of all sleep/unsleep calls in MUIbase in order to match the semantics of AROS (see e.e.g this commit: https://sourceforge.net/p/muibase/code/3918).

MUIbase is probably not the only application that runs into this issue, thus, my recommendation would be to change the semantics to how classic MUI does it.  And BTW, both GTK and Qt also work the same way as classic MUI.  In particular the sleep-underflow change would be highly desirable.
Title: Re: Compiling hello world for Icarus distro
Post by: deadwood on December 29, 2021, 02:33:31 AM
Hi,

Thanks for the report - I created a ticket for it: https://github.com/deadw00d/AROS/issues/51

If you can provide source of smallest possible application triggering these issues, it would make tracking them down easier :)
Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 29, 2021, 02:22:35 PM
Hi,

Thanks for the report - I created a ticket for it: https://github.com/deadw00d/AROS/issues/51

If you can provide source of smallest possible application triggering these issues, it would make tracking them down easier :)

Done.  I also created a ticket for the fread bug: https://github.com/deadw00d/AROS/issues/52
Title: Re: Compiling hello world for Icarus distro
Post by: deadwood on December 29, 2021, 02:51:41 PM
Thanks a lot for both reports and test code. I'm finishing some other work right now and then will look into those issues. Can I include your test cases into AROS testing suite? If so, what's the code license?
Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 29, 2021, 03:51:21 PM
Thanks a lot for both reports and test code. I'm finishing some other work right now and then will look into those issues. Can I include your test cases into AROS testing suite? If so, what's the code license?

Sure you can include this in the testing suite.  I don't have any claims on these little test programs, so feel free to copy&paste and choose whatever license you see fit.
Title: Re: Compiling hello world for Icarus distro
Post by: muibase on December 30, 2021, 02:40:08 AM
I added another issue in https://github.com/deadw00d/AROS/issues/53.  This one is a bit more controversial and I remember I discussed about this a long time ago with some other AROS folks.  The work-around (or let's say more proper use of the MUI API) is quite involved and I am probably not trying to work-around it.
Title: Re: Compiling hello world for Icarus distro
Post by: deadwood on December 30, 2021, 07:43:27 AM
Ok, got it. This one might take a little longer as I will have to prepare some regression tests.
Title: Re: Compiling hello world for Icarus distro
Post by: deadwood on January 19, 2022, 12:27:37 PM
Hi All,

All 3 issues reported by Steffen have now been fixed. Thanks goes to Steffen for providing valuable test cases!
Title: Re: Compiling hello world for Icarus distro
Post by: Amiwell on January 19, 2022, 07:07:56 PM
thank you deadwood :)