[MacPorts] #74389: podofo @1.1.1 does not build on macOS High Sierra, Version 10.13.6, because of: error: 'to_chars' is unavailable: introduced in macOS 13.3

MacPorts noreply at macports.org
Sun Sep 13 13:36:01 UTC 2026


#74389: podofo @1.1.1 does not build on macOS High Sierra, Version 10.13.6, because
of: error: 'to_chars' is unavailable: introduced in macOS 13.3
------------------------+------------------------
  Reporter:  ballapete  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.12.6
Resolution:             |   Keywords:  highsierra
      Port:  podofo     |
------------------------+------------------------

Comment (by tomio-arisaka):

 Replying to [comment:2 ballapete]:
 > Replying to [comment:1 tomio-arisaka]:
 > > > error: 'to_chars' is unavailable: introduced in macOS 13.3
 > >
 > > You know we need to use a later {{{c++}}} and {{{libc++}}} in order to
 build {{{podofo}}} on macOS 10.13. (e.g. {{{clang-17}}} and its
 {{{libc++}}})
 >
 > `Clang 17` was used to build `podofo`. And I have also installed `Clang
 19`.
 >
 I mentioned the following comment:
 > So if you want to use clang, it is necessary to figure out how to link
 the later libc++ to podofo.

 This means as follows:

 On macOS, {{{clang++}}} compilers use the system {{{libc++}}} by default.
 For example:

 {{{
 $ cat ./test.cpp
 #include <iostream>

 int main() {
     std::cout << "Hello World!" << "\n";
     return 0;
 }
 $
 $ clang++-mp-17 -o ./test ./test.cpp
 $
 $ otool -L ./test
 ./test:
         /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
 version 400.9.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1252.50.4)
 }}}
 I mean the system {{{libc++}}} is {{{/usr/lib/libc++.1.dylib}}}.

 Because the system {{{libc++}}} does not have the {{{to_chars}}} function
 on macOS 10.13, {{{clang++}}} shows the "{{{'to_chars' is unavailable:
 introduced in macOS 13.3}}}" error as follows:

 {{{
 $ cat ./to_chars.cpp
 #include <iostream>
 #include <charconv>
 #include <string_view>

 int main()
 {
   char out[50]{};
   auto begin = std::begin(out);
   auto end = std::end(out);

   // pi
   constexpr double pi = 3.141592653589793238462643383279502884197;

   if (auto [ptr, errc] = std::to_chars(begin, end, pi); errc ==
 std::errc{}) {
     std::cout << std::string_view(begin, ptr - begin) << std::endl;
   } else {
     std::cout << "failed" << std::endl;
   }
 }
 $
 $ clang++-mp-17 -o ./to_chars ./to_chars.cpp
 ./to_chars.cpp:14:31: error: 'to_chars' is unavailable: introduced in
 macOS 13.3
    14 |   if (auto [ptr, errc] = std::to_chars(begin, end, pi); errc ==
 std::errc{}) {
       |                               ^
 /opt/local/libexec/llvm-17/bin/../include/c++/v1/__charconv/to_chars_floating_point.h:30:1:
 note: 'to_chars' has been explicitly marked unavailable here
    30 | to_chars(char* __first, char* __last, double __value);
       | ^
 1 error generated.
 }}}
 How to make this error available is here:
 {{{/opt/local/libexec/llvm-17/include/c++/v1/__availability}}}

 If the error is avoided, then the following link error occurs:

 {{{
 $ clang++-mp-17 -D_LIBCPP_DISABLE_AVAILABILITY -o ./to_chars
 ./to_chars.cpp
 Undefined symbols for architecture x86_64:
   "std::__1::to_chars(char*, char*, double)", referenced from:
       _main in to_chars-319b28.o
 ld: symbol(s) not found for architecture x86_64
 clang++: error: linker command failed with exit code 1 (use -v to see
 invocation)
 }}}

 Use the {{{libc++}}} included in {{{clang-17}}} in order to avoid the link
 error:

 {{{
 $ clang++-mp-17 -L/opt/local/libexec/llvm-17/lib/libc++ -lc++
 -D_LIBCPP_DISABLE_AVAILABILITY -o ./to_chars ./to_chars.cpp
 $
 $ otool -L ./to_chars
 ./to_chars:
         @rpath/libc++.1.dylib (compatibility version 1.0.0, current
 version 1.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1252.50.4)
 }}}

 But the result does not work due to {{{@rpath}}}:

 {{{
 $ ./to_chars
 dyld: lazy symbol binding failed: Symbol not found:
 __ZNSt3__18to_charsEPcS0_d
   Referenced from: /Users/maxima/Desktop/./to_chars
   Expected in: /usr/lib/libc++.1.dylib

 dyld: Symbol not found: __ZNSt3__18to_charsEPcS0_d
   Referenced from: /Users/maxima/Desktop/./to_chars
   Expected in: /usr/lib/libc++.1.dylib

 Abort trap: 6
 }}}

 The value of {{{@rpath}}} should be specified when linking.

 {{{
 $ clang++-mp-17 -Wl,-rpath,/opt/local/libexec/llvm-17/lib/libc++
 -L/opt/local/libexec/llvm-17/lib/libc++ -lc++
 -D_LIBCPP_DISABLE_AVAILABILITY -o ./to_chars ./to_chars.cpp
 $
 $ ./to_chars
 3.141592653589793
 }}}

 On the other hand, it is easy to use {{{gcc15}}}:

 {{{
 $ c++-mp-15 -o ./to_chars ./to_chars.cpp
 $
 $ otool -L ./to_chars
 ./to_chars:
         @rpath/libstdc++.6.dylib (compatibility version 7.0.0, current
 version 7.34.0)
         @rpath/libgcc_s.1.1.dylib (compatibility version 1.0.0, current
 version 1.1.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1252.50.4)
 $
 $ ./to_chars
 3.141592653589793
 }}}
 {{{c++-mp-15}}} uses its own {{{libstdc++}}} instead of the system
 {{{libc++}}},
 and figures out {{{@rpath}}} automatically.

 Note: {{{libstdc++}}} and {{{libc++}}} are exclusive. So if {{{podofo}}}
 is built with {{{gcc15}}}, then {{{clang++}}} cannot use the
 {{{libpodofo.dylib}}} due to the link error.
 For example:

 {{{
 $ tar -xf /opt/local/var/macports/distfiles/podofo/podofo-1.1.1.tar.gz
 $
 $ clang++-mp-17 -isystem/opt/local/include -L/opt/local/lib -lpodofo -o
 ./helloworld ./podofo-1.1.1/examples/helloworld/helloworld.cpp
 Undefined symbols for architecture x86_64:
   "PoDoFo::PdfPainter::DrawText(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&, double, double,
 PoDoFo::PdfDrawTextStyle)", referenced from:
       HelloWorld(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&) in helloworld-af0be5.o
 "PoDoFo::PdfMetadata::SetKeywords(std::__1::vector<std::__1::basic_string<char,
 std::__1::char_traits<char>, std::__1::allocator<char> >,
 std::__1::allocator<std::__1::basic_string<char,
 std::__1::char_traits<char>, std::__1::allocator<char> > > >)", referenced
 from:
       HelloWorld(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&) in helloworld-af0be5.o
   "PoDoFo::PdfFontManager::SearchFont(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&, PoDoFo::PdfFontSearchParams const&,
 PoDoFo::PdfFontCreateParams const&)", referenced from:
       HelloWorld(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&) in helloworld-af0be5.o
   "PoDoFo::PdfMemDocument::Save(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&, PoDoFo::PdfSaveOptions)", referenced
 from:
       HelloWorld(std::__1::basic_string_view<char,
 std::__1::char_traits<char> > const&) in helloworld-af0be5.o
 ld: symbol(s) not found for architecture x86_64
 clang++: error: linker command failed with exit code 1 (use -v to see
 invocation)
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/74389#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list