1. Phix - Cannot open autoinclude VM/pLen.e

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

new topic     » topic index » view message » categorize

2. Re: Phix - Cannot open autoinclude VM/pLen.e

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: Phix - Cannot open autoinclude VM/pLen.e

ghaberek said...

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Phix - Cannot open autoinclude VM/pLen.e

_tom said...

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: Phix - Cannot open autoinclude VM/pLen.e

petelomax said...

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: Phix - Cannot open autoinclude VM/pLen.e

I've been playing with Phix and signed up to ask about pretty much this very subject blink

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?

new topic     » goto parent     » topic index » view message » categorize

7. Re: Phix - Cannot open autoinclude VM/pLen.e

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

new topic     » goto parent     » topic index » view message » categorize

8. Re: Phix - Cannot open autoinclude VM/pLen.e

petelomax said...

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... 

petelomax said...

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:

  1. One or more paths specified on the command line (e.g. -I <path>)
  2. One or more paths specified by config file (e.g. eu.cfg)
  3. The current directory from where the command is run
  4. The original directory where the executable resides

-Greg

new topic     » goto parent     » topic index » view message » categorize

9. Re: Phix - Cannot open autoinclude VM/pLen.e

ghaberek said...
  1. One or more paths specified on the command line (e.g. -I <path>)
  2. One or more paths specified by config file (e.g. eu.cfg)
  3. The current directory from where the command is run
  4. The original directory where the executable resides

Right on, would love this as the out-of-the-box behaviour for Phix.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Phix - Cannot open autoinclude VM/pLen.e

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 
ghaberek said...

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).

ghaberek said...

Coming in off the street, I would expect any modern language to find its include files in this order:

  1. One or more paths specified on the command line (e.g. -I <path>)
  2. One or more paths specified by config file (e.g. eu.cfg)
  3. The current directory from where the command is run
  4. 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

new topic     » goto parent     » topic index » view message » categorize

11. Re: Phix - Cannot open autoinclude VM/pLen.e

ghaberek said...
petelomax said...

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

new topic     » goto parent     » topic index » view message » categorize

12. Re: Phix - Cannot open autoinclude VM/pLen.e

petelomax said...

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. pleased

petelomax said...

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

new topic     » goto parent     » topic index » view message » categorize

13. Re: Phix - Cannot open autoinclude VM/pLen.e

How about

--#include_path ../include 

ie as part of the source code rather than in a separate eu.cfg-type file?

new topic     » goto parent     » topic index » view message » categorize

14. Re: Phix - Cannot open autoinclude VM/pLen.e

petelomax said...

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu