Faust loader: platform-aware library lookup and AQUASYNTH_FAUST_LIBRARY override #1

Merged
aqua merged 1 commit from faust-loader-platform-aware into main 2026-10-31 09:41:00 +00:00
Member

What changed

src/AquaSynth.Faust/NativeFaustRuntime.cs hardcoded the Windows toolchain: faust.dll, a ; PATH separator, and C:\Program Files\Faust as the default home. It could not load Faust on Linux or macOS. This branch makes the loader platform-aware. The change is commit 53f1f1b. It also adds tests/AquaSynth.Dsl.Tests/FaustLoaderPlatformTests.cs and a paragraph in docs/faust-toolchain-boundary.md.

  • Platform library names. AquaSynthFaustToolchain.LibraryFileNames is libfaust.so on Linux, libfaust.dylib on macOS, and libfaust.dll then faust.dll on Windows. FindLibrary(home) looks for these under <home>/lib. Find accepts a home only if it has a library there and share/faust.
  • Default homes. C:\Program Files\Faust is now Windows-only. Other platforms probe /usr/local and /usr.
  • Path separator. FaustNativeToolchain.TryLoad joins PATH with Path.PathSeparator, not a literal ;. The directory it prepends is the one that holds the library.
  • Explicit library override. AquaSynthNativeOptions.FaustLibraryPath is a new optional record parameter. The AQUASYNTH_FAUST_LIBRARY environment variable does the same job. Both name the library file directly. The option wins over the variable. The override skips the home search.
    • If the file is missing, the error names the path.
    • FaustHome, if given, supplies share/faust. Otherwise the prefix is the library's grandparent. If share/faust is absent there, the error says so.
  • Error text. The not-found message now lists the expected file names and the override variable.

Verification

SMOKE lines from the Linux run of this branch:

faustVersion=2.90.20 (LLVM 19.1.7)
4410 frames
peak 0.1000

That is the loaded libfaust version, and a render of 4410 frames with peak amplitude 0.1000.

Not merged. Review requested.

## What changed `src/AquaSynth.Faust/NativeFaustRuntime.cs` hardcoded the Windows toolchain: `faust.dll`, a `;` PATH separator, and `C:\Program Files\Faust` as the default home. It could not load Faust on Linux or macOS. This branch makes the loader platform-aware. The change is commit 53f1f1b. It also adds `tests/AquaSynth.Dsl.Tests/FaustLoaderPlatformTests.cs` and a paragraph in `docs/faust-toolchain-boundary.md`. - **Platform library names.** `AquaSynthFaustToolchain.LibraryFileNames` is `libfaust.so` on Linux, `libfaust.dylib` on macOS, and `libfaust.dll` then `faust.dll` on Windows. `FindLibrary(home)` looks for these under `<home>/lib`. `Find` accepts a home only if it has a library there and `share/faust`. - **Default homes.** `C:\Program Files\Faust` is now Windows-only. Other platforms probe `/usr/local` and `/usr`. - **Path separator.** `FaustNativeToolchain.TryLoad` joins `PATH` with `Path.PathSeparator`, not a literal `;`. The directory it prepends is the one that holds the library. - **Explicit library override.** `AquaSynthNativeOptions.FaustLibraryPath` is a new optional record parameter. The `AQUASYNTH_FAUST_LIBRARY` environment variable does the same job. Both name the library file directly. The option wins over the variable. The override skips the home search. - If the file is missing, the error names the path. - `FaustHome`, if given, supplies `share/faust`. Otherwise the prefix is the library's grandparent. If `share/faust` is absent there, the error says so. - **Error text.** The not-found message now lists the expected file names and the override variable. ## Verification SMOKE lines from the Linux run of this branch: ``` faustVersion=2.90.20 (LLVM 19.1.7) 4410 frames peak 0.1000 ``` That is the loaded libfaust version, and a render of 4410 frames with peak amplitude 0.1000. Not merged. Review requested.
Find libfaust.so on Linux, libfaust.dylib on macOS, libfaust.dll/faust.dll on
Windows; join PATH with Path.PathSeparator; accept FaustLibraryPath or
AQUASYNTH_FAUST_LIBRARY as an explicit library file. Platform default homes
replace the unconditional C:\Program Files\Faust.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Member

Diff review: exactly three files: src/AquaSynth.Faust/NativeFaustRuntime.cs, tests/AquaSynth.Dsl.Tests/FaustLoaderPlatformTests.cs, and the docs file docs/faust-toolchain-boundary.md.

Docs change: adds one paragraph (8 lines, no deletions) after the AquaSynthRenderSession note, before ## Invariants. It states that Faust library lookup is platform-aware (libfaust.so Linux, libfaust.dylib macOS, libfaust.dll then faust.dll Windows, at <home>/lib with <home>/share/faust beside it); that AquaSynthNativeOptions.FaustLibraryPath or AQUASYNTH_FAUST_LIBRARY names the library file directly and overrides the home search, with FaustHome supplying share/faust if the prefix is not the file's grandparent; and that the loader prepends lib and bin to PATH using the platform path separator.

Diff review: exactly three files: `src/AquaSynth.Faust/NativeFaustRuntime.cs`, `tests/AquaSynth.Dsl.Tests/FaustLoaderPlatformTests.cs`, and the docs file `docs/faust-toolchain-boundary.md`. Docs change: adds one paragraph (8 lines, no deletions) after the `AquaSynthRenderSession` note, before `## Invariants`. It states that Faust library lookup is platform-aware (`libfaust.so` Linux, `libfaust.dylib` macOS, `libfaust.dll` then `faust.dll` Windows, at `<home>/lib` with `<home>/share/faust` beside it); that `AquaSynthNativeOptions.FaustLibraryPath` or `AQUASYNTH_FAUST_LIBRARY` names the library file directly and overrides the home search, with `FaustHome` supplying `share/faust` if the prefix is not the file's grandparent; and that the loader prepends `lib` and `bin` to `PATH` using the platform path separator.
aqua merged commit 3b43b7bd72 into main 2026-10-31 09:41:00 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/AquaSynth!1
No description provided.