robertknight / tesseract-wasm

JS/WebAssembly build of the Tesseract OCR engine for use in browsers and Node
https://robertknight.github.io/tesseract-wasm/
BSD 2-Clause "Simplified" License
264 stars 27 forks source link

Update to EMSDK 3.1.31 #75

Closed wydengyre closed 1 year ago

wydengyre commented 1 year ago

Surprising error on the build here. I'll return to investigate if nobody else has an immediate intuition as to why this would be the case:

src/lib.cpp:224:26: error: no member named 'format' in namespace 'std'
[775](https://github.com/robertknight/tesseract-wasm/actions/runs/4031562992/jobs/6930925265#step:5:776)
    auto hocr_doc = std::format(R"(<?xml version="1.0" encoding="UTF-8"?>
robertknight commented 1 year ago

std::format requires C++20. This was added to the build flags here: https://github.com/robertknight/tesseract-wasm/blob/33f20fc01c17afbd6abb4c569d1d04a32e2c6f28/Makefile#L168. The latest EMSDK version might require a change in how this flag is passed.

wydengyre commented 1 year ago

@robertknight fixed

robertknight commented 1 year ago

Huh, std::format is a newer addition than I thought in clang. I wonder why it compiled successfully with the previous version of EMSDK.

wydengyre commented 1 year ago

It looks possible that the previous version of Clang did still support the limited use of format here, and didn't hide that support behind the experimental flag. Don't have the time atm to track down those details though.

robertknight commented 1 year ago

Thanks for the update. I might reconsider the use of std::format as it is only used in one place. According to https://releases.llvm.org/15.0.0/projects/libcxx/docs/ReleaseNotes.html#new-features no major changes are expected though, so this will probably become unnecessary in a release or two.