1. Phix - Cannot open autoinclude VM/pLen.e
- Posted by ghaberek (admin) Jul 21, 2017
- 2005 views
I installed Phix to /usr/local/Phix and now it cannot find its include files. Do I really need to ensure the directory ends with "Phix" or is that a Windows thing?
$ p test.ex "/home/greg/Projects/phix-test" Cannot open autoinclude VM/pLen.e in /home/greg/Projects/phix-test/, /home/greg/Projects/phix-test/builtins/VM/, or /home/greg/Projects/phix-test/builtins/. Press Enter, or d for diagnostics...
$ which p /usr/local/Phix/p
$ cat test.ex sequence s = {} ? length(s)
-Greg
2. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by _tom (admin) Jul 21, 2017
- 1952 views
Got to clarify how to install Phix on linux. Goes to my original observation that I don't understand your installation instructions.
Running Phix in VirtualBox is fun but not practical.
_tom
3. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by petelomax Jul 21, 2017
- 2002 views
I installed Phix to /usr/local/Phix and now it cannot find its include files. Do I really need to ensure the directory ends with "Phix" or is that a Windows thing?
$ p test.ex "/home/greg/Projects/phix-test" Cannot open autoinclude VM/pLen.e in /home/greg/Projects/phix-test/, /home/greg/Projects/phix-test/builtins/VM/, or /home/greg/Projects/phix-test/builtins/. Press Enter, or d for diagnostics...
$ which p /usr/local/Phix/p
$ cat test.ex sequence s = {} ? length(s)
-Greg
Sorry, never did test installing anywhere other than $HOME/phix - more than anything else, 0.7.6 was posted out of relief that lnx64 had finally started to work.
I note that ptok.e still contains a couple of
--DEV (temp) if platform()=LINUX then if match("./",path)=1 then path = getenv("HOME")&"/phix/"&path[3..$] end if end if
iirc, the /phix path thing was mainly for pgui to find demo\pGUI\win32|64, so while we're installing iup/im/cd by hand, then maybe not, but I can't be sure.
I'll have to investigate...
Pete
4. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by petelomax Jul 21, 2017
- 1962 views
Got to clarify how to install Phix on linux. Goes to my original observation that I don't understand your installation instructions.
I am currently working on improving the downloads page with a bit of javascript/css, something perhaps a bit like https://lmms.io/download but probably not quite as slick - the main thing being to hide the instructions for other platforms, and maybe even reduce things to one or two scripts.
Pete
5. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by ghaberek (admin) Jul 21, 2017
- 1944 views
Sorry, never did test installing anywhere other than $HOME/phix - more than anything else, 0.7.6 was posted out of relief that lnx64 had finally started to work.
I note that ptok.e still contains a couple of
--DEV (temp) if platform()=LINUX then if match("./",path)=1 then path = getenv("HOME")&"/phix/"&path[3..$] end if end if
iirc, the /phix path thing was mainly for pgui to find demo\pGUI\win32|64, so while we're installing iup/im/cd by hand, then maybe not, but I can't be sure.
I'll have to investigate...
That's a no-go on simply moving the directory to /home/greg/phix. I look forward to your diagnosis. I'll dig around as well. Curious to learn the inner-workings of Phix.
-Greg
6. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by hakon Jul 23, 2017
- 1938 views
I've been playing with Phix and signed up to ask about pretty much this very subject
My case isn't too dissimilar to what ghaberek described, except I installed to a location in my home dir then created a symbolic link to it inside /usr/local/bin.
What I immediately searched for was a command line arg to set the include path, but couldn't find one. It would be great if multiple include paths were supported though (with a default something like the phix installation directory first, then the directory in which phix is invoked second, etc), unless there's an existing and better way I'm missing?
7. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by petelomax Jul 23, 2017
- 1877 views
You might get somewhere by setting the environment variable EUINC (;-separated)...
Phix does not currently do this, but I certainly wouldn't have any problem with say p -EUINC="x;y;z" (or similar) overriding any internal getenv("EUINC") calls, if that would work.
Pete
8. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by ghaberek (admin) Jul 24, 2017
- 1842 views
You might get somewhere by setting the environment variable EUINC (;-separated)...
No dice.
$ echo $EUDIR /home/greg/phix
$ p test.ex "/home/greg/Projects/phix-test" Cannot open autoinclude VM/pLen.e in /home/greg/Projects/phix-test/, /home/greg/Projects/phix-test/builtins/VM/, /home/greg/Projects/phix-test/builtins/, or /home/greg/phix/include/. Press Enter, or d for diagnostics...
Phix does not currently do this, but I certainly wouldn't have any problem with say p -EUINC="x;y;z" (or similar) overriding any internal getenv("EUINC") calls, if that would work.
I'm curious, why are you using (or even supporting) EUDIR in the first place?
Coming in off the street, I would expect any modern language to find its include files in this order:
- One or more paths specified on the command line (e.g. -I <path>)
- One or more paths specified by config file (e.g. eu.cfg)
- The current directory from where the command is run
- The original directory where the executable resides
-Greg
9. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by hakon Jul 24, 2017
- 1810 views
- One or more paths specified on the command line (e.g. -I <path>)
- One or more paths specified by config file (e.g. eu.cfg)
- The current directory from where the command is run
- The original directory where the executable resides
Right on, would love this as the out-of-the-box behaviour for Phix.
10. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by petelomax Jul 24, 2017
- 1808 views
I think I've found the main culprit - command_line() on Linux was not yielding full paths like it does on Windows.
I've pushed a new builtins/VM/pcmdlnN.e; line 316, after
for i=1 to N do res = append(res,peek_string(peekNS(pArg4*4+i*W+W,W,0))) end for
insert
string r1 = res[1] if get_file_type(r1)!=FILETYPE_FILE then sequence s = split(getenv("PATH"),':') for i=1 to length(s) do string sir = join_path({s[i],r1}) if get_file_type(sir)=FILETYPE_FILE then res[1] = sir exit end if end for end if if length(res)>=2 then string r2 = res[2] if get_file_type(r2)!=FILETYPE_FILE then string cdr = join_path({current_dir(),r2}) if get_file_type(cdr)=FILETYPE_FILE then res[2] = cdr end if end if end if
I'm curious, why are you using (or even supporting) EUDIR in the first place?
It probably made a bit more sense back in the 2.4..3.1 days, and should probably be ripped out now (especially since we just proved it useless).
Coming in off the street, I would expect any modern language to find its include files in this order:
- One or more paths specified on the command line (e.g. -I <path>)
- One or more paths specified by config file (e.g. eu.cfg)
- The current directory from where the command is run
- The original directory where the executable resides
That all looks good, but....
That change above is probably equivalent to the fourth one, and I'm pretty sure the third is already covered.
While -I might be a handy programmer shortcut, it has implications for code sharing and customer installations - if you don't know what to put after the -I you'll never get the code to run, ditto eu.cfg.
The executable 'p' and the directory 'builtins' really ought to be in the same place (and it was just a stupid bug that the compiler didn't know how to figure that one out), and "stub includes" just feel better to me, for instance builtins\pGUI.e is just "include ../demo/pGUI/pGUI.e", which is obviously per-machine, and per-project is very similar - all virtually equivalent to eu.cfg files anyway.
I won't dig me heels in against doin it your way, but I'm not keen.
Pete
11. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by petelomax Jul 24, 2017
- 1808 views
You might get somewhere by setting the environment variable EUINC (;-separated)...
No dice.
$ echo $EUDIR /home/greg/phix
$ p test.ex "/home/greg/Projects/phix-test" Cannot open autoinclude VM/pLen.e in /home/greg/Projects/phix-test/, /home/greg/Projects/phix-test/builtins/VM/, /home/greg/Projects/phix-test/builtins/, or /home/greg/phix/include/. Press Enter, or d for diagnostics...
I just realised, not that it probably matters now, but it might have got further with EUDIR=/home/greg/phix;/home/greg/phix/builtins
12. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by ghaberek (admin) Jul 24, 2017
- 1820 views
I think I've found the main culprit - command_line() on Linux was not yielding full paths like it does on Windows.
I've pushed a new builtins/VM/pcmdlnN.e; line 316, after
Excellent. That worked perfectly. I now have a working Phix install on Linux.
That all looks good, but....
That change above is probably equivalent to the fourth one, and I'm pretty sure the third is already covered.
While -I might be a handy programmer shortcut, it has implications for code sharing and customer installations - if you don't know what to put after the -I you'll never get the code to run, ditto eu.cfg.
The executable 'p' and the directory 'builtins' really ought to be in the same place (and it was just a stupid bug that the compiler didn't know how to figure that one out), and "stub includes" just feel better to me, for instance builtins\pGUI.e is just "include ../demo/pGUI/pGUI.e", which is obviously per-machine, and per-project is very similar - all virtually equivalent to eu.cfg files anyway.
I won't dig me heels in against doin it your way, but I'm not keen.
For larger projects, I tend to organize files into separate src and include directories, and having eu.cfg really helps. Maybe just that one project has certain include files that I don't need or want available globally.
IMHO, I don't think it's a good idea to ever hard-code a path like this. Either it searches relative to its own paths, or the user specifies the path manually, or both.
-Greg
13. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by petelomax Jul 26, 2017
- 1765 views
How about
--#include_path ../include
ie as part of the source code rather than in a separate eu.cfg-type file?
14. Re: Phix - Cannot open autoinclude VM/pLen.e
- Posted by ghaberek (admin) Jul 26, 2017
- 1789 views
How about
--#include_path ../include
ie as part of the source code rather than in a separate eu.cfg-type file?
Does it have to be a comment? In my old EG interpreter I had added an include_path keyword. It was very helpful in the days before eu.cfg.
include_path "../include/" include "library.e"
I feel like a configuration file is more portable. If I give someone my source code for something, I want them to be able to configure their environment around the code without actually modifying the code.
-Greg