1. Asking for help with Phix program under Linux
- Posted by RobertS Nov 07, 2022
- 1005 views
I do not have a Linux machine, have no experience with Linux, but still would like to make a Phix program I’ve written for Windows available to Linux users, too — so, in case that anyone here might be willing to help …?
The program is a calculator that runs in a console window, hypatia-rpn.net
In theory, the code should work with Linux, but lacking Linux I can neither test it, nor compile it. If you want to help, please see hypatia-rpn.net/linux.htm — if it indeed works, it shouldn’t take more than 15 minutes to test it. If it doesn’t work, of course … well, but maybe it does? Just answering a few of the questions would be helpful!
Also: if it works (sorry, I really have no experience with Linux), will the compiled executable run on all Linux systems?
Thank you! Robert
2. Re: Asking for help with Phix program under Linux
- Posted by achury Nov 07, 2022
- 978 views
You can use a virtual machine. Check this thread: https://openeuphoria.org/forum/136232.wc#136232
There Pete shared this link: https://replit.com/@PeteLomax1/PhixInterpreter#main.sh This is phix running on a remote cirtual linux server. You can fork and put your software there.
Also here we talk about install phix on Amazon Web Services (AWS) https://openeuphoria.org/forum/136116.wc#136116
Best regards
Marco Achury
3. Re: Asking for help with Phix program under Linux
- Posted by RobertS Nov 07, 2022
- 961 views
Thank you for your reply! I know about virtual machines, but I'd have to put in a lot of effort and learn a lot about Linux to get to the point where I can set up Phix and test something and understand why it may not work, or how far I can trust it if it does.
For the online interpreter I'm afraid the program is too large, it's split into several files, and I see no way to upload them. Also, it would't give me an executable, and wouldn't tell me how it behaves on a "real" system. And with AWS, I'd still need to learn a lot about Linux, which I'll never need for anything else, and honestly, I don't want to pay Amazon to be able to test something I'm giving away for free.
So, I still hope for someone who already has Phix on a Linux machine, to be interested enough to spend maybe 15 minutes to be able to tell me if it works - but, yes, I know I should be Linux literate, I can only apologize for being not.
4. Re: Asking for help with Phix program under Linux
- Posted by irv Nov 07, 2022
- 957 views
Sorry, but no.
Phix no longer works on up-to-date Linux machines (at least, not the ones using the most popular Linux versions, Ubuntu and Mint and other Debian derivatives). Testing on older versions could be done, but that just adds an additional problem - it will work for some people, not for others.
This is something that Pete is working on, but there seems to be no answer yet: https://openeuphoria.org/forum/136972.wc?last_id=137176
5. Re: Asking for help with Phix program under Linux
- Posted by irv Nov 07, 2022
- 948 views
dmesg reports: [19500.404765] 13755 (p): Uhuuh, elf segment at 0000000000400000 requested but the memory is mapped already
6. Re: Asking for help with Phix program under Linux
- Posted by RobertS Nov 08, 2022
- 912 views
That's bad news to me about Phix and Linux, but I hope that the problem is only temporary. Meanwhile, I'd still be grateful if someone tested my program on an older installation — I'd know, then, that the code works and all I have to do is wait (or I'd know I have to fix a few things). And also: might the compiled executable run on a recent Linux system, even if the Phix compiler won't? (Again, it's not for myself, I'm happy in my hate-love relationship with Windows, I'd just like to make my program available to the hypothetical Linux users who might possibly find it useful.)
7. Re: Asking for help with Phix program under Linux
- Posted by irv Nov 08, 2022
- 905 views
That's a good question - once compiled on an older version, would it run on new versions?
I'm willing to give it a try this evening...
8. Re: Asking for help with Phix program under Linux
- Posted by irv Nov 10, 2022
- 783 views
I ran Mint 18.1 from live DV.
However, I could not run or compile your hypatia program, because I got an error immediately. It's in line 41 of rsinput.e which calls:
scrn = video_config()
So... to test video_config(), I wrote a little program:
puts(1,"Video Config Test\n") object screen = video_config() ? screen
Video Config Test /home/irv/phix/builtins/pscreen.e:144 in procedure initI() attempt to divide by 0 ... called from /home/irv/phix/phix/builtins/pscreen.e:346 in function video_config() x = <novalue> y = <novalue> mx = <novalue> my = <novalue> res = <novalue> xCSBI = <novalue> ... called from /home/irv/phix/phix/vc.ex:2
So ... there appears to be a problem with pscreen.e, since I get this same error whether running on old or new Linux versions. It prevents me from going any further with your program.
The Linux version I used is: https://mirror2.sandyriver.net/pub/mint-packages/dists/serena/
9. Re: Asking for help with Phix program under Linux
- Posted by petelomax Nov 10, 2022
- 777 views
/home/irv/phix/builtins/pscreen.e:144 in procedure initI() attempt to divide by 0So ... there appears to be a problem with pscreen.e, it prevents me from going any further with your program.
Oh dear, there's nothing particularly magical about that, just massive big chunks of completely missing code.
(Does anyone have any ideas for implementing video_config() and friends on Linux??)
Anyway, I renamed trim() as trimm() in 9 places, you may or may not have to do the same:
hypatia\source\hy-lib.e:329 li = trim(li[1..$-1]) hypatia\source\hy-lib.e:439 in = trim(in) hypatia\source\hy.exw:176 t = trim(t) hypatia\source\hy.exw:322 rline = trim(rline) hypatia\source\hy.exw:438 cline = trim(cline) hypatia\source\hy.exw:473 line = trim(line) hypatia\source\rslib42.e:18 -- function trim(object s) hypatia\source\rslib42.e:95 global function trimm(object s) hypatia\source\rslib42.e:109 s[j] = trim(s[j])
to work around video_config() being completely absent on linux, I changed hypatia\source\rslib42.e lines 20..32:
-- object scrn -- for calling video_config() -- scrn = video_config() -- in_max = scrn[10] - length(prompt) - 1 in_max = iff(platform()=WINDOWS?video_config()[10]:80) - length(prompt) - 1
and hypatia\source\hy-lib.e lines 410..463:
-- object scrn -- for calling video_config() -- scrn = video_config() -- cols = scrn[10] cols = iff(platform()=WINDOWS?video_config()[10]:80)
10. Re: Asking for help with Phix program under Linux
- Posted by irv Nov 10, 2022
- 771 views
OK, I give this a try.
As I posted elsewhere, the "segfault" problem went away when I updated my kernel to 5.4.0-131-generic. But since the latest kernel is 5.15.x, who knows if an update to that is available or would help.
11. Re: Asking for help with Phix program under Linux
- Posted by RobertS Nov 11, 2022
- 799 views
Oh dear, there's nothing particularly magical about that, just massive big chunks of completely missing code.
(Does anyone have any ideas for implementing video_config() and friends on Linux??)
Anyway, I renamed trim() as trimm() in 9 places, you may or may not have to do the same:
hypatia\source\hy-lib.e:329 li = trim(li[1..$-1]) …
Thank you Irv and Pete for your efforts! When video_config() is missing under Linux, which is sad news to me, does that mean that get_position() and position() don't work, either? Well, my own fault, to write console programs …
Does the iff(platform()=WINDOWS?video_config()[10]:80) workaround mean that I can rely on 80 to be the default width of a Linux console window? I guess I could live with that, if get_position() and position() work, but if the user changes the window size that would mess things up. Well, they'd have to be told not to.
Btw, it seems you have an old version of my Hypatia code — the recent version is 0.991, and in it I have already renamed some of my own functions, trim among them, where in the age of Euphoria 3.1 I had unwittingly duplicated the names of Phix functions. Also, the input function now allows the user to scroll through past input lines, and edit and re-enter them. hypatia-rpn.net/linux.htm
Thanks again!
12. Re: Asking for help with Phix program under Linux
- Posted by petelomax Nov 11, 2022
- 719 views
When video_config() is missing under Linux, which is sad news to me, does that mean that get_position() and position() don't work, either? Well, my own fault, to write console programs …
position() is fine, but get_position() under Linux currently just returns {0,0} - the relevant code in builtins\VM\pFileioN.e is
-- position: elsif platform()=LINUX then printf(1,"\E[%d;%dH", {line, col}) -- get_position: --DEV OpenEuphoria maintains screen_line/col.. mov [posX],ebx mov [posY],ebx
I've updated the get_position() docs: Note that under Linux get_position() simply always returns {0,0}. I doubt it would be spectacularly difficult to maintain a couple of new variables in builtins\VM\pfileioN.e to keep track of the cursor position: fairly trivial for plain ascii, slightly trickier for embedded \r\n, but getting quite a bit thornier for embedded ncurses and unicode characters. It would probably be a safer bet for an application to maintain it's own x,y internally, if at all possible. </end doc update>
Of course as always I'm open to help and/or test programs, and should note that quite probably a good 70% of any such effort (all bar ncurses) could be done/verified on windows [too], iygwim.
(By ncurses I mean that "\E[%d;%dH" stuff, not quite sure its the right term for me to use.) I'm fine with any "works bar XYZ" solutions too, as long as XYZ sounds bearable.
Does the iff(platform()=WINDOWS?video_config()[10]:80) workaround mean that I can rely on 80 to be the default width of a Linux console window? I guess I could live with that, if get_position() and position() work, but if the user changes the window size that would mess things up. Well, they'd have to be told not to.
On the development sources/docs, I've cleaned up pscreen.e a bit, such that video_config() simply returns {1,3,25,80,0,0,32,1,25,80}, ie assumes a 25x80 screen. Should anyone know of any way to obtain the current terminal size (in characters), let me know. I've also just marked get/put_screen_char() and save/display_text_image() as strictly windows_only.
13. Re: Asking for help with Phix program under Linux
- Posted by RobertS Nov 12, 2022
- 697 views
I've uploaded a new version (0.991-02) that assumes 80 columns, and that uses prompt_string() instead of my editor, but that way it is only half the fun. Still, anyone who might be willing to test it, you need the new version, for otherwise even if Hypatia compiled and ran, you couldn't input anything.
I still hope that, one day, video_config() and get_position() will work with Linux, but there are probably more important problems to solve in the world. Anyway, thank you!
14. Re: Asking for help with Phix program under Linux
- Posted by irv Nov 12, 2022
- 703 views
Got the new version, it compiles and runs on Linux with 5.4.0-13-generic kernel, but 5.0.0-32-generic gives a seqfault, just as it does with all Phix programs.
15. Re: Asking for help with Phix program under Linux
- Posted by RobertS Nov 12, 2022
- 655 views
Got the new version, it compiles and runs on Linux with 5.4.0-13-generic kernel, but 5.0.0-32-generic gives a seqfault, just as it does with all Phix programs.
So, for the time being, I won't try to offer a Linux executable, but I'll update the documentation, include Linux, and tell Linux users that, if they feel adventurous and are able to install Phix on their system, they can compile the program, and to please tell me how it behaves.
So, yeah, not all dreams come true yet, but this is something. Thank you!