AxRuntime

deadwood · 21428

magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #90 on: March 08, 2022, 12:49:55 PM
@deadw00d:


gdb ./Wanderer results in:
Quote

run
Starting program: /home/magorium/bin/AXRT/System/Wanderer/Wanderer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
<<INFO>>: AxRT 41.1
<<INFO>>: Using absolute paths.
<<INFO>>: AXRT_ROOT environment variable set
<<INFO>>: RUNTIME_ROOT: /home/magorium/bin/AXRT/
<<INFO>>: AXRTSYS     : ROOT:home/magorium/bin/AXRT/
<<INFO>>: USERSYS     : ROOT:home/magorium/.axrt/
[New Thread 0x7ffff7bc2700 (LWP 18829)]
[New Thread 0x7ffff6b3e700 (LWP 18830)]
[New Thread 0x7ffff633d700 (LWP 18831)]


Thread 2 "Exec bootstrap" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff7bc2700 (LWP 18829)]
0x00007ffff7fbf2aa in _mm_set_epi8 (__q00=0 '\000', __q01=0 '\000', __q02=0 '\000', __q03=0 '\000', __q04=0 '\000', __q05=0 '\000',
    __q06=0 '\000', __q07=0 '\000', __q08=0 '\000', __q09=0 '\000', __q10=0 '\000', __q11=0 '\000', __q12=0 '\000', __q13=0 '\000',
    __q14=0 '\000', __q15=0 '\000') at /usr/lib/gcc/x86_64-linux-gnu/8/include/emmintrin.h:621
621     return __extension__ (__m128i)(__v16qi){


and for good measures lscpu:
Quote

magorium@sparky:~/bin/AXRT/System/Wanderer$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
Address sizes:       36 bits physical, 48 bits virtual
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               37
Model name:          Intel(R) Core(TM) i3 CPU       M 370  @ 2.40GHz
Stepping:            5
CPU MHz:             1723.249
BogoMIPS:            4818.55
Virtualization:      VT-x
L1d cache:           32K
L1i cache:           32K
L2 cache:            256K
L3 cache:            3072K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid dtherm arat flush_l1d


I am not too familar with using gdb so any instructions you are able to provide that is able to help you better/more is appreciated.


edit: the only hit i was able to get on that illegal instruction was found here (https://stackoverflow.com/questions/56745957/illegal-instruction-with-mm-cmpeq-epi8-mask), which mixed responses/solutions. The only wonder i have is how on earth is the compiler able to compile sources and produce code that isn't supported by the cpu it is compiled on. Another gcc murder mystery for me  ;D
« Last Edit: March 08, 2022, 01:26:42 PM by magorium »



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #91 on: March 08, 2022, 01:29:51 PM
I think it has to do with stack being misaligned, which is not good. You are compiling this under Ubuntu 20.04 right?

Once you get a crash and drop to gdb command line, please do

Code: [Select]
$ bt

to list backtrace and paste it here.



magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #92 on: March 08, 2022, 01:49:29 PM
boards immunify issue, can't preview. Will edit this post later.


I think it has to do with stack being misaligned, which is not good.
Ok, so something else than i expected....


Quote
You are compiling this under Ubuntu 20.04 right?
No, not exactly ubuntu 20.04  :)

Quote
https://sparkylinux.org/tag/nibiru/

There is a next point release of Sparky 5.15 “Nibiru” of the stable line ready to go. This release is based on Debian stable 10 “Buster”.

Code: [Select]
lsb_release -a
No LSB modules are available.
Distributor ID:   Sparky
Description:   SparkyLinux 5.16 (Nibiru)
Release:   5.16
Codename:   sid

Code: [Select]
cat /etc/os-release
PRETTY_NAME="SparkyLinux 5.16 (Nibiru)"
NAME="SparkyLinux"
VERSION_ID="5.16"
VERSION="5.16 (Nibiru)"
ID=sparky
ID_LIKE=debian
HOME_URL="https://sparkylinux.org/"
SUPPORT_URL="https://forum.sparkylinux.org/"
BUG_REPORT_URL="https://sourceforge.net/p/sparkylinux/tickets"

Hopefully that is enough with regards to the identification.


The board refuses to post/accept my backtrace......


https://pastebin.com/2GKXe2up
« Last Edit: March 08, 2022, 02:04:51 PM by magorium »



magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #93 on: March 08, 2022, 02:09:50 PM
bump. (and sorry for the boards behaviour that screw things up).


AMIGASYSTEM

  • Global Moderator
  • Legendary Member
  • *****
    • Posts: 3740
    • Karma: +69/-2
  • AROS One
    • AROS One
Reply #94 on: March 08, 2022, 02:14:00 PM
magorium is a pleasure to read you, too bad I do not understand anything about programming!


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #95 on: March 08, 2022, 04:08:07 PM
Ok, that was unexpected. :/ Its most likely a stack alignment issue, but why it triggers on your setup it a bit of mystery to me. I need to think this through. :/

One workaround might be to go to AROS/arch/x86_64-all, delete utility directory there and rebuild.



cdimauro

  • Member
  • ***
    • Posts: 164
    • Karma: +26/-1
Reply #96 on: March 09, 2022, 12:12:44 AM
Sorry for the delayed reaction cdimauro. I simply lost track of your message.
np. I also reply when I can: we all have a real life.  ;)
Quote
As deadw00d wrote, each and every AROS program (when started with axrt) uses its own (linux) address space. As such the ipc requires to follow the linux guideline with regards to IPC.
However Linux has several IPC mechanisms. AFAIR there are 6 that can be used (depending on the specific needs).
Quote
Quote
I don't now the IPC implementation that you talked about, but I assume that it's a form of message passing, mapping those messages to the various processes' virtual memory spaces (not necessarily on the same virtual addresses), and probably some sort of marshalling (otherwise it's difficult to see how your mentioned languages can communicate, since they are very different).
Let's make it a bit more practical then. It is just a (simple) example, but please have a look here (https://wiki.lazarus.freepascal.org/SimpleIPC_Library). If i remembered correctly then you did not seem shy of a bit of Pascal code, so please do follow the github link and take a look at the code.
Thanks, and you're right: before Python it was Pascal/Delphi my beloved programming language.
Quote
In the end it is just a generic library and simply offers a generic API that can be used for every platform/programming language. You can make such thing as complicated and/or simple as one wish it to be.
Basically it does what I was suspecting. In fact, it gives a basic layer for establishing a communication (client / server) with a few API for sending some common data types (int32, string), but nothing else.


