# Building prosqlite from source ? (with a view towards osquery)

**URL:** https://swi-prolog.discourse.group/t/building-prosqlite-from-source-with-a-view-towards-osquery/7493
**Category:** General
**Created:** [June 1, 2024, 10:52pm UTC](https://swi-prolog.discourse.group/t/building-prosqlite-from-source-with-a-view-towards-osquery/7493 "2024-06-01T22:52:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![yziquel](https://avatars.discourse-cdn.com/v4/letter/y/d9b06d/32.png) [@yziquel](https://swi-prolog.discourse.group/u/yziquel)
#### Post date: [June 1, 2024, 10:52pm UTC](https://swi-prolog.discourse.group/t/building-prosqlite-from-source-with-a-view-towards-osquery/7493/1 "2024-06-01T22:52:14Z")

</div>

Hi.

I’ve been trying to get to grips with SWI prolog. As I like to build things from source, I’ve been looking at how to build prosqlite from source.

> **[GitHub - nicos-angelopoulos/prosqlite: An SWI-Prolog interface to SQLite](https://github.com/nicos-angelopoulos/prosqlite)**
>
> An SWI-Prolog interface to SQLite. Contribute to nicos-angelopoulos/prosqlite development by creating an account on GitHub.

Little build documentation.

I tried:

CFLAGS=-I/location/of/lib/swipl/include LDSOFLAGS=-lc PACKSODIR=$PWD/build make

Not very conclusive:

prosqlite.c:(.text+0x22): undefined reference to `PL\_blob\_data’

And lots of errors like that.

So. How do you people build stuff from source in the prolog world ?

Context: investigating how to integrate swipl and osquery, and as osquery is based on sqlite, I thought I’d have to start somewhere… I’d like low level integration.

---

<div class="post-metadata">

### Author: ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)
#### Post date: [June 2, 2024, 8:35am UTC](https://swi-prolog.discourse.group/t/building-prosqlite-from-source-with-a-view-towards-osquery/7493/2 "2024-06-02T08:35:47Z")

</div>

prosqlite is organized as a “pack”. You build these from source using

```
 ?- pack_rebuild(prosqlite).

```

Or, in recent versions using

```
 swipl pack install --rebuild=true prosqlite

```

The pack has a Makefile that is called by Prolog, while passing several variables that describe the configuration of the target Prolog system. Rebuilding creates a file `buildenv.sh` in the pack that provides this environment.

In addition, there is `swipl.cmake` that provides CMake targets for embedding SWI-Prolog as well as generating plugins. The add-on  
[https://www.swi-prolog.org/pack/list?p=environ](https://www.swi-prolog.org/pack/list?p=environ)

is a recent example that configures a plugin using CMake.
