forthy42 / gforth Goto Github PK
View Code? Open in Web Editor NEWGforth mirror on GitHub (original is on Savannah)
License: GNU General Public License v3.0
Gforth mirror on GitHub (original is on Savannah)
License: GNU General Public License v3.0
I attempted to build from source using the instructions in install.md
.
When doing so, I hit the following error:
libtoolize: error: '/usr/share/aclocal/ltdl.m4' does not exist.
I was able to solve the problem by simply running
sudo apt-get install libltdl-dev
My question is: was this a configuration error on my part? If it is actually a required dependency for installation, I would be more than happy to update install.md
and submit a pull request.
$ gforthmi /tmp/foo.fi unix/socket.fs
code offset=195836027088
xt offset=195836027056
label offset=195836027024
start size dp
7F0B20AA7068 800000 1D5B20
7F0B208A6000 200000 4738
7F0B20825000 80000 628
7F0B21908000 20000 100
start size dp
7FAD05DC8228 800000 1D5B20
7FAD05BC7000 200000 4738
7FAD05B46000 80000 628
7FAD06C29000 20000 100
50F0 7F0B2080DEF8 7FAD05B2EEF8
5160 5567E1501A38 55957A0CBA38
5170 7F0B21757800 7FAD06A78800
5178 7F0B21758520 7FAD06A79520
5180 7F0B21758440 7FAD06A79440
51C0 5567E15067F0 55957A0D07F0
51C8 5567E1501AA0 55957A0CBAA0
51E8 5567E1501660 55957A0CB660
1B1D0 5567E14D4EC0 55957A09EEC0
1B238 7FFFA74BA0D0 7FFEF1AF6610
1D3D0 5567E14D4C10 55957A09EC10
296D8 5567E14DD1D0 55957A0A71D0
2E448 5567E1506DF8 55957A0D0DF8
2E620 5567E1506DD0 55957A0D0DD0
3AD78 5567E1503B70 55957A0CDB70
47F78 5567E14F9230 55957A0C3230
4DF38 5567E14B82F0 55957A0822F0
60AF0 5567E1504BE0 55957A0CEBE0
60FF0 5567E1501770 55957A0CB770
61028 5567E1501920 55957A0CB920
67598 5567E1501C00 55957A0CBC00
89630 7F0B21904211 7FAD06C25211
896C8 7F0B2190423D 7FAD06C2523D
89710 7F0B2190426A 7FAD06C2526A
89758 7F0B21904298 7FAD06C25298
897A0 7F0B219042C8 7FAD06C252C8
897E8 7F0B219042F8 7FAD06C252F8
89888 7F0B21904368 7FAD06C25368
898D0 7F0B21904392 7FAD06C25392
89918 7F0B219043C0 7FAD06C253C0
89A28 7F0B21904425 7FAD06C25425
89A80 7F0B21904459 7FAD06C25459
89AD0 7F0B2190447B 7FAD06C2547B
89B20 7F0B2190449E 7FAD06C2549E
89C40 5567E1505400 55957A0CF400
89C90 7F0B218FF3BE 7FAD06C203BE
89CD0 7F0B218FF3E4 7FAD06C203E4
89D20 7F0B218FF408 7FAD06C20408
89D68 7F0B218FF42D 7FAD06C2042D
89F40 7F0B218FF53D 7FAD06C2053D
89F98 7F0B218FF5A1 7FAD06C205A1
89FE0 7F0B218FF5D6 7FAD06C205D6
8A100 7F0B218FF6B2 7FAD06C206B2
8A198 7F0B218FF70C 7FAD06C2070C
8A1D8 7F0B218FF731 7FAD06C20731
8A610 7F0B218FFA6A 7FAD06C20A6A
8AEC0 BC14 BC15
1CCE10 5567E1504DB8 55957A0CEDB8
1CE680 5567E1504DB8 55957A0CEDB8
1CE740 5567E1504DB8 55957A0CEDB8
1CE780 5567E1504DB8 55957A0CEDB8
1CEA90 5567E1504DB8 55957A0CEDB8
1CEAE0 5567E1504DB8 55957A0CEDB8
1CEC60 5567E1504DB8 55957A0CEDB8
1CECB0 5567E1504DB8 55957A0CEDB8
1CEF90 5567E1504DB8 55957A0CEDB8
1CF090 5567E1504DB8 55957A0CEDB8
1CF5C0 5567E1504DB8 55957A0CEDB8
1CF600 5567E1504DB8 55957A0CEDB8
1CFE40 5567E1507798 55957A0D1798
1CFE50 5567E1506DF8 55957A0D0DF8
1CFE90 5567E1504DB8 55957A0CEDB8
1CFEA0 5567E1507798 55957A0D1798
1CFED0 5567E1506D98 55957A0D0D98
1CFEE0 5567E1506DF8 55957A0D0DF8
1CFF00 5567E1507798 55957A0D1798
1CFF30 5567E1507798 55957A0D1798
1CFF40 5567E1506DF8 55957A0D0DF8
1D0860 5567E1504DB8 55957A0CEDB8
1D0870 5567E1507798 55957A0D1798
1D0880 5567E1506D98 55957A0D0D98
1D08D0 5567E1506DF8 55957A0D0DF8
1D0C40 5567E1504DB8 55957A0CEDB8
1D0C50 5567E1507798 55957A0D1798
1D0C60 5567E1506D98 55957A0D0D98
1D0CB0 5567E1506DF8 55957A0D0DF8
$ ./foo.fi
*the terminal*:0:-94170757775551: error: Invalid memory address
>>><<<
Backtrace:
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/kernel/int.fs:530:9: 0 $7F19F906E7C8 @
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/libcc.fs:1060:15: 1 $7F19F8DDF400 >does-code
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/kernel/tools.fs:108:17: 2 $7F19F9084B00 execute
3 $55D323A55DC8
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/libcc.fs:1060:8: 4 $7F19F8DDF3E0
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/libcc.fs:1068:19: 5 $7F19F8E62DA8 traverse-wordlist
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/search.fs:214:30: 6 $7F19F9087AD8 execute
7 $7F19F908F4B8
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/libcc.fs:1060:5: 8 $7F19F8E62D78
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/libcc.fs:1068:40: 9 $7F19F90CA168 map-vocs
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/libcc.fs:1096:28: 10 $7F19F90CA368 rebind-libcc
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/gforthrc.fs:22:17: 11 $7F19F90CAB88
/tmp/gforth-0.7.9_20201105/share/gforth/0.7.9_20201105/ansi.fs:177:27: 12 $7F19F90CC6B8
cd engine && make DOSTRIP=true gforth-prof-noll OPT=-noll OPTDEFINES= OPTOBJECTS=dblsub.o
make[1]: Entering directory '/tmp/gforth-git/engine'
gcc -Wl,--export-dynamic -pthread engine-prof-noll.o main-prof-noll.o io.o signals.o support-noll.o pub.o -ldl -lrt -lltdl -lm libmain.o profile-noll.o -ldl -lrt -lltdl -lm -o gforth-prof-noll
/usr/bin/ld: main-prof-noll.o: in function `optimize_rewrite.constprop.0':
main.c:(.text+0xb16): undefined reference to `reserve_code_super'
/usr/bin/ld: main-prof-noll.o: in function `compile_prim1':
main.c:(.text+0x1922): undefined reference to `append_jump'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:180: gforth-prof-noll] Error 1
make[1]: Leaving directory '/tmp/gforth-git/engine'
make: *** [Makefile:1271: gforth-prof] Error 2
To reproduce:
./autogen.sh
./configure --without-debug --enable-prof
make install
Thoughts?
Edit: Same happens with ./BUILD-FROM-SCRATCH --without-debug --enable-prof
.
Edit 2: ./BUILD-FROM-SCRATCH --without-debug
works, but with --enable-prof
it does NOT work. Seems like --enable-prof
is at fault here, with that I get the above error.
It would be nice if I could get rid of -g
when compiling with --without-debug
by the way. I do not know what --without-debug
does exactly, if anything.
On Android, please make possible using standard long tap options: Copy, Paste etc.
It will drastically simplify the process of code development.
I tried to upgrade Gforth.
git pull
make clean ; make -j 8
The last lines are:
make[1]: Leaving directory '/work/repo/gforth/engine'
ln -s -f engine/libgforth-ditc libgforth-ditc
chcon -t unconfined_execmem_exec_t libgforth-ditc || true
chcon: can't apply partial context to unlabeled file ‘libgforth-ditc’
How to fix this issue?
The OS is Debian GNU/Linux 8.7 (jessie)
gcc version 4.9.2
Gforth 0.7.9_20200618
Input:
'|' parse "test passed"| forth-recognizer recognize .s
Output:
*the terminal*:1:24: error: Undefined word
'|' parse "test passed">>>|<<< forth-recognizer recognize .s
Backtrace:
kernel/int.fs:572:10 0 $7F92D3400CA0 throw
trying to package the newest version for nixpkgs, and i'm running into a lot of build failures, i think this might be the root cause.
For the unix/socket.fs code, I had a project where I wanted to use the 'open-socket' code, but needed to set a socket option during socket creation. I ended up modifying the socket.fs as follows:
diff foo/socket.fs socket.fs
354a355,357
> defer get-socket-options
> :noname ; is get-socket-options
>
357a361
> get-socket-options
This enabled me to add the following in my program:
6 constant IPPROTO_TCP
7 constant TCP_SYNCNT
create SYN_COUNT 1 ,
:noname dup IPPROTO_TCP TCP_SYNCNT SYN_COUNT 4 setsockopt ?ior ;
is get-socket-options
It seems like this sort of strategy might be helpful for others who want an abstract socket library, but may need to customize its operation. Using some deferred words as callbacks makes this pretty easy, and (I think) elegant, without a significant penalty. The alternative for me was to duplicate a bunch of the socket.fs code in my program, which defeats the purpose of having a library, IMO.
Example code:
C-LIBRARY <stdlib.h>
c-function stdlib_abs abs n -- n
-3 stdlib_abs .
Output:
-3 stdlib_abs .
*the terminal*:11:4: error: Called function of unfinished named C library
-3 >>>stdlib_abs<<< .
Backtrace:
libcc.fs:1027:20: 0 $7F9979D98E30 throw
libcc.fs:918:2: 1 $7F9979D98138 compile-wrapper-function
libcc.fs:932:12: 2 $7F9979D98340 ?compile-wrapper
Any ideas as to why? This code works with the old gforth 0.7.3, apart from C-LIBRARY <stdlib.h>
being \c #include <stdlib.h>
instead.
I'm interested in embedding (g)forth into my own application and calling some c-functions from forth. My understanding is that unix/example.c
provides an example on how to do this. The corresponding commit also mention an example.fs
, however, this file appears to be missing.
Is it possible to call a c-function from embedded forth, without compiling the c-function into a shared library?
Happy New Year!
Perhaps, Android - related issues have to be reported somewhere else... In case it applies, please see my report below.
I am running "Gforth ITC" on Android 7.0 with Huawei EMUI 5.0.4 on the top.
While running require minos2/widgets-test.fs
, I am getting the following error message:
in file included from the terminal:1 /sdcard/gforth/current/minos2/widgets-test.fs:32: error: Undefined word glue*2 $7FFFFFFF color, ' atlas-tex >>>}}1image<<< dup .button2 simple[] value f6
Backtrace: 0 $72CF8F0248 throw
require minos2/gl-sample.fs
seems to work without problems.
Gforth ITC reports the following version: 0.7.9_20190124.
The problem was also observed for a previous version of the Android gforth package.
Thanks!
I admit I don't understand autotools, and I am effectively stopped. but I thought I'd share this transcript in case you find it useful. There are only three commands: "autoreconf -i", "./configure", "make". I got the same results using the latest release, 0.7.9 I believe. Following the instructions in "INSTALL", noticing there is no file "./configure", having a prior failure running "autoconf", googling a bit and taking a glue from nickjcroucher/gubbins#130, I ran "autoreconf -i". The final error message from "make" is about things far deeper than I understand, so it's pretty hopeless for me to try to fix this.
~/Documents/GitHub/gforth on master ⌚ 6:05:46
$ autoreconf -i
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './compile'
libtoolize: copying file './config.guess'
libtoolize: copying file './config.sub'
libtoolize: copying file './depcomp'
libtoolize: copying file './install-sh'
libtoolize: copying file './missing'
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltargz.m4'
libtoolize: copying file 'm4/ltdl.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: putting libltdl files in LT_CONFIG_LTDL_DIR, 'libltdl'.
libtoolize: copying file 'libltdl/COPYING.LIB'
libtoolize: creating file 'libltdl/Makefile.am'
libtoolize: copying file 'libltdl/README'
libtoolize: creating file 'libltdl/configure.ac'
libtoolize: copying file 'libltdl/aclocal.m4'
libtoolize: creating file 'libltdl/Makefile.in'
libtoolize: copying file 'libltdl/config-h.in'
libtoolize: creating file 'libltdl/configure'
libtoolize: copying file 'libltdl/libltdl/lt__alloc.h'
libtoolize: copying file 'libltdl/libltdl/lt__argz_.h'
libtoolize: copying file 'libltdl/libltdl/lt__dirent.h'
libtoolize: copying file 'libltdl/libltdl/lt__glibc.h'
libtoolize: copying file 'libltdl/libltdl/lt__private.h'
libtoolize: copying file 'libltdl/libltdl/lt__strl.h'
libtoolize: copying file 'libltdl/libltdl/lt_dlloader.h'
libtoolize: copying file 'libltdl/libltdl/lt_error.h'
libtoolize: copying file 'libltdl/libltdl/lt_system.h'
libtoolize: copying file 'libltdl/libltdl/slist.h'
libtoolize: copying file 'libltdl/loaders/dld_link.c'
libtoolize: copying file 'libltdl/loaders/dlopen.c'
libtoolize: copying file 'libltdl/loaders/dyld.c'
libtoolize: copying file 'libltdl/loaders/load_add_on.c'
libtoolize: copying file 'libltdl/loaders/loadlibrary.c'
libtoolize: copying file 'libltdl/loaders/preopen.c'
libtoolize: copying file 'libltdl/loaders/shl_load.c'
libtoolize: copying file 'libltdl/lt__alloc.c'
libtoolize: copying file 'libltdl/lt__argz.c'
libtoolize: copying file 'libltdl/lt__dirent.c'
libtoolize: copying file 'libltdl/lt__strl.c'
libtoolize: copying file 'libltdl/lt_dlloader.c'
libtoolize: copying file 'libltdl/lt_error.c'
libtoolize: copying file 'libltdl/ltdl.c'
libtoolize: copying file 'libltdl/ltdl.h'
libtoolize: copying file 'libltdl/slist.c'
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
~/Documents/GitHub/gforth on master! ⌚ 6:05:59
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/x86_64-linux-gnu-ld
checking if the linker (/usr/bin/x86_64-linux-gnu-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/x86_64-linux-gnu-ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... gawk
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/x86_64-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking what extension is used for runtime loadable modules... .so
checking what variable specifies run-time module search path... LD_LIBRARY_PATH
checking for the default library search path... /lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib/i386-linux-gnu /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/local/lib/i686-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32
checking for library containing dlopen... -ldl
checking for dlerror... yes
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dld_link in -ldld... no
checking for _ prefix in compiled symbols... no
checking whether deplibs are loaded by dlopen... yes
checking for argz.h... yes
checking for error_t... yes
checking for argz_add... yes
checking for argz_append... yes
checking for argz_count... yes
checking for argz_create_sep... yes
checking for argz_insert... yes
checking for argz_next... yes
checking for argz_stringify... yes
checking if argz actually works... yes
checking whether libtool supports -dlopen/-dlpreopen... yes
checking for ltdl.h... yes
checking whether lt_dlinterface_register is declared... yes
checking for lt_dladvise_preload in -lltdl... yes
checking where to find libltdl headers...
checking where to find libltdl library... -lltdl
checking for unistd.h... (cached) yes
checking for dl.h... no
checking for sys/dl.h... no
checking for dld.h... no
checking for mach-o/dyld.h... no
checking for dirent.h... yes
checking for closedir... yes
checking for opendir... yes
checking for readdir... yes
checking for strlcat... no
checking for strlcpy... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether to use two dispatches per conditional branch... 1
checking make type... GNU Make
checking whether the linker accepts -Wl,--export-dynamic... yes
checking for __builtin___clear_cache... yes
Check for arch/amd64//gforth.ld (false)
checking size of char *... 8
checking size of void *... 8
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of intptr_t... 8
checking size of int128_t... 0
checking size of uint128_t... 0
checking for a C type for cells... long
checking for a C type for wydes... short
checking for a C type for tetrabytes... int
checking for a C type for octabytes... long
checking for a C type for double-cells... none
checking for a C type for unsigned double-cells... none
checking for off_t... yes
checking size of off_t... 8
checking if gcc understands -fno-gcse... yes
checking if gcc understands -fcaller-saves... yes
checking if gcc understands -fno-defer-pop... yes
checking if gcc understands -fno-inline... yes
checking if gcc understands -fwrapv... yes
checking if gcc understands -fchar-unsigned...
checking if gcc understands -fno-strict-aliasing... yes
checking if gcc understands -fno-cse-follow-jumps... yes
checking if gcc understands -fno-reorder-blocks... yes
checking if gcc understands -fno-reorder-blocks-and-partition... yes
checking if gcc understands -fno-toplevel-reorder... yes
checking if gcc understands -fno-trigraphs...
checking if gcc understands -falign-labels=1... yes
checking if gcc understands -falign-loops=1... yes
checking if gcc understands -falign-jumps=1... yes
checking if gcc understands -fno-delete-null-pointer-checks... yes
checking if gcc understands -pthread... yes
checking if gcc understands -Wimplicit-function-declaration...
checking how to suppress 'unused variable' warnings... __attribute__((unused))
checking whether gcc understands '__thread'... yes
checking how to invoke m4... m4 -s
checking for install-info... /usr/bin/install-info
checking for chcon... chcon -t unconfined_execmem_exec_t
checking whether byte ordering is bigendian... no
checking if and how we can waste code space... .skip 16
checking if and how we can do comments in asm statements... "# "
checking whether ln -s works... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for texi2dvi4a2ps... no
checking for texi2dvi... texi2dvi
checking for emacs... emacs
checking for glibtool... no
checking for libtool... libtool
checking for asin in -lm... yes
checking for lt_dlinit in -lltdl... yes
checking for clock_gettime in -lrt... yes
checking ffi.h usability... yes
checking ffi.h presence... yes
checking for ffi.h... yes
checking for ffi_call in -lffi... yes
checking for __builtin_avcall in -lavcall... no
checking for working memcmp... yes
checking for dlopen in -ldl... yes
checking for memmove... yes
checking for strtoul... yes
checking for pow10... no
checking for sincos... yes
checking for strerror... yes
checking for strsignal... yes
checking for atanh... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for ftello... yes
checking for dlopen... yes
checking for sys_siglist... yes
checking for getrusage... yes
checking for nanosleep... yes
checking for clock_gettime... yes
checking for stack_t... yes
checking whether sys_siglist is declared... yes
checking for getopt_long... yes
checking for expm1... yes
checking for log1p... yes
checking for mcheck... yes
checking for mprobe... yes
checking for rint... yes
checking for ecvt_r... (cached) no
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/epoll.h usability... yes
checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking fnmatch.h usability... yes
checking fnmatch.h presence... yes
checking for fnmatch.h... yes
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking endian.h usability... yes
checking endian.h presence... yes
checking for endian.h... yes
checking spawn.h usability... yes
checking spawn.h presence... yes
checking for spawn.h... yes
checking for wcwidth... yes
checking for working POSIX fnmatch... yes
checking for mmap... yes
checking for sysconf... yes
checking for getpagesize... yes
checking for pselect... yes
checking for pthread_setaffinity_np... yes
checking for emacs... (cached) emacs
checking where .elc files should go... ${datadir}/emacs/site-lisp
checking for __builtin_clzl... yes
checking for __builtin_bswap16... yes
checking for __builtin_bswap32... yes
checking for __builtin_bswap64... yes
checking for atomic builtins (__sync_...)... true
checking for gforth... echo "You need to configure with a gforth in \$PATH to build this part" && false
checking for swig... /usr/bin/swig
swig error : Unrecognized option -forth
Use 'swig -help' for available options.
configure: WARNING: *** Swig without -forth. Building library buildings from tarball.
configure: creating ./config.status
config.status: creating kernel/version.fs
config.status: creating Makefile
config.status: creating Makedist
config.status: creating gforthmi
config.status: creating gforthmi.sh
config.status: creating vmgen
config.status: creating machpc.fs
config.status: creating envos.fs
config.status: creating preforth
config.status: creating libforth
config.status: creating gforthker
config.status: creating engine/Makefile
config.status: WARNING: 'engine/Makefile.in' seems to ignore the --datarootdir setting
config.status: creating engine/gforth.h
config.status: creating doc/version.texi
config.status: creating doc/Makefile
config.status: creating unix/Makefile
config.status: creating debian/changelog
config.status: creating debian/control
config.status: creating build-ec
config.status: creating engine/config.h
config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing stamp-h commands
mkdir -p -- include/gforth/0.7.9_20180905/amd64
=== configuring in libltdl (/home/rebcabin/Documents/GitHub/gforth/libltdl)
configure: running /bin/bash ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/x86_64-linux-gnu-ld
checking if the linker (/usr/bin/x86_64-linux-gnu-ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/x86_64-linux-gnu-ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/x86_64-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking what extension is used for runtime loadable modules... .so
checking what variable specifies run-time module search path... LD_LIBRARY_PATH
checking for the default library search path... /lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib/i386-linux-gnu /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/local/lib/i686-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32
checking for library containing dlopen... -ldl
checking for dlerror... yes
checking for shl_load... (cached) no
checking for shl_load in -ldld... (cached) no
checking for dld_link in -ldld... no
checking for _ prefix in compiled symbols... no
checking whether deplibs are loaded by dlopen... yes
checking for argz.h... yes
checking for error_t... yes
checking for argz_add... yes
checking for argz_append... yes
checking for argz_count... yes
checking for argz_create_sep... yes
checking for argz_insert... yes
checking for argz_next... yes
checking for argz_stringify... yes
checking if argz actually works... yes
checking whether libtool supports -dlopen/-dlpreopen... yes
checking for unistd.h... (cached) yes
checking for dl.h... no
checking for sys/dl.h... no
checking for dld.h... no
checking for mach-o/dyld.h... no
checking for dirent.h... yes
checking for closedir... yes
checking for opendir... yes
checking for readdir... yes
checking for strlcat... no
checking for strlcpy... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
cp: cannot stat 'kernl32l.fi': No such file or directory
cp: cannot stat 'kernl32b.fi': No such file or directory
cp: cannot stat 'kernl64l.fi': No such file or directory
cp: cannot stat 'kernl64b.fi': No such file or directory
*** Config summary: Warnings exist ***
Swig without -forth feature.
~/Documents/GitHub/gforth on master! ⌚ 6:06:14
$ make
cd . && autoheader
echo timestamp > ./stamp-h.in
make: Circular kernel/version.fs <- kernel/version.fs dependency dropped.
(cd . && m4 -s -Dcondbranch_opt=0 prim) >prim.b
./preforth -p ".:~+:." prims2x.fs -e "c-flag on s\" prim.i\" save-mem out-filename 2! s\" "prim.b"\" ' output-c ' output-c-combined process-file bye" >engine/prim.i
Makefile:1094: recipe for target 'engine/prim.i' failed
make: *** [engine/prim.i] Error 1
make: *** Deleting file 'engine/prim.i'
Hi, I can build earlier versions from git. Currently using gforth-0.7.9_20220901
gforth: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=62be1665ac5639fa53ebaa07f855dd7399d5bce4, for GNU/Linux 3.2.0, with debug_info, not stripped
But, newer clones die at ...
n file included from the terminal:0:-94742900832207:
in file included from the terminal👎1:
in file included from minos2/widgets.fs:39:9:
minos2/ftgl-helper.fs:451:2: error: Undefined word
>>>texture_font_activate_size<<< ?ftgl-ior drop
Backtrace:
kernel/int.fs:317:10: 0 $7F198B9D23F0 throw
make: *** [Makefile:1503: doc/minosdoc.fd] Error 243
$ make
./preforth -p ".:~+:." prims2x.fs -e "c-flag on s\" prim.i\" save-mem out-filename 2! s\" "prim.b"\" ' output-c ' output-c-combined process-file bye" >engine/prim.i
make: *** [Makefile:1224 : engine/prim.i] Erreur 1
make: *** Suppression du fichier « engine/prim.i »
running on debian12 all devlibs are ok configure shows no errors so I did not try make install of course
I ran ./BUILD-FROM-SCRATCH
which basically just does: ./autogen.sh && ./configure && make
.
It fails with:
make[1]: Leaving directory '/tmp/gforth-0.7.9_20201022/engine'
ln -s -f engine/libgforth-ditc libgforth-ditc
chcon -t unconfined_execmem_exec_t libgforth-ditc || true
chcon: failed to get security context of 'libgforth-ditc': Operation not supported
Workaround is modifying the Makefile
and changing the line with chcon
to true
, for example.
I would expect that in Linux, REFILL should return 0 if a user enters Ctrl+D Enter at the start of a line in interactive mode.
But the actual result: REFILL throws an exception with code -56 (error in "QUIT").
Gforth version: 0.7.9_20200213
[: 0 ['] refill catch cr . . ;] execute \ <Enter> <Ctrl+D> <Enter>
Expected result: it prints 0 0
Actual result: it prints -56 0
There are some files which include two dots. Therefore, a git clone to Windows does not work.
Gforth 0.7.9_20210218, gforth-fast
binary (and gforth-fast-ll-reg
):
-1 -1 1 um/mod . .
The actual error message: "Division by zero"
An expected error message: "Integer overflow"
Initially, the question appeared on the StackOverflow.
NB: gforth
, gforth-itc
, gforth-ditc
, gforth-ll-reg
binaries show in this test an error message: "Result out of range".
Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
ok
ok
ok
Variable seed ok
ok
$10450405 Constant generator ok
ok
: rnd ( -- x ) seed @ generator um* drop 1+ dup seed ! ; ok
: seed-init ( -- ) ntime drop seed +! rnd drop ;
:9: Undefined word
: seed-init ( -- ) >>>ntime<<< drop seed +! rnd drop ;
Backtrace:
Looks like there is a dependency to ntime word.
On MacOS Sonoma the ./configure command ends with the following error:
./configure: line 16044: syntax error near unexpected token llvm=*' ./configure: line 16044:
llvm=*)'
Putting quotes around llvm=* helped, but then the complication got stuck at engine.c.
ABORT
and THROW
do not show any error report in case of the exception is not caught.
The code
:noname -1 throw 123 . ; execute
outputs
ok
Gforth 0.7.9_20180905 on Debian 3.16
Hi,
I tried building gforth with gst-plugins-gl-1.0 I get the following error:
/usr/bin/swig -forth -cpperraswarn -Dhost_os_linux_gnu -no-sectioncomments -use-structs -stackcomments -I/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/include -I/usr/local/include -I/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/include-fixed -I/usr/include -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -o gst-fsi.c+ ./gst.i
./gst.i:49: Error: Unable to find 'gst/gstdynamictypefactory.h'
./gst.i:61: Error: Unable to find 'gst/gststreamcollection.h'
./gst.i:68: Error: Unable to find 'gst/gstprotection.h'
./gst.i:73: Error: Unable to find 'gst/gststreams.h'
./gst.i:82: Error: Unable to find 'gst/gsttracer.h'
./gst.i:83: Error: Unable to find 'gst/gsttracerfactory.h'
./gst.i:84: Error: Unable to find 'gst/gsttracerrecord.h'
./gst.i:98: Error: Unable to find 'gst/gl/gstglformat.h'
./gst.i:101: Error: Unable to find 'gst/gl/gstglslstage.h'
./gst.i:103: Error: Unable to find 'gst/gl/gstglshaderstrings.h'
./gst.i:104: Error: Unable to find 'gst/gl/gstglcolorconvert.h'
./gst.i:106: Error: Unable to find 'gst/gl/gstglbasememory.h'
./gst.i:107: Error: Unable to find 'gst/gl/gstglbuffer.h'
./gst.i:109: Error: Unable to find 'gst/gl/gstglmemorypbo.h'
./gst.i:110: Error: Unable to find 'gst/gl/gstglrenderbuffer.h'
./gst.i:113: Error: Unable to find 'gst/gl/gstglbasefilter.h'
./gst.i:114: Error: Unable to find 'gst/gl/gstglviewconvert.h'
./gst.i:116: Error: Unable to find 'gst/gl/gstglsyncmeta.h'
./gst.i:117: Error: Unable to find 'gst/gl/gstgloverlaycompositor.h'
make[1]: *** [gst-fsi.c] Error 1
make[1]: Leaving directory `/tmp/SBo/gforth-0.7.9.896418d/unix'
make: *** [build-libcc-swig] Error 2
but when I exclude the *.h files listed above from gst.i then the build of gforth finishes. I have a diff that I created that I use when building for my flavor of Linux.
Regards,
Fred
gst.i.diff.patch.txt
Comparing with php.net, each function has a clear URL, like https://www.php.net/manual/en/function.array-chunk
For gforth, it looks like https://gforth.org/manual/Memory-Blocks.html#index-erase_0028--addr-u-_002d_002d--_0029-core_002dext for the erase
word.
This means I cannot create a script to automatically query the meaning of a word.
see
does not explain the semantics of a word, so it's not a good alternative (unless you're willing to learn and read assembly, or already know Forth in-depth).
Would you be willing to restructure the gforth manual homepage to allow for IDE-like word lookup in Vim/Emacs?
Gforth 0.7.9_20180905
The code:
: 0?E ( 0|x -- 0|x ) ]] dup 0= if exit then [[ ; immediate
: execute-name? ( i*x c-addr u -- j*x flag ) find-name 0?E name>interpret 0?E execute true ;
S" [ELSE]" execute-name? [THEN]
.
The output:
*the terminal*:4: error: Invalid memory address
>>>.<<<
The same issue with the following code:
0 S" [IF]" execute-name? [THEN]
.
After having built and installed gforth, I get this:
./build-ec 8086
warning:EXIT is compile-only
cross.fs:63:13: redefined g with G
cross.fs:682:32: defined literal .dec as word
arch/8086/mach.fs:26:16: defined literal ec as word
cross.fs:1262:12: redefined NILInclude assembler
Include primitives
kernel-ec/nio.fs:96:3: defined literal d. as word
kernel-ec/nio.fs:104:3: defined literal . as word
kernel-ec/int.fs:128:1: '' is a double-cell integer; type `help' for more info
kernel-ec/int.fs:143:1: '' is a double-cell integer; type `help' for more info
kernel-ec/int.fs:527:3: defined literal dec. as wordPrepare booting
Unresolved:
key appeared in:
accept file kernel-ec/saccept.fs line 31
emit appeared in:
included file kernel-ec/saccept.fs line 55
included file kernel-ec/saccept.fs line 52
included file kernel-ec/saccept.fs line 52
refill-loop file kernel-ec/saccept.fs line 50
accept file kernel-ec/saccept.fs line 42
accept file kernel-ec/saccept.fs line 39
accept file kernel-ec/saccept.fs line 39
accept file kernel-ec/saccept.fs line 39
backspaces file kernel-ec/io.fs line 59
space file kernel-ec/io.fs line 54
bell file kernel-ec/io.fs line 50
cr file kernel-ec/io.fs line 49
type file kernel-ec/io.fs line 29
in file included from *the terminal*:0
in file included from *the terminal*:-1
kernel-ec/main.fs:97: error: Unresolved words!
.unresolved \ how did we do?
Backtrace:
0 $7F76FE307040 throw
cross.fs:2093:17 1 $7F76FE5D2F70 c(abort")
cross.fs:2106:15 2 $7F76FE5D3168 .unresolved
cp: cannot stat 'kernl-8086.fi-': No such file or directory
cp: cannot stat 'kernl-8086.fi-': No such file or directory
(after quite a long time digging around)
Is there a (simple) way to detect them?
Thank you very much.
Just to write a basic user interface
When Gforth is started from the binary that is located in the git repository working directory (project root), but the current directory is not the project root — locate
and edit
don't work properly.
Namely, locate
doesn't show context in the source file, and edit
doesn't open the proper source file.
Changing the current directory via set-dir
also affects these words.
If you also like to build on OS X, see this: https://docs.travis-ci.com/user/multi-os/
(you may have to ask [email protected] to enable this for your repo)
And you can set environment variables to different values if you want to build with different configurations.
For example, I build my Forth using Linux and OS X, gcc -m32
and gcc -m64
, and C and x86 targets. That would be eight build jobs, but x86 is not supported for OS X yet, so I exclude those two:
os:
- linux
- osx
env:
- TARGET=c M32=
- TARGET=c M32=-m32
- TARGET=x86 M32=
- TARGET=x86 M32=-m32
matrix:
exclude:
- os: osx
env: TARGET=x86 M32=
- os: osx
env: TARGET=x86 M32=-m32
There is a discussion about the gforth banner there:
https://www.reddit.com/r/Forth/comments/151jmg7/hidding_banner_in_gforth_starting_a_fs_program/
the problem is by invoking gforth program.fs
, it's starting first the informations within the program, or the result itself, and THEN the gforth banner. It's possible to use the bye
or the quit
command, but it might be more intuitive or logical to display the banner only when gforth is invoked alone.
NetBSD chieftec 8.99.1 NetBSD 8.99.1 (GENERIC) #1: Thu Jun 22 19:26:57 CEST 2017 root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64
gforth 0.7.3 in pkgsrc
clang 5.0.0 (from llvm-svn trunk version)
Build hangs on this command:
clang -I./../arch/amd64 -I. -Wall -O2 -Dunix -Og -g -ggdb -I/usr/pkg/include -I/usr/include -DHAVE_CONFIG_H -DFORCE_LL -DFORCE_REG -DDEFAULTPATH=".:/usr/pkg/lib/gforth/site-forth:/usr/pkg/share/gforth/site-forth:/usr/pkg/lib/gforth/0.7.3:/usr/pkg/share/gforth/0.7.3" -I/usr/pkg/include -I/usr/include -fno-gcse -fno-strict-aliasing -fno-reorder-blocks -falign-labels=1 -falign-loops=1 -falign-jumps=1 -DGFORTH_DEBUGGING -o engine-ll-reg.o -c ./engine.c
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.