In fact, for more complex data types, you need to choose some marshaling. They suggest Google Protocol Buffer:
"More advanced IPC: google protocol buffers in combination with simpleipc means you can send standardized data using the well known google protocol buffer mechanism (GPB). The GPB does not handle IPC for you, so when you need IPC mechanism to actually send and receive the google protocol buffer, why not use SimpleIPC?"

The good thing of that library is that it's simple: it exposes some basic APIs for establishing a communication between two processes and sending/receiving data.


The bad thing is that they tried to offer some APIs for exchanging data, but they cover only a bunch of common data types, and use to convert to string everyting, unfortunately, which is quite inefficient.


What's even worse, is that they sell this library as it makes easier to exchange messages using any datatype. As a pythonist, I can say that to achieve it you need a super-complex marshaling protocol that it's very very difficult to implement on languages other than Python.
I give you a basic example: integers. In Python integers have "unlimited" size: you can store very big numbers which are only limited by your memory. Whilst it's very easy for Python to marshal them to some format (classic conversion to string, for example, which is not that efficient but... effective: easy to understand, at least), how other languages will cope with that?
And this is a very basic example. Python offers a broad range of datatypes, both as built-in and in its standard library, and many of them can be freely combined. You can imagine how complex a data can become in Python. And how super difficult would be to find a way to marshal it AND be handled by different programming languages.


