Compile on Ubuntu.

This commit is contained in:
sforman 2023-07-24 11:29:39 -07:00
parent 0fa617766f
commit a34a2b1aab
3 changed files with 58 additions and 5 deletions

View File

@ -1,6 +1,6 @@
OBJS=joy.o keywords.o definitions.o linenoise.o
LDFLAGS=-L/usr/local/lib -lgc -lgmp
LDFLAGS= -Wl,--no-as-needed -L/usr/local/lib -lgc -lgmp
# Hold my hand, in fact, hold both of them, and pat my head too please.
CFLAGS = -ansi -Wall -Wextra -Werror -pedantic -Wstrict-overflow -fno-strict-aliasing -pedantic-errors

View File

@ -1,8 +1,7 @@
Thun in C
---------------
# Thun in C
This is my first attempt to write C in many years, I hope it's not too
embarassing.
embarrassing.
I use Gperf to create a static wordlist. This make word lookup very
efficient, but there's no way currently to add definitions at runtime.
@ -11,4 +10,13 @@ There's a janky script *convert\_defs.py* that generates *definitions.c*,
*definitions.h*, and *KEYWORDS.txt* from the *defs.txt* file. I would
like to replace the dependency on Python with, say, Awk or something.
## Dependencies
- python
- gperf
- gmake
- boehm-gc
- gmp
sudo apt install gperf

View File

@ -32,7 +32,7 @@ VList instead of singly-linked list.) But I want to tackle efficiency by
compilation, and write the compiler(s) in Prolog. I think that avoids
complexity compared to intricating the guts of the interpreter by hand,
and moves the unavoidable complexity into formal statements of logic that
can be evaulated by machine (aka Prolog.)
can be evaluated by machine (aka Prolog.)
---------------------------------------
@ -100,3 +100,48 @@ the comparison functions as definitions:
neq [true] [false] [true] cmp
le [false] [true] [true] cmp
ge [true] [true] [false] cmp
----------------------------------
Argh! That was brutal.
I hate staring at the thing that SHOULD work and it just fucking doesn't work.
Why? Because some fuck-wit somewhere decided to fuck up how things have always been done.
https://stackoverflow.com/questions/12734161/how-to-use-boehm-garbage-collector-in-ubuntu-12-04
> To answer my own question: actually, the Boehm GC library still works the same way as it used to in 12.04. The problem is that GCC doesn't! GCC has started to default to --as-needed, and it drops -lgc completely if it is at the beginning of the line. This is a very major change!!
> Solution is to move -lgc to the end:
> gcc test.c -lgc
> Or add:
> gcc -Wl,--as-needed -lgc test.c
Goddamnit!