Index | Thread | Search

From:
Matthias Andree <matthias.andree@gmx.de>
Subject:
Bug: several databases' pkg-config .pc files lack -lpthread
To:
ports@openbsd.org
Cc:
otto@openbsd.org, jca@openbsd.org, volker@openbsd.org, landry@openbsd.org
Date:
Mon, 14 Jul 2025 10:40:21 +0200

Download raw body.

Thread
Greetings,

I am the upstream maintainer of bogofilter, a heuristic spam filter, 
with Linux and FreeBSD as the main development platforms and the 
occasional test build and "make check" on OpenBSD, but really few and 
far between.

I am not a member of the OpenBSD community, so I hope it's OK to send 
carbon copies to people who had relevant ports Makefiles or changes in 
hand recently.

It is conventional for OpenBSD to open bug reports for ports through 
sendbug(1) or via bugs@?  I skimmed a bit through the ports FAQ and 
"Reporting problems" and a few messages randomly picked from the June 
and July 2025 ports mailing list archives, and it doesn't look so.

The issue is that at least these two ports guys

- databases/lmdb
- databases/sqlite3

link against pthread these days, but their pkg-config file does not list 
-lpthread when queried via pkgconfig --libs <database>.

Consequence: bogofilter itself is single-threaded and does not use 
material from the POSIX threads library itself, so won't add -pthreads, 
-lpthreads or similar.  It does use the respective pkg-config file of 
lmdb or sqlite3 for --libs and --cflags, and then fails to link any of 
the database-related programs constituting bogofilter, because neither

pkg-config --libs lmdb

nor

pkg-config --libs sqlite3

gives me -lpthreads on the output.  Excerpt from linker error:

> ld: error: undefined symbol: pthread_mutexattr_init
>>>> referenced by sqlite3.c:29857
>>>> sqlite3.o:(pthreadMutexAlloc) in archive /usr/local/lib/libsqlite3.a

> $ pkg-config --libs sqlite3
> -L/usr/local/lib -lsqlite3

What I find confusing about this is that there was some effort to fix 
that for sqlite3 - and I haven't built the sqlite3 from source but just 
used "pkg_add sqlite3" on my OpenBSD 7.7 VM. (Which itself got updated 
through several releases by way of sysupgrade followed by syspatch and 
pkg_add -u):

https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/databases/sqlite3/Makefile#rev1.134

But lmdb's .pc file definitely doesn't match that LMDB links against 
pthreads these days:

https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/databases/lmdb/files/lmdb.pc.in?rev=1.1&content-type=text/x-cvsweb-markup

Regards,
Matthias