Discussion:
pForth Compilation on Linux
(too old to reply)
Aimee Hesterman
2022-11-09 18:51:35 UTC
Permalink
Hi,

I just downloaded pForth v28 from Phil Burke's GitHub site and it compiled just fine using the UNIX makefile on Ubuntu. By default it somehow knew I was on a 64-bit machine so created a 64-bit version of pForth with a cell size of 8. I would like a cell size of 4 bytes, however, like on all the other Forths I have used.

It appears that there is a variable called 'cell_t' in the source which indicates the size of everything but cannot find any way to set that to 4. I'm not a C-programmer (or much of a programmer at all, really) so don't understand these things.

Does anyone know how to set this up so that I can get a cell size of 4 bytes or compile an i386 version of pForth on a 64-bit machine? Thanks for your help.

Nathan
minf...@arcor.de
2022-11-09 19:19:43 UTC
Permalink
Hi,
I just downloaded pForth v28 from Phil Burke's GitHub site and it compiled just fine using the UNIX makefile on Ubuntu. By default it somehow knew I was on a 64-bit machine so created a 64-bit version of pForth with a cell size of 8. I would like a cell size of 4 bytes, however, like on all the other Forths I have used.
It appears that there is a variable called 'cell_t' in the source which indicates the size of everything but cannot find any way to set that to 4. I'm not a C-programmer (or much of a programmer at all, really) so don't understand these things.
Does anyone know how to set this up so that I can get a cell size of 4 bytes or compile an i386 version of pForth on a 64-bit machine? Thanks for your help.
Modern Linuxes are all 64-bit today, so it might not be easy to compile a 32-bit pforth version.
Pointers will occupy 64 bits anyhow. But I don't know pforth really.

My suggestion: install a small 32-bit Linux in a virtual machine (eg Virtualbox) and compile
pforth from there. Or even simpler: do it in a USB drive e.g. with
https://antixlinux.com/
Aimee Hesterman
2022-11-09 20:08:27 UTC
Permalink
Post by ***@arcor.de
Hi,
I just downloaded pForth v28 from Phil Burke's GitHub site and it compiled just fine using the UNIX makefile on Ubuntu. By default it somehow knew I was on a 64-bit machine so created a 64-bit version of pForth with a cell size of 8. I would like a cell size of 4 bytes, however, like on all the other Forths I have used.
It appears that there is a variable called 'cell_t' in the source which indicates the size of everything but cannot find any way to set that to 4. I'm not a C-programmer (or much of a programmer at all, really) so don't understand these things.
Does anyone know how to set this up so that I can get a cell size of 4 bytes or compile an i386 version of pForth on a 64-bit machine? Thanks for your help.
Modern Linuxes are all 64-bit today, so it might not be easy to compile a 32-bit pforth version.
Pointers will occupy 64 bits anyhow. But I don't know pforth really.
My suggestion: install a small 32-bit Linux in a virtual machine (eg Virtualbox) and compile
pforth from there. Or even simpler: do it in a USB drive e.g. with
https://antixlinux.com/
Thanks! That's a great idea. I'll give it a shot.

Nathan
none) (albert
2022-11-09 20:52:21 UTC
Permalink
Post by Aimee Hesterman
Hi,
I just downloaded pForth v28 from Phil Burke's GitHub site and it compiled just fine using the
UNIX makefile on Ubuntu. By default it somehow knew I was on a 64-bit machine so created a
64-bit version of pForth with a cell size of 8. I would like a cell size of 4 bytes, however,
like on all the other Forths I have used.
It appears that there is a variable called 'cell_t' in the source which indicates the size of
everything but cannot find any way to set that to 4. I'm not a C-programmer (or much of a
programmer at all, really) so don't understand these things.
Does anyone know how to set this up so that I can get a cell size of 4 bytes or compile an i386
version of pForth on a 64-bit machine? Thanks for your help.
(I have "some" experience in c.)
I succeeded building a 32 bit version on Ubuntu by modifying these lines
in the Makefile (adding -m32)

CCOPTS = $(WIDTHOPT) -m32 -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)
LDFLAGS = $(XLDFLAGS) -m32

Result:

~/PROJECT/pforth/pforth/build/unix$ ls
Makefile pf_fileio_stdio.eo pf_io_none.o pf_save.eo pfcompil.o
pf_cglue.eo pf_fileio_stdio.o pf_io_posix.eo pf_save.o pfcustom.eo
pf_cglue.o pf_inner.eo pf_io_posix.o pf_text.eo pfcustom.o
pf_clib.eo pf_inner.o pf_main.eo pf_text.o pfdicdat.h
pf_clib.o pf_io.eo pf_main.o pf_words.eo pforth
pf_core.eo pf_io.o pf_mem.eo pf_words.o pforth.dic
pf_core.o pf_io_none.eo pf_mem.o pfcompil.eo pforth_standalone
~/PROJECT/pforth/pforth/build/unix$ pforth
PForth V27-LE/32, built Nov 9 2022 21:28:48
pForth loading dictionary from file pforth.dic
File format version is 9
Name space size = 120000
Code space size = 300000
Entry Point = 0
Cell Size = 4
Little Endian Dictionary

