luksamuk / believe

A Bel Lisp interpreter built with C, written as a book/literate program (archived)
MIT License
52 stars 4 forks source link

Instructions for including the source to the Boehm-Demers-Weiser garbage collector #1

Open masak opened 5 years ago

masak commented 5 years ago

Hi! First off, kudos on creating this project!

I'm currently trying to build the project locally. This should be straightforward, but...

$ make
clang --std=c11 -g -O2 -Wall -DBEL_DEBUG -c -o believe.o believe.c
believe.c:12:10: fatal error: 'gc.h' file not found
#include <gc.h>
         ^~~~~~
1 error generated.
make: *** [believe.o] ▒▒▒▒ 1

So I'm missing a dependency. This is mentioned in the README:

** Boehm-Demers-Weiser Garbage Collector

We also use Boehm-Demers-Weiser GC for garbage collection, instead of
programming our own. The =GC_DEBUG= flag helps on debugging. See that we
use =-lgc= on the Makefile to link the relevant library to the
application.

#+begin_src C
#ifdef BEL_DEBUG
#define GC_DEBUG
#endif

#include <gc.h>
#+end_src

Plus, [[https://www.hboehm.info/gc/04tutorial.pdf][one could check the Boehm-Demers-Weiser GC tutorial slides]] by
Hans-J. Boehm, for a quick overview of this library.

I skimmed the talk slides; interesting. I found downloadable sources here. Including the gc.h file that make said was missing.

Two questions:

luksamuk commented 5 years ago

Hello! Thanks for your question.

The Boehm-Demers-Weiser GC is usually included on Linux distros as the package gc. That is the case for Void Linux, and after googling a bit I discovered that the same package with the same name is on Arch's "extra" repositories.

I believe you've found out how to install it from source, and that is not a problem if it works for you. However, I'm trying to make things simple for now, so installing gc from repositories is preferable, unless your distribution doesn't support it, or if you managed to compile it on another OS.

As for documentation, I would be happy to take new content! I'll set up some contribution guidelines soon, but for now, feel free to create PRs for anything you want. There'll be a "Thanks" section with the names of contributors.

masak commented 5 years ago

Cool!

I'm currently on Windows 10. One of the least developer-friendly "distributions", I know. 😂 But what can you do. I suppose in the worst case I could set something up inside VMWare.

I will consider my options on Windows (which right now seem to be "install from source"), and then report back with my findings. \<arnold>I'll be back. 😎\</arnold>