Bug 244459 - databases/sqlite3: undefined symbol pthread_create when compiling *without* THREADS
Summary: databases/sqlite3: undefined symbol pthread_create when compiling *without* T...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Pietro Cerutti
Depends on:
Reported: 2020-02-27 01:22 UTC by Brian Haug
Modified: 2020-12-11 14:58 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pavelivolkov)


Note You need to log in before you can comment on or make changes to this bug.
Description Brian Haug 2020-02-27 01:22:12 UTC
# uname -a
FreeBSD port-master 12.1-RELEASE-p2 FreeBSD 12.1-RELEASE-p2 r357991 GENERIC  amd64

/etc/make.conf is an empty file

A scan of ports/UPDATING for sqlite didn't have anything that seemed related.

when building sqlite3 on system above the last several lines related to the build are:

libtool: link: cc -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_RTREE -DSQLITE_HAVE_ZLIB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fstack-protector-strong -o sqlite3 sqlite3-shell.o sqlite3-sqlite3.o  -L/usr/local/lib -lreadline -ltermcap -lz -lm
ld: error: undefined symbol: pthread_create
>>> referenced by sqlite3.c
>>>               sqlite3-sqlite3.o:(vdbeSorterFlushPMA)

ld: error: undefined symbol: pthread_create
>>> referenced by sqlite3.c
>>>               sqlite3-sqlite3.o:(vdbePmaReaderIncrInit)

ld: error: undefined symbol: pthread_create
>>> referenced by sqlite3.c
>>>               sqlite3-sqlite3.o:(vdbePmaReaderNext)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Seems like there are two relatively obvious options:
1.  Remove THREADS from the OPTIONS_DEFINE in the Makefile
2.  Add an appropriate #ifdef or similar around the threaded code.  Alas, I don't have enough experience at the moment to implement this and send a suggested patch.
Comment 1 David Armstrong 2020-11-18 00:50:17 UTC
Encountered the same issue, FreeBSD 12.2-RELEASE r366954 GENERIC AMD.

I'm installing this on a single threaded VPS, so had unchecked []THREADS and building databases/sqlite3, which results in a failed build as Brian Haug described.

Building WITH [*]THREADS builds successfully.
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-12-11 14:02:22 UTC
A commit references this bug:

Author: gahr
Date: Fri Dec 11 14:01:49 UTC 2020
New revision: 557735
URL: https://svnweb.freebsd.org/changeset/ports/557735

  databases/sqlite3: fix build w/o THREADS

  PR:		244459
  Reported by:	Brian Haug <haug.bsd6114@yahoo.com>

Comment 3 Pietro Cerutti freebsd_committer freebsd_triage 2020-12-11 14:58:09 UTC
Also fixed upstream: https://www.sqlite.org/src/info/e64ff2cce3c03ba2