larsbrinkhoff / lbForth

Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
GNU General Public License v3.0
423 stars 113 forks source link

File not found #88

Closed Phi-Ho closed 3 years ago

Phi-Ho commented 3 years ago

Hello,

4.exe is a second generation meta compiled lbForth. It looks like it depends on some thing from the "src" folder (note this folder is renamed as "src_". 4.exe complains about this after displaying the banner before showing the ok prompt (and hangs):

PS F:\fun\lbforth\wsl.w4> ls

Directory: F:\fun\lbforth\wsl.w4

Mode LastWriteTime Length Name


d----- 2020-11-14 9:18 AM @HOME d----- 2020-11-14 9:47 AM bin d----- 2020-11-14 9:12 AM contrib d----- 2020-11-14 9:12 AM doc d----- 2020-11-14 9:12 AM experiments d----- 2020-11-14 9:12 AM lib d----- 2020-11-14 9:12 AM lisp d----- 2020-11-14 9:48 AM meta d----- 2020-11-14 9:12 AM src_ d----- 2020-11-14 9:12 AM targets d----- 2020-11-14 9:12 AM test -a---- 2020-11-14 9:11 AM 11560 4.exe

PS F:\fun\lbforth\wsl.w4> ./4 lbForth

File not found (4.exe hangs here)

Now, that 'src_' folder is renamed back to 'src': PS F:\fun\lbforth\wsl.w4> ls

Directory: F:\fun\lbforth\wsl.w4

Mode LastWriteTime Length Name


d----- 2020-11-14 9:18 AM @HOME d----- 2020-11-14 9:47 AM bin d----- 2020-11-14 9:12 AM contrib d----- 2020-11-14 9:12 AM doc d----- 2020-11-14 9:12 AM experiments d----- 2020-11-14 9:12 AM lib d----- 2020-11-14 9:12 AM lisp d----- 2020-11-14 9:48 AM meta d----- 2020-11-14 9:12 AM src d----- 2020-11-14 9:12 AM targets d----- 2020-11-14 9:12 AM test -a---- 2020-11-14 9:11 AM 11560 4.exe

PS F:\fun\lbforth\wsl.w4> ./4 lbForth ok

Now, the prompt is back to normal.

Any ideas?

Regards, phiho

Phi-Ho commented 3 years ago

P.S: Actually, this behavior seems to be inherited from the first generation (generated by 'make clean all TARGET=x86 OS=windows). These two files were moved to 'bin' subfolder:

Directory: F:\fun\lbforth\wsl.w4\bin

Mode LastWriteTime Length Name


-a---- 2020-11-14 4:03 AM 11560 forth.exe -a---- 2020-11-14 4:03 AM 11560 x86-forth.exe

PS F:\fun\lbforth\wsl.w4\bin> ./forth lbForth

File not found

larsbrinkhoff commented 3 years ago

This is the expected behaviour. By default, src, the "system directory" (installation target), and the current directory is searched. This is from kernel.fth:

   s" src/" searched \ UGLY HACK
   sysdir searched
   s" " searched

sysdir is defined in the Makefile; the default is /usr/local/share/lbForth.

The lbForth .exe file only has a very minimal set of words, and depends on files in src to build up a full Forth. The most important file is core.fth.

Phi-Ho commented 3 years ago

Thanks, it's good to know that lbForth is minimal at boot up and loading other words afterward.

Great design, thanks again.

Cheers,

phiho