1 2 + . 3 ok
1 CELLS . 4 ok
Stack<10>
Post by Aimee Hesterman
Nathan
Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
***@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Aimee Hesterman
2022-11-10 18:35:11 UTC
Permalink
Post by none) (albert
Post by Aimee Hesterman
Hi,
I just downloaded pForth v28 from Phil Burke's GitHub site and it compiled just fine using the
UNIX makefile on Ubuntu. By default it somehow knew I was on a 64-bit machine so created a
64-bit version of pForth with a cell size of 8. I would like a cell size of 4 bytes, however,
like on all the other Forths I have used.
It appears that there is a variable called 'cell_t' in the source which indicates the size of
everything but cannot find any way to set that to 4. I'm not a C-programmer (or much of a
programmer at all, really) so don't understand these things.
Does anyone know how to set this up so that I can get a cell size of 4 bytes or compile an i386
version of pForth on a 64-bit machine? Thanks for your help.
(I have "some" experience in c.)
I succeeded building a 32 bit version on Ubuntu by modifying these lines
in the Makefile (adding -m32)
CCOPTS = $(WIDTHOPT) -m32 -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)
LDFLAGS = $(XLDFLAGS) -m32
~/PROJECT/pforth/pforth/build/unix$ ls
Makefile pf_fileio_stdio.eo pf_io_none.o pf_save.eo pfcompil.o
pf_cglue.eo pf_fileio_stdio.o pf_io_posix.eo pf_save.o pfcustom.eo
pf_cglue.o pf_inner.eo pf_io_posix.o pf_text.eo pfcustom.o
pf_clib.eo pf_inner.o pf_main.eo pf_text.o pfdicdat.h
pf_clib.o pf_io.eo pf_main.o pf_words.eo pforth
pf_core.eo pf_io.o pf_mem.eo pf_words.o pforth.dic
pf_core.o pf_io_none.eo pf_mem.o pfcompil.eo pforth_standalone
~/PROJECT/pforth/pforth/build/unix$ pforth
PForth V27-LE/32, built Nov 9 2022 21:28:48
pForth loading dictionary from file pforth.dic
File format version is 9
Name space size = 120000
Code space size = 300000
Entry Point = 0
Cell Size = 4
Little Endian Dictionary
1 2 + . 3 ok
1 CELLS . 4 ok
Stack<10>
Post by Aimee Hesterman
Nathan
Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
Thank you Albert!

I am in the process of downloading a 32-bit version of Linux Mint to compile pForth in VirtualBox. I will try your solution first, however, before I make a new virtual machine. Looks like a winner.

Nathan
Aimee Hesterman
2022-11-10 21:10:50 UTC
Permalink
Post by Aimee Hesterman
Post by none) (albert
Post by Aimee Hesterman
Hi,
I just downloaded pForth v28 from Phil Burke's GitHub site and it compiled just fine using the
UNIX makefile on Ubuntu. By default it somehow knew I was on a 64-bit machine so created a
64-bit version of pForth with a cell size of 8. I would like a cell size of 4 bytes, however,
like on all the other Forths I have used.
It appears that there is a variable called 'cell_t' in the source which indicates the size of
everything but cannot find any way to set that to 4. I'm not a C-programmer (or much of a
programmer at all, really) so don't understand these things.
Does anyone know how to set this up so that I can get a cell size of 4 bytes or compile an i386
version of pForth on a 64-bit machine? Thanks for your help.
(I have "some" experience in c.)
I succeeded building a 32 bit version on Ubuntu by modifying these lines
in the Makefile (adding -m32)
CCOPTS = $(WIDTHOPT) -m32 -x c -O2 $(FULL_WARNINGS) $(EXTRA_CCOPTS) $(DEBUGOPTS)
LDFLAGS = $(XLDFLAGS) -m32
~/PROJECT/pforth/pforth/build/unix$ ls
Makefile pf_fileio_stdio.eo pf_io_none.o pf_save.eo pfcompil.o
pf_cglue.eo pf_fileio_stdio.o pf_io_posix.eo pf_save.o pfcustom.eo
pf_cglue.o pf_inner.eo pf_io_posix.o pf_text.eo pfcustom.o
pf_clib.eo pf_inner.o pf_main.eo pf_text.o pfdicdat.h
pf_clib.o pf_io.eo pf_main.o pf_words.eo pforth
pf_core.eo pf_io.o pf_mem.eo pf_words.o pforth.dic
pf_core.o pf_io_none.eo pf_mem.o pfcompil.eo pforth_standalone
~/PROJECT/pforth/pforth/build/unix$ pforth
PForth V27-LE/32, built Nov 9 2022 21:28:48
pForth loading dictionary from file pforth.dic
File format version is 9
Name space size = 120000
Code space size = 300000
Entry Point = 0
Cell Size = 4
Little Endian Dictionary
1 2 + . 3 ok
1 CELLS . 4 ok
Stack<10>
Post by Aimee Hesterman
Nathan
Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
Thank you Albert!
I am in the process of downloading a 32-bit version of Linux Mint to compile pForth in VirtualBox. I will try your solution first, however, before I make a new virtual machine. Looks like a winner.
Nathan
Hi Albert,

