usr.bin/sqlite3: link the shell against libm (fixes stable/4.0 build) by laffer1 · Pull Request #381 · MidnightBSD/src · GitHub
Skip to content

usr.bin/sqlite3: link the shell against libm (fixes stable/4.0 build)#381

Merged
laffer1 merged 1 commit into
stable/4.0from
fix/sqlite3-shell-libm
Jun 12, 2026
Merged

usr.bin/sqlite3: link the shell against libm (fixes stable/4.0 build)#381
laffer1 merged 1 commit into
stable/4.0from
fix/sqlite3-shell-libm

Conversation

@laffer1

@laffer1 laffer1 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Problem

stable/4.0 buildworld fails linking the sqlite3 shell:

ld: error: undefined symbol: ceil
>>> referenced by shell.c:8194 (contrib/sqlite3/shell.c:8194)
>>>               shell.pieo:(seriesFilter)
ld: error: undefined symbol: floor
cc: error: linker command failed with exit code 1
*** [sqlite3.full] Error code 1

Cause

contrib/sqlite3/shell.c's generate_series extension defines
seriesCeil()/seriesFloor() using ceil()/floor(). Under the PIE shell
link those resolve to libm symbols, but usr.bin/sqlite3/Makefile linked
only libsqlite3 (LIBADD+= sqlite3).

Fix

LIBADD+= m.

Verification

cd usr.bin/sqlite3 && make now builds clean — the link picks up -lm
(.../lib/msun -lm) and sqlite3.full links/strips successfully.

Note: master's usr.bin/sqlite3/Makefile is identical (no libm) and likely
needs the same change; happy to send a companion PR.

🤖 Generated with Claude Code

Summary by Sourcery

Build:

  • Add libm to the sqlite3 shell link libraries so the build picks up -lm when producing the sqlite3.full binary.

The sqlite3 shell's generate_series extension (seriesCeil/seriesFloor in
contrib/sqlite3/shell.c) references ceil() and floor(); under the PIE
shell link these resolve to libm symbols. The Makefile only linked
libsqlite3, so sqlite3.full failed with:

    ld: error: undefined symbol: ceil
    ld: error: undefined symbol: floor
        >>> referenced by shell.c ... seriesFilter

Add LIBADD+= m. Verified: usr.bin/sqlite3 now builds and links cleanly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Makefile for the sqlite3 utility to link against the math library by adding LIBADD+= m. There are no review comments, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@laffer1 laffer1 merged commit 6170355 into stable/4.0 Jun 12, 2026
4 of 5 checks passed
@laffer1 laffer1 deleted the fix/sqlite3-shell-libm branch June 15, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant