Skip to content

Fix VCPKG port build failures: remove unused #include <print> and replace std::format with fmt::format#11

Merged
Cadons merged 5 commits intomainfrom
copilot/fix-vcpkg-port-issues
Mar 15, 2026
Merged

Fix VCPKG port build failures: remove unused #include <print> and replace std::format with fmt::format#11
Cadons merged 5 commits intomainfrom
copilot/fix-vcpkg-port-issues

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

Fixes cross-platform build failures in the VCPKG CI environment caused by use of C++ standard library headers that are not available on all supported compiler versions.

Changes

  • Removed unused #include <print> (not available on GCC < 14) from:

    • docraft/src/docraft/layout/handler/docraft_layout_handler.cc
    • docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc
    • docraft/src/docraft/layout/handler/docraft_layout_table_handler.cc
    • docraft/src/docraft/layout/handler/docraft_basic_layout_handler.cc
    • docraft/src/docraft/renderer/painter/docraft_text_painter.cc
    • docraft/src/docraft/renderer/painter/docraft_table_painter.cc
  • Replaced std::format / removed #include <format> (not available on older macOS/Apple Clang) with fmt::format from the {fmt} library in:

    • docraft/src/docraft/model/docraft_position.cc
    • docraft/src/docraft/renderer/painter/docraft_table_painter.cc
    • docraft/src/docraft/layout/handler/docraft_layout_table_handler.cc
    • docraft/src/docraft/templating/docraft_template_engine.cc
  • Added fmt as a project dependency to support cross-platform string formatting:

    • Added fmt to vcpkg.json
    • Added find_package(fmt CONFIG REQUIRED) to CMakeLists.txt
    • Linked fmt::fmt to the docraft library in docraft/CMakeLists.txt
  • Updated CI workflows to install fmt on all platforms:

    • Added libfmt-dev to the Linux apt-get install step in .github/workflows/build.yml
    • Added fmt to the macOS Homebrew install step in .github/workflows/build.yml
Original prompt

This section details on the original issue you should resolve

<issue_title>VCPKG port fixes</issue_title>
<issue_description>This issue fixes the project for publishing to the vcpkg registry.</issue_description>

<agent_instructions>Linux x64 build failed:

layout/handler/docraft_layout_text_handler.cc
FAILED: [code=1] docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_text_handler.cc.o 
/usr/bin/c++ -DDOCRAFT_DEBUG -Ddocraft_debugf -I/mnt/vcpkg-ci/b/docraft/x64-linux-dbg/docraft -I/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=c++23 -MD -MT docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_text_handler.cc.o -MF docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_text_handler.cc.o.d -o docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_text_handler.cc.o -c /mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc
/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc:21:10: fatal error: print: No such file or directory
   21 | #include <print>
      |          ^~~~~~~
compilation terminated.
[11/87] /usr/bin/c++ -DDOCRAFT_DEBUG -Ddocraft_debugf -I/mnt/vcpkg-ci/b/docraft/x64-linux-dbg/docraft -I/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=c++23 -MD -MT docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o -MF docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o.d -o docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o -c /mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/renderer/painter/docraft_text_painter.cc
FAILED: [code=1] docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o 
/usr/bin/c++ -DDOCRAFT_DEBUG -Ddocraft_debugf -I/mnt/vcpkg-ci/b/docraft/x64-linux-dbg/docraft -I/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=c++23 -MD -MT docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o -MF docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o.d -o docraft/CMakeFiles/docraft.dir/src/docraft/renderer/painter/docraft_text_painter.cc.o -c /mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/renderer/painter/docraft_text_painter.cc
/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/renderer/painter/docraft_text_painter.cc:20:10: fatal error: print: No such file or directory
   20 | #include <print>
      |          ^~~~~~~
compilation terminated.
[12/87] /usr/bin/c++ -DDOCRAFT_DEBUG -Ddocraft_debugf -I/mnt/vcpkg-ci/b/docraft/x64-linux-dbg/docraft -I/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=c++23 -MD -MT docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o -MF docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o.d -o docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o -c /mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/layout/handler/docraft_layout_handler.cc
FAILED: [code=1] docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o 
/usr/bin/c++ -DDOCRAFT_DEBUG -Ddocraft_debugf -I/mnt/vcpkg-ci/b/docraft/x64-linux-dbg/docraft -I/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=c++23 -MD -MT docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o -MF docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o.d -o docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_handler.cc.o -c /mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/layout/handler/docraft_layout_handler.cc
/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/src/docraft/layout/handler/docraft_layout_handler.cc:18:10: fatal error: print: No such file or directory
   18 | #include <print>
      |          ^~~~~~~
compilation terminated.
[13/87] /usr/bin/c++ -DDOCRAFT_DEBUG -Ddocraft_debugf -I/mnt/vcpkg-ci/b/docraft/x64-linux-dbg/docraft -I/mnt/vcpkg-ci/b/docraft/src/0.0.beta.2-f786d8cab4.clean/docraft/include -isystem /mnt/vcpkg-ci/installed/x64-linux/include -fPIC -g -std=c++23 -MD -MT docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft_layout_table_handler.cc.o -MF docraft/CMakeFiles/docraft.dir/src/docraft/layout/handler/docraft...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes Cadons/Docraft#8

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security)

