stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Enhance CMake error messaging for missing FYPP preprocessor

Open srinjoy933 opened this issue 9 months ago • 2 comments

hey @jvdp1 @jalvesz The current build configuration process in stdlib utilizes a check for the fypp preprocessor, which is essential for generating Fortran source code from templates. Currently, if the fypp executable is not found in the system PATH, the build terminates with a generic error message directing the user to the documentation. While technically correct, this creates a significant bottleneck for new contributors, particularly those working on Windows environments where Python's Scripts directory (containing fypp.exe) is frequently omitted from the system PATH by default.

I recently encountered this exact issue while setting up the development environment on a Windows 11 machine. Despite having successfully installed fypp via pip, the CMake configuration failed repeatedly because the executable was located in a non-standard roaming directory. Navigating this "silent failure" required several manual overrides and a deep dive into the stdlib.cmake logic, which could discourage potential GSoC applicants or first-time contributors from proceeding with the project.

The proposed solution: To implement more robust "Defensive Programming" within the preprocess function and the main CMakeLists.txt. Instead of a simple failure message, the build system should provide actionable technical guidance. This includes explicitly suggesting a check for the Python Scripts folder, providing the exact pip install command, and documenting the -DFYPP_EXECUTABLE flag as a manual override. By transforming this fatal error into a diagnostic tool, we can significantly reduce the "Time-to-First-Build" for new developers and ensure a smoother onboarding experience for the community.

srinjoy933 avatar Mar 04 '26 07:03 srinjoy933

This looks already resolved — the improved diagnostics landed in #1137 (ac98d3bc). The message now names the missing tool, links the install docs, gives where/which commands for both platforms, and offers a manual override, which covers what this issue asked for.

One thing did survive it, which is how I ended up here: the override line pointed at -DFYPP_EXECUTABLE, but find_program creates FYPP. So the escape hatch did not work — I verified both spellings against a fypp outside PATH, and only -DFYPP configures. Fixed in #1207.

Worth closing this one unless something else is still missing.

Disclosure: I used Claude Code to check this.

kunalKumar-13 avatar Sep 07 '26 14:09 kunalKumar-13

@jalvesz this looks resolved on master, so I'd suggest closing it. fortran-lang/stdlib#1137 added the actionable fypp error (names the tool, links the install docs, gives where/which diagnostics, and shows a manual override), and fortran-lang/stdlib#1207 corrected the override to -DFYPP=/path/to/fypp, the variable find_program actually sets. I checked CMakeLists.txt on master and it matches.

djkees avatar Nov 17 '26 17:11 djkees