So, in short: the library is good for very basic message passing, but fails (and I'm polite here) on its claimed goals of being of general use.
Quote
Quote
However marshalling means also slow, especially if you want to pass complex structures. It also means that the existing Amiga applications require could requite notable changes to use this new mechanism.
For sure it is/can be. But how do modern programs use IPC ? Take note that there are several programs that even do this kind of things using networked connections (either local, lan or wan) and that there are several protocols each and everyone with their own individual pros and cons.
Indeed. And that's why the library is failing: it doesn't even give a protocol generic-enough for the more common needs. You have either to reinvent the wheel (new protocol) or use another protocol for marshaling the data.


Problem NOT solved...
Quote
In the specific instance that i've made my remark i was more thinking along the line of being compliant (from a outside point of view) rather then suggesting each and every program that wants IPC should make use of it.
Unfortunately it's not easy to use the library as it is: too much limited, and requires extra effort and/or external libraries for mashalling more complex data.
Quote
As you pointed out perfectly, Amiga OS has it's own proofed and tested implementation(s) that for sure will have more pros than cons.

The only other way i am able to see a implementation that might be a better solution (but would require more work) is a complete implemented VM for the axrt, so that the vm can decide what each individual axrt process is allowed/disallowed to do. So there  would have to be provisions (read extra layer inside the vm) for that.
Yes. But AxRT then needs to know which applications can communicate in some way (Amiga o.s., SimpleIPC...)
Quote
But perhaps you have another and/or better idea ?
As a developer, I prefer to have a more general solution which works out-of-the-box for the most common cases.


SimpleIPC isn't good for the above reasons. It would have been better for this library to offer only a single, basic, API for sending and receiving a sequence of bytes.
So, leaving the data types marshalling to something else (GPB, JSON, YAML, XML, ...).
But offering the marshalling as already built-in.



magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #97 on: March 09, 2022, 06:31:25 AM
Ok, that was unexpected. :/ Its most likely a stack alignment issue, but why it triggers on your setup it a bit of mystery to me. I need to think this through. :/

One workaround might be to go to AROS/arch/x86_64-all, delete utility directory there and rebuild.
Ah... ic. That seem to work as intended  (*) :)

The only 'issue' i seem to have right now is that the left mouse button isn't responsive. Right mouse button shows the Wanderer menubar for me without a problem though.

(*) that was after i had a bit of a brain-blockage in that i did not grasped why it still crashed after launching Wanderer on a remote shell  ... uhm  :-[

Bit of a strange crash message btw:
Code: [Select]
Thread 2 "Exec bootstrap" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7ffff7bc2700 (LWP 17397)]
Exec_69_CloseLibrary (library=0x7ffff0026850) at /media/ramdisk/myrepo/AROS/rom/exec/./closelibrary.c:66
66       if(library!=NULL)


Do you prefer an official github issue report on my initial issue ?

@AMIGASYSTEM:  Thanks, good to see you around here as well  :)
« Last Edit: March 09, 2022, 06:35:12 AM by magorium »



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #98 on: March 09, 2022, 09:36:12 AM
@magorium

Yes, please create but report. What window manager are you using on your Linux? When do you get this crash with CloseLibrary?



magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #99 on: March 09, 2022, 12:20:15 PM
Yes, please create but report.
Done  :)

Quote
What window manager are you using on your Linux?
DE: Xfce
WM: Xfwm4

Quote
When do you get this crash with CloseLibrary?
When i launch Wanderer with a remote ssh terminal session (no x-windows setup for remote session). Basically a non-issue, since afaik axrt always requires x-windows.

If there is anything else i can do to be able to help with this issue (with regards to my  initial bug report about crashed Wanderer) then please let me know. Also feel free to let me know in case this issue isn't worth the/your time (as it might be distro/setup related). Heads up though, as i won't be running Ubuntu any time soon.

edit: removed unsolicited font tags
« Last Edit: March 09, 2022, 01:08:30 PM by magorium »



deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #100 on: March 10, 2022, 12:02:25 AM
@magorium

Thank, I believe I had a report of problems under Xfce so I will look at it eventually. The Wanderer crash through remote session is ok - you indeed need X running. I will be looking further into SetMem_SSE crash.

In the meantime do you want continue looking at using AxRuntime from Pascal? If yes, I will start a separate thread here.



magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #101 on: March 10, 2022, 04:46:15 AM

