StephanTLavavej / mingw-distro

MinGW distro build scripts.
492 stars 55 forks source link

std::filesystem support library is missing #72

Closed cristianadam closed 4 years ago

cristianadam commented 4 years ago

As mentioned at as a comment on the reddit announcement I tried building [vcpkg]() and got a linking error:

cannot find -lstdc++fs

I think the distro should include all standard C++ features.

I have compiled vcpkg with other MinGW distributions, after applying this patch.

By having vcpkg compiling with MinGW, one could build the whole vcpkg universe with this toolchain 😄

StephanTLavavej commented 4 years ago

This is an upstream libstdc++ issue; I'm not disabling filesystem. My vague understanding is that filesystem is currently incomplete for Windows, but I can't remember the exact status or whether there are plans to complete it. I'll leave this issue open, looking for:

jwakely commented 4 years ago

As I said on reddit just now:

Since GCC 9.1 std::filesystem is fully supported on Windows (except for a few things like symlinks and file permissions which don't work). Support for std::filesystem is enabled by default and doesn't need the libstdc++fs.a library.

Since GCC 9.1 std::experimental::filesystem is also supported on Windows, but is not enabled by default. You need to configure with --enable-libstdcxx-filesystem-ts to build the libstdc++fs.a library that contains the definitions of the std::experimental::filesystem symbols.

So if you only want C++17 that should already work. If you also want to support the Filesystem TS you need the extra configure option.

cristianadam commented 4 years ago

As it turns out linking to libstdc++fs.a was not needed as vcpkg's source code works with only std::filesystem.

I've updated my https://github.com/microsoft/vcpkg/pull/9137 to include some CMake checks, and to link only the library is present.

StephanTLavavej commented 4 years ago

@jwakely committed "Default to --enable-libstdcxx-filesystem-ts for *-*-mingw*" upstream: https://gcc.gnu.org/ml/libstdc++/2019-11/msg00120.html

As std::filesystem is already available, and the distro will automatically pick up std::experimental::filesystem when I build GCC 10, I'm going to go ahead and close this issue. Thanks again!