I copied the lines you changed and added them to the makefile, commenting out those two existing lines, and get the following:

***@SAM:~/pforth-master-2022-11-09/platforms/unix$ make
c99 -m32 -x c -O2 --std=c89 -fsigned-char -fno-builtin -fno-unroll-loops -fno-keep-inline-functions -pedantic -Wcast-qual -Wall -Wwrite-strings -Winline -Wmissing-prototypes -Wmissing-declarations -g -I. -DPF_SUPPORT_FP -D_DEFAULT_SOURCE -D_GNU_SOURCE -c -o pf_cglue.o ../../csrc/pf_cglue.c
In file included from ../../csrc/pf_inc1.h:26,
from ../../csrc/pf_all.h:48,
from ../../csrc/pf_cglue.c:22:
/usr/include/string.h:26:10: fatal error: bits/libc-header-start.h: No such file or directory
26 | #include <bits/libc-header-start.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:79: pf_cglue.o] Error 1

I don't know why it would work on your Ubuntu install but not on mine. I'm using a new install of Ubuntu 22.04 LTS.

Nathan
Paul Rubin
2022-11-10 21:15:47 UTC
Permalink
... bits/libc-header-start.h: No such file or directory
I don't know why it would work on your Ubuntu install but not on mine.
Try "apt-get install gcc-multilib", You can usually find this type of
info by pasting the error message into a search engine.
Aimee Hesterman
2022-11-10 21:57:48 UTC
Permalink
... bits/libc-header-start.h: No such file or directory
I don't know why it would work on your Ubuntu install but not on mine.
Try "apt-get install gcc-multilib", You can usually find this type of
info by pasting the error message into a search engine.
Sorry. Thank you all. That did the trick!

Nathan
none) (albert
2022-11-10 22:36:31 UTC
Permalink
In article <ac4c535e-b0dd-48fd-8d27-***@googlegroups.com>,
Aimee Hesterman <***@gmail.com> wrote:
<SNIP>
Post by Aimee Hesterman
Hi Albert,
I copied the lines you changed and added them to the makefile, commenting out those two
c99 -m32 -x c -O2 --std=c89 -fsigned-char -fno-builtin -fno-unroll-loops
-fno-keep-inline-functions -pedantic -Wcast-qual -Wall -Wwrite-strings -Winline
-Wmissing-prototypes -Wmissing-declarations -g -I. -DPF_SUPPORT_FP -D_DEFAULT_SOURCE
-D_GNU_SOURCE -c -o pf_cglue.o ../../csrc/pf_cglue.c
In file included from ../../csrc/pf_inc1.h:26,
from ../../csrc/pf_all.h:48,
/usr/include/string.h:26:10: fatal error: bits/libc-header-start.h: No such file or directory
26 | #include <bits/libc-header-start.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:79: pf_cglue.o] Error 1
I don't know why it would work on your Ubuntu install but not on mine. I'm using a new install
of Ubuntu 22.04 LTS.
I have an ubuntu too:
Linux cherry 5.4.0-126-generic #142-Ubuntu SMP Fri Aug 26 12:12:57 UTC 2022 x86_64 x86_64 x86_
64 GNU/Linux

Note that you include string.h that should be legal, and then there is
a complaint that has nothing to do with pforth.

You can compile an hello world program, and insert string.h

-------------
#include <stdio.h>
#include <string.h>

int main(char **argv , int argc )
{
printf("Hello world\n");
}
------------
gcc -m32 hellow.c -o hellow
and
gcc hellow.c -o hellow
As this fails, there is something wrong with the installation of gcc.

Otherwise there is some weird interaction that can hardly be diagnosed
from afar.

And gcc is complicated. The man page runs 22.000 lines, mostly not relevant.
Post by Aimee Hesterman
Nathan
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
***@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Loading...