what's with the C++ <filesystem> extension?
Chris Jones
jonesc at hep.phy.cam.ac.uk
Sun Sep 18 22:57:53 UTC 2022
> On 18 Sep 2022, at 1:29 pm, René J.V. Bertin <rjvbertin at gmail.com> wrote:
>
> Hi,
>
> Building C++ code that does
>
> #include <filesystem>
>
> I get either a file-not-found error or a bunch of errors that the functions are 10.15+ only. What's with that?
Seems pretty clear to me…
> If the implementation is provided by libc++, isn't this something that could be patched? Shouldn't require any external dependencies on systems that already underwent the libc++ conversion.
>
> On more recent systems that have a stock libc++ one can install `port:libcxx` with the binaries under $prefix . I have been doing that for years so all MacPorts executables use it, and that has never caused any ABI issues with system libraries that were built against the stock libc++ version.
> In fact, I often use my own build for other applications as well, assuming they'll benefit from newer=better and the maximum optimisation I used in the build.
There is a difference between what c++ language features a compiler supports, and what features the standard library used supports. If your system Xcode does not support a given feature, you can try using a newer clang from macports. However, all clang compilers supplied by Xcode, and macports use the system libc++ support library.
Just installing libcxx does nothing in itself, unless you are on very old OS versions which have no system libc++ support. If your system does, then installing the port has no bearing on what ports will subsequently use. If you wish this to happen you are expected to manually replace the system library. See the port notes (which i assume tou have already read right)
https://ports.macports.org/port/libcxx/details/
“libc++ is a new implementation of the C++ standard library with support for C++11 and portions of C++14.
libc++ is a new implementation of the C++ standard library with support for C++11 and portions of C++14. Because objects cannot be passed between different versions of the C++ runtime, this port must replace the host version in order to be used. On Snow Leopard and earlier, this is done automatically because there is no existing host version of this library. On Lion and later, users must build the port with +replacemnt_libcxx and install the root manually if they wish to replace the existing host implementation.“
Follow the above at your own risk.
The much better solution, imho, is if you needed newer c++ support, just migrate to a more recent os that supports it…
Chris
>
> R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220918/222afc7a/attachment.htm>
More information about the macports-dev
mailing list