@deadwood: thank you for the clarification(s).

In the meantime do you want continue looking at using AxRuntime from Pascal? If yes, I will start a separate thread here.
Yes, that is ok.

I think i have enough work to do in order to get something going/working for my current FPC setup. So the sooner the better, i guess ?  :) TIA


deadwood

  • AROS Developer
  • Legendary Member
  • *****
    • Posts: 1524
    • Karma: +118/-0
Reply #102 on: March 13, 2022, 03:03:14 PM
I wanted to share with you a teaser of an experiment that I'm working on:



What you see there is Info command execute twice from AROS-Shell running under Linux. The first Info command is a Ax-recompiled Info that you can find in the AROS-Shell package I shared last time. The interesting part is the second Info command. As the name suggests, it is a NATIVE AROS 64-bit program running under Linux :)

It may be that AxRuntime will allow running native AROS programs under Linux same way as Wine allows running native Windows programs under Linux. In the coming days I will see how far this experiment can be taken.



OlafS3

  • Legendary Member
  • *****
    • Posts: 544
    • Karma: +50/-8
Reply #103 on: March 13, 2022, 04:39:46 PM
nice  :)

now the same somewhen with linux native programs and I have no wishes left  ;)



magorium

  • Legendary Member
  • *****
    • Posts: 632
    • Karma: +62/-0
  • Convicted non contributor
Reply #104 on: March 15, 2022, 10:27:40 AM
@deadw00d:

I have no idea what happened, because your instructions to fix my problem, indeed fixed my issue when testing. I was able to run Wanderer.
But i am currently faced with something quite similar when i followed your build instructions checking out the updated tree.

Output from terminal when starting Wanderer
Code: [Select]
./Wanderer
<<INFO>>: AxRT 41.1
<<INFO>>: Using absolute paths.
<<INFO>>: AXRT_ROOT environment variable set
<<INFO>>: RUNTIME_ROOT: /home/magorium/bin/AXRT_411/
<<INFO>>: AXRTSYS     : ROOT:home/magorium/bin/AXRT_411/
<<INFO>>: USERSYS     : ROOT:home/magorium/.axrt/
Illegal instruction

Output from gdb:
Code: [Select]
gdb ./Wanderer
(gdb) run
Starting program: /home/magorium/bin/AXRT_411/System/Wanderer/Wanderer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
<<INFO>>: AxRT 41.1
<<INFO>>: Using absolute paths.
<<INFO>>: AXRT_ROOT environment variable set
<<INFO>>: RUNTIME_ROOT: /home/magorium/bin/AXRT_411/
<<INFO>>: AXRTSYS     : ROOT:home/magorium/bin/AXRT_411/
<<INFO>>: USERSYS     : ROOT:home/magorium/.axrt/
[New Thread 0x7ffff7bc2700 (LWP 16258)]
[New Thread 0x7ffff6b3e700 (LWP 16259)]
[New Thread 0x7ffff633d700 (LWP 16260)]

Thread 2 "Exec bootstrap" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff7bc2700 (LWP 16258)]
0x00007ffff7fbf2aa in _mm_set_epi8 (__q00=0 '\000', __q01=0 '\000', __q02=0 '\000', __q03=0 '\000',
    __q04=0 '\000', __q05=0 '\000', __q06=0 '\000', __q07=0 '\000', __q08=0 '\000', __q09=0 '\000',
    __q10=0 '\000', __q11=0 '\000', __q12=0 '\000', __q13=0 '\000', __q14=0 '\000', __q15=0 '\000')
    at /usr/lib/gcc/x86_64-linux-gnu/8/include/emmintrin.h:621
621       return __extension__ (__m128i)(__v16qi){
(gdb) Quit

And again, the backtrace refuses to post, so i added the whole shazam as mentioned above, including backtrace, and disasm as attachment.

Should i re-open the old issue, create a new one or ... ?

edit: The backtrace seem exactly similar ?
edit2: ah, ic. You didn't push the change to alt-runtime (yet) ?
« Last Edit: March 15, 2022, 10:47:09 AM by magorium »