Development Plan

deadwood · 18161

Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #45 on: January 06, 2022, 06:23:45 PM
I thought it was written correctly I never learned English ;D



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #46 on: January 07, 2022, 01:02:34 AM
@deadw00d
It is of futile importance but on your axrt downloadpage it is spelled desription (but should read description)

Fixed, thank :)



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #47 on: January 19, 2022, 11:51:19 PM
Next, link to releases (bottom of page): https://axrt.org/index.php?tab=download-aros

I have been trying to compile MUIbase for x86_64-v11 and (after some changes [mostly ULONG -> IPTR]) everything compiles without serious warnings, but the resulting binary does not start.

I am using the https://www.axrt.org/download/aros/v11/AROS-20211231-1-linux-x86_64-system.tar.bz2 release, and built the corresponding toolchain using the instructions from https://github.com/deadw00d/AROS/blob/master/INSTALL.md.

I tracked it down to global variables that somehow get missing in the binary.  Here is an example.

The following compiles and runs as expected:
Code: [Select]
#include <stdio.h>
int main(void)
{
    printf("Hello world\n");
    return 0;
}


But when adding a global variable like this:
Code: [Select]
#include <stdio.h>

// I love global variables, in particular when they are called 'i' ;-)
int i;

int main(void)
{
    printf("Hello world\n");
    i = 0;
    return 0;
}

The binary doesn't start.  The output in the CLI window is: "hello: file is not executable" and the Linux terminal where I booted AROS from prints "[ELF Loader] COMMON symbol 'i'".

Thus, somehow the linker removed the global symbol 'i'.  Any idea what is wrong?

Here is the command I used to compile (I made symbolic links from /usr/local to the directories where I unpacked and compiled v11):
/usr/local/aros-sdk/toolchain-core-x86_64/x86_64-aros-gcc --sysroot /usr/local/aros-sdk/SDK-core-x86_64 -o hello hello.c



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #48 on: January 20, 2022, 12:14:20 AM
I think the solution is either to initialize the global variable to 0 OR to add -fno-common switch to the compilers comand line.

I looked up the history and it seems this change has been made to make older gcc versions (like 6.5.0) behave the same as the gcc 10 and up.



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #49 on: January 20, 2022, 12:56:14 AM
Thanks, that worked!  MUIbase now also runs on x86-64-v11.

Is there a way on AROS to detect whether AROS is compiled for i386 or x86-64?  It yes, it would allow to pre-select the right binary in the Installer script.



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #50 on: January 20, 2022, 01:50:52 AM
Glad it worked :)

About your question, I see two ways:

1) aros.library (http://www.aros.org/documentation/developers/autodocs/aros.php) ArosInquireA with AI_ArosArchitecture tag. You get get a pointer to string like "linux-x86_64" or "pc-x86_64". You can grab CPU archictecture from there.
2) There is ABI environment variable you can read. Value of 0 most likely means it is i386 (however there was once ABIv0 for arm as well). Version of 11 means most likely x86_64 (though my builds of amiga-m68k also have version 11).



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #51 on: January 20, 2022, 02:12:29 AM
Env:ABI sounds good to me since that is easily accessible from within an Installer script.  It is okay if it isn't right all the time since it will only be used for pre-selecting the binary to install and the user can still change it.



muibase

  • Newbie
  • *
    • Posts: 26
    • Karma: +65/-0
Reply #52 on: January 20, 2022, 02:17:29 AM
Here is another question.  How do I correctly implement a function that takes variable number of arguments on AROS?

Here is a sample program:
Code: [Select]
#include <stdio.h>
#include <stdarg.h>
#include <libraries/mui.h>
#include <proto/muimaster.h>
#include <proto/intuition.h>
#include <proto/exec.h>

#define VARARGS68K __stackparm

struct Library *MUIMasterBase = NULL;

static void VARARGS68K ask(Object *app, const char *fmt, ...)
{
    va_list va;

    va_start(va, fmt);
    MUI_Request(app, NULL, 0, "Requester", "*Ok", fmt,
            (APTR)va->overflow_arg_area);
    va_end(va);
}

int main(void)
{
    MUIMasterBase = OpenLibrary((STRPTR)MUIMASTER_NAME, 0);
    if (MUIMasterBase == NULL) {
        printf("No MUI\n");
        return 10;
    }

    Object *app = ApplicationObject, End;

    ask(app, "6 * 7 = %d", 42);

    MUI_DisposeObject(app);

    CloseLibrary(MUIMasterBase);

    return 0;
}

When running this on x86-64-v11 I get the funny result: "6 * 7 = 22160"  :(



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #53 on: January 20, 2022, 02:48:25 AM
@muibase

Moved to another thread:
https://ae.amigalife.org/index.php?topic=852.0



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #54 on: January 20, 2022, 02:34:59 PM
Thanks, that worked!  MUIbase now also runs on x86-64-v11.

Is there a way on AROS to detect whether AROS is compiled for i386 or x86-64?  It yes, it would allow to pre-select the right binary in the Installer script.

Thank you steffen



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #55 on: February 12, 2022, 07:34:12 AM
Hi,

It looks like we are having Free Pascal compiler working on ABIv11 as well as several useful applications ported. :) See this link:

https://blog.alb42.de/2022/02/07/aros64-again-this-time-abi-11/
https://blog.alb42.de/2022/02/07/the-100-useless-aros-distribution-0-3/

Thanks go to ALB42.



Amiwell

  • Legendary Member
  • *****
    • Posts: 2616
    • Karma: +35/-4
  • Peace
Reply #56 on: February 12, 2022, 11:09:32 AM
yes good :)



AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3755
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #57 on: February 12, 2022, 11:57:17 AM
Hi,

It looks like we are having Free Pascal compiler working on ABIv11 as well as several useful applications ported. :) See this link:

https://blog.alb42.de/2022/02/07/aros64-again-this-time-abi-11/
https://blog.alb42.de/2022/02/07/the-100-useless-aros-distribution-0-3/

Thanks go to ALB42.

A few days ago I tried to start it from VM but it doesn't seem to work, I don't like Host systems so I didn't try other modes.


miker1264

  • Legendary Member
  • *****
    • Posts: 1827
    • Karma: +84/-6
Reply #58 on: February 12, 2022, 12:51:45 PM
Hi,

It looks like we are having Free Pascal compiler working on ABIv11 as well as several useful applications ported. :) See this link:

https://blog.alb42.de/2022/02/07/aros64-again-this-time-abi-11/
https://blog.alb42.de/2022/02/07/the-100-useless-aros-distribution-0-3/

Thanks go to ALB42.

A few days ago I tried to start it from VM but it doesn't seem to work, I don't like Host systems so I didn't try other modes.

AROS Hosted is great. One of the benefits is using the Host file managers to copy or delete data while AROS is running. It speeds up the process.






AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3755
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #59 on: February 12, 2022, 04:16:35 PM
Yes I know miker but as said I'm not really excited about a Host system.