usr.bin/sqlite3: link the shell against libm by laffer1 · Pull Request #383 · MidnightBSD/src · GitHub
Skip to content

usr.bin/sqlite3: link the shell against libm#383

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

usr.bin/sqlite3: link the shell against libm#383
laffer1 merged 1 commit into
stable/4.1from
fix/sqlite3-shell-libm-stable41

Conversation

@laffer1

@laffer1 laffer1 commented Jun 12, 2026

Copy link
Copy Markdown
Member

Companion to #381 (stable/4.0) and #382 (master). stable/4.1's
usr.bin/sqlite3/Makefile is identical and has the same link failure.

Problem

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

ld: error: undefined symbol: ceil
ld: error: undefined symbol: floor   >>> shell.pieo:(seriesFilter)
*** [sqlite3.full] Error code 1

Fix

LIBADD+= m. Verified locally: cd usr.bin/sqlite3 && make links cleanly with -lm.

🤖 Generated with Claude Code

Summary by Sourcery

Bug Fixes:

  • Fix linker errors for the sqlite3 shell by adding libm to the list of linked libraries.

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 the change is straightforward, so I have no 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.

@laffer1 laffer1 merged commit c1f63f4 into stable/4.1 Jun 12, 2026
4 of 5 checks passed

@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 found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="usr.bin/sqlite3/Makefile" line_range="15" />
<code_context>
 SRCS=		shell.c

 LIBADD+=	sqlite3
+LIBADD+=	m
 # readline

</code_context>
<issue_to_address>
**suggestion:** Use the standard LIBM variable instead of hardcoding `m` in LIBADD.

Elsewhere in the tree we link the math library via `${LIBM}` (often with a matching `DPADD+= ${LIBM}`), so using `${LIBM}` here would align with the rest of the build system and avoid hardcoding the library name.

```suggestion
DPADD+=		${LIBM}
LIBADD+=	${LIBM}
```
</issue_to_address>

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.

Comment thread usr.bin/sqlite3/Makefile
SRCS= shell.c

LIBADD+= sqlite3
LIBADD+= m

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Use the standard LIBM variable instead of hardcoding m in LIBADD.

Elsewhere in the tree we link the math library via ${LIBM} (often with a matching DPADD+= ${LIBM}), so using ${LIBM} here would align with the rest of the build system and avoid hardcoding the library name.

Suggested change

@laffer1 laffer1 deleted the fix/sqlite3-shell-libm-stable41 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