LinkedIn Sourceforge Twitter

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

Running duckDB on OpenBSD

Posted on 2020-02-08 21:14:00 from Vincent in OpenBSD

After having listen to the presentation of Hannes Mühleisen given on February 2nd at Fosdem. I've decided to give a try to type of DB.

Why DuckDB ?

I strongly encourage you to listen to the talk given by Hannes at the Fosdem 2020. You will undertansd that such embeddable DB is complementary to the well known sqlite.

Within a document written by Hannes here, you will understand why duckDB is complementary to sqlite and in which cases duckDB can help you.

Compile duckDB on OpenBSD

Unfortunately DuckDB does not exist in the OpenBSD ports (at least on 02/02/2020).

So the scope of the blog, is to explain how I did the compilation.

First step is to get the source from GitHub


Second perform few modifications on the code

in src/common/file_system.cpp:

> #if defined(__DARWIN__) || defined(__APPLE__)  || defined(__OpenBSD__)
< #if defined(__DARWIN__) || defined(__APPLE__)

in src/include/duckdb/common/string_util.hpp

> #include <stdarg.h>

in third-party/dsdgen/include/porting.h

> #include <sys/time.h>
< #include <sys/timeb.h>

then compile it:


It will compile duckDB, all third party components and several tests.

If not present, you can install gmake by doing:

doas pkg_add gmake

Run it

To execute it, you can perform:

SQLite version DuckDB 
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.

Test it

You can execute tests you have just compiled by doing:

gmake allunit

In my case, with OpenBSD 6.6 and DuckDB snapshot taken in February 8th 2020, I have this result:

/tmp/duckdb-master/test/persistence/test_persistence.cpp:14: FAILED:
due to a fatal error condition:
  SIGSEGV - Segmentation violation signal

test cases:  5 |  4 passed | 1 failed
assertions: 33 | 32 passed | 1 failed

Segmentation fault (core dumped) 
gmake: *** [Makefile:39: allunit] Error 139

If I'm forcing tests via this command:


I got this:

/tmp/duckdb-master/test/sql/copy/test_copy.cpp:1540: FAILED:
due to unexpected exception with message:
IO: Failed to create directory "duckdb_unittest_tempdir/csv_files": path
exists but is not a directory!

[464/464] (100%): Test query profiler                                           
test cases:    464 |    442 passed | 22 failed
assertions: 144707 | 144685 passed | 22 failed

It pass much more test !!!! And all failing one are linked to the path creation. Sounds that a file already exist with that name. Not sure this is linked to OpenBSD or my setup.

Next steps

The next steps would be to link it to Python and perform some use cases from python.

52, 49
displayed: 9786

What is the first letter of the word Moon?