Repository navigation
Description
Summary
Parse and honor [link].libs from with.toml. §16.8 already documents both libs and search_paths; the current parser only handles search paths.
Spec
§16.8 says libraries can be specified in with.toml with [link] libs = ["sqlite3", "ssl", "crypto"] and search_paths = ["/usr/local/lib"], or inline through c_import(..., link: ...) (docs/with-specification.md:8589). with build passes these to the linker (docs/with-specification.md:8606).
Current state
ProjectConfig has link_search_paths and dep_link_libs fields, but no direct link_libs field for [link].libs (src/compiler/ProjectConfig.w:5). project_config_apply_entry parses [link].search_paths only (src/compiler/ProjectConfig.w:148). project_config_wants_key likewise recognizes only search_paths under [link] (src/compiler/ProjectConfig.w:249). Compilation passes dependency link libs and link search paths into link planning (src/compiler/Compilation.w:859), so direct libs have no route to the linker.
Implementation plan
- Add
link_libs: Vec[str]toProjectConfig, initialized inproject_config_default. - Add
project_config_parse_str_arrayor reuse a generalized array parser to parse[link].libs = ["sqlite3"]without resolving entries as paths. - Update
project_config_apply_entryandproject_config_wants_keyto acceptsection == "link" and key == "libs". - Combine direct
link_libswith package-deriveddep_link_libswhen constructing link plans insrc/compiler/Compilation.w, preserving deterministic order: direct manifest libs first, then dependency libs, or document the chosen order. - Include direct link libs in any project info dump so tests can assert parsing without requiring the host to have a specific library.
- Add diagnostics for malformed
libsvalues instead of silently parsing an empty list.
Test plan
Add a config parsing behavior test with a fixture with.toml containing [link] libs = ["sqlite3", "m"] and search_paths = ["vendor/lib"], then assert dump/project info includes both libs and paths. Add a build-plan/link-plan test if available that proves -lsqlite3 or the platform equivalent reaches Link.w. Add a malformed TOML array test that fails loudly.
Acceptance criteria
[link].libsis parsed and stored.- Direct link libs reach the linker in deterministic order.
- Existing
[link].search_pathsbehavior is unchanged. - Tests cover parsing and link-plan propagation.
with build && with build :fixpoint && with build :testpass.
Dependencies
Overlaps #450, which tracks the broader §18.5a with.toml surface.
Traceability
From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 16.8.1.1.
Activity
Requirements triage campaign: checkbox, verdict, and issue-link every…
ehartford commentedon Jun 11, 2026
Implemented in 4a69507 and completed in the follow-up validator commit. [link].libs is now stored separately from dependency link libraries, included in project info dumps, threaded into binary link plans before dependency libs, and malformed non-array values fail loudly with a with.toml diagnostic. Added project self-host tests for parsing, link-plan propagation via a missing-library negative case, and malformed libs diagnostics. Verification passed: build, fixpoint, full test suite, and test-green.