Skip to content

fix(link): pass -lm on the Linux application-dylib link - #20

Merged
proggeramlug merged 1 commit into
mainfrom
fix/linux-app-link-libm
Aug 28, 2026
Merged

fix(link): pass -lm on the Linux application-dylib link#20
proggeramlug merged 1 commit into
mainfrom
fix/linux-app-link-libm

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

LLVM lowers Math.floor/Math.log10 in application code to libm calls (floor, log10). Perry's --output-type dylib link on Linux does not add -lm (its executable link does — link/build_and_run.rs), and macOS never notices because libSystem carries libm. On the fresh Linux box the Next fixture's link died with

undefined reference to 'floor'   (perry_closure_…route_js__149, …jsonwebtoken…, …app_page_runtime…)
undefined reference to 'log10'

after every other symbol resolved — it surfaced the moment PerryTS/perry#8942 removed the duplicate string-constant definitions. The tiny fixture the Linux proof compiles calls no libm function, which is why CI never saw it.

Coop's cc shim now passes -lm on the Linux shared-library branch. The compiler-side fix (add the system libraries to Perry's Linux -shared link, as its executable link already does) is being added to PerryTS/perry#8942; this shim change is the defensive half and stays correct either way.

Verified on the Linux box: with this change (and PerryTS/perry#8942's string-constant fix) the fixture links and publishes (app.so, 362 s end to end). The three-app in_process table is not yet possible there: the daemon SIGSEGVs during the app's module init (js_throw → _Unwind_RaiseException, independent of these link flags) — tracked separately.

https://claude.ai/code/session_01UZJbhb2FTuakurTHPAKQgd

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Linux builds involving mathematical operations such as floor and log10.
    • Improved shared-library linking so required math functions resolve correctly.

LLVM lowers Math.floor/Math.log10 in application code to libm calls, and
Perry's shared-library link on Linux does not add -lm the way its executable
link does; macOS never notices because libSystem carries libm. The Next
fixture's link on Linux died with `undefined reference to 'floor'` after
every other symbol resolved (found once PerryTS/perry#8942 removed the
duplicate string-constant definitions). The tiny CI fixture calls no libm
function, which is why the Linux proof never saw it.

Claude-Session: https://claude.ai/code/session_01UZJbhb2FTuakurTHPAKQgd
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 39727ada-f4f5-4f27-9c7a-c134bc3ba7f0

📥 Commits

Reviewing files that changed from the base of the PR and between 3bb8e3d and dcebf48.

📒 Files selected for processing (1)
  • scripts/compiler-wrappers/cc

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Linux compiler wrapper now adds -lm when linking shared libraries. The macOS branch remains unchanged.

Changes

Linux shared-library linking

Layer / File(s) Summary
Add libm to the Linux link command
scripts/compiler-wrappers/cc
The Linux shared-library link passes -lm before the --no-as-needed and --as-needed provider arguments. This resolves LLVM-emitted math symbols such as floor and log10.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to dcebf

This change adds libm when building Linux shared libraries so application math functions link correctly. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding -lm to the Linux application dynamic-library link.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/linux-app-link-libm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit 630ec18 into main Aug 28, 2026
3 checks passed
@proggeramlug
proggeramlug deleted the fix/linux-app-link-libm branch August 28, 2026 10:47
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