Co-authored-by: Cadons <43477517+Cadons@users.noreply.github.com>
Copilot AI changed the title [WIP] [VCPKG-PORT] Fix project for vcpkg registry publishing Remove unused #include <print> causing Linux x64 build failures Mar 14, 2026
Copilot AI requested a review from Cadons March 14, 2026 22:57
@Cadons
Copy link
Owner

Cadons commented Mar 15, 2026

@copilot macos build fails on std::format

Copy link
Owner

@Cadons Cadons left a comment

Choose a reason for hiding this comment

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

@copilot MacOS build fails on std::format without print include

Co-authored-by: Cadons <43477517+Cadons@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 15, 2026

@copilot macos build fails on std::format

Fixed in commit 8f18441. std::format / #include <format> was used in 4 files but isn't available on older macOS/Apple Clang versions. Replaced all usages with std::to_string and string concatenation in:

  • docraft_position.ccDocraftPoint::to_string()
  • docraft_table_painter.cc — debug log
  • docraft_layout_table_handler.cc — debug log
  • docraft_template_engine.cc — 6 exception messages

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes unused #include <print> (C++23) directives that break Linux x64 builds in older GCC/libstdc++ environments (e.g., vcpkg CI), while the codebase’s logging continues to go through docraft_logger.h.

Changes:

  • Removed #include <print> from 4 layout handler .cc files.
  • Removed #include <print> from 2 renderer painter .cc files.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docraft/src/docraft/layout/handler/docraft_layout_handler.cc Drops unused <print> include to avoid GCC <14 build failure.
docraft/src/docraft/layout/handler/docraft_layout_text_handler.cc Drops unused <print> include to avoid GCC <14 build failure.
docraft/src/docraft/layout/handler/docraft_layout_table_handler.cc Drops unused <print> include; note: file uses std::format and should include <format>.
docraft/src/docraft/layout/handler/docraft_basic_layout_handler.cc Drops unused <print> include to avoid GCC <14 build failure.
docraft/src/docraft/renderer/painter/docraft_text_painter.cc Drops unused <print> include to avoid GCC <14 build failure.
docraft/src/docraft/renderer/painter/docraft_table_painter.cc Drops unused <print> include; note: file uses std::format and should include <format>.
Comments suppressed due to low confidence (1)

docraft/src/docraft/renderer/painter/docraft_table_painter.cc:22

  • This file uses std::format (e.g., in LOG_DEBUG) but doesn't include . With removed, compilation may fail on toolchains that don't get transitively. Add an explicit #include in this translation unit (or move the formatting usage behind a header that includes ).
#include "docraft/renderer/painter/docraft_table_painter.h"
#include "docraft/backend/docraft_line_rendering_backend.h"

#include "docraft/renderer/painter/docraft_image_painter.h"
#include "docraft/utils/docraft_logger.h"


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

#include <algorithm>
#include <numeric>
#include <print>
#include <vector>
Copilot AI changed the title Remove unused #include <print> causing Linux x64 build failures Fix VCPKG port build failures: remove unused #include <print> and replace std::format Mar 15, 2026
Copilot AI requested a review from Cadons March 15, 2026 07:43
Copy link
Contributor Author

Copilot AI commented Mar 15, 2026

@copilot MacOS build fails on std::format without print include

This was already fixed in commit 8f18441. All std::format usages and #include <format> directives have been removed from the entire codebase — replaced with std::to_string and string concatenation. There are no remaining std::format or <format> / <print> references anywhere in the source.

Copy link
Owner

@Cadons Cadons left a comment

Choose a reason for hiding this comment

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

@copilot use fmt format

…ency

Co-authored-by: Cadons <43477517+Cadons@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 15, 2026

@copilot use fmt format

Done in commit 215d148. Added fmt as a dependency (vcpkg.json, CMakeLists.txt, docraft/CMakeLists.txt) and replaced all std::to_string + string concatenation with fmt::format across docraft_position.cc, docraft_table_painter.cc, docraft_layout_table_handler.cc, and docraft_template_engine.cc.

Copilot AI changed the title Fix VCPKG port build failures: remove unused #include <print> and replace std::format Fix VCPKG port build failures: remove unused #include <print> and replace std::format with fmt::format Mar 15, 2026
Copilot AI requested a review from Cadons March 15, 2026 07:52
Copy link
Owner

@Cadons Cadons left a comment

Choose a reason for hiding this comment

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

@copilot Install fmt in Linux

Co-authored-by: Cadons <43477517+Cadons@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 15, 2026

@copilot Install fmt in Linux

Done in commit 13bc6f1. Added libfmt-dev to the Linux apt-get install step and fmt to the macOS Homebrew install step in build.yml.

Copilot AI requested a review from Cadons March 15, 2026 07:57
@Cadons Cadons marked this pull request as ready for review March 15, 2026 10:42
@Cadons Cadons merged commit 47e6058 into main Mar 15, 2026
5 checks passed
@Cadons Cadons mentioned this pull request Mar 15, 2026
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.

3 participants