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
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR fixes a link failure for the sqlite3 shell on stable/4.0 by explicitly linking the binary against libm, ensuring math functions used by the generate_series extension resolve correctly under PIE.

File-Level Changes

Change Details Files
Ensure sqlite3 shell binary links against libm so ceil/floor resolve correctly in the generate_series extension.
  • Add libm to the libraries linked for the sqlite3 shell via LIBADD
  • Keep existing linkage against libsqlite3 unchanged and minimal, without broader Makefile refactors
usr.bin/sqlite3/Makefile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@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