This is the mail archive of the
mailing list for the libstdc++ project.
Re: [PATCH 2/2] PR libstdc++/86756 Move rest of std::filesystem to libstdc++.so
On Mon, 7 Jan 2019 at 13:39, Jonathan Wakely <email@example.com> wrote:
> On 07/01/19 09:48 +0000, Jonathan Wakely wrote:
> >On 07/01/19 10:24 +0100, Christophe Lyon wrote:
> >>Hi Jonathan
> >>On Sun, 6 Jan 2019 at 23:37, Jonathan Wakely <firstname.lastname@example.org> wrote:
> >>>Move std::filesystem directory iterators and operations from
> >>>libstdc++fs.a to main libstdc++ library. These components have many
> >>>dependencies on OS support, which is not available on all targets. Some
> >>>additional autoconf checks and conditional compilation is needed to
> >>>ensure the files will build for all targets. Previously this code was
> >>>not compiled without --enable-libstdcxx-filesystem-ts but the C++17
> >>>components should be available for all hosted builds.
> >>>The tests for these components no longer need to link to libstdc++fs.a,
> >>>but are not expected to pass on all targets. To avoid numerous failures
> >>>on targets which are not expected to pass the tests (due to missing OS
> >>>functionality) leave the dg-require-filesystem-ts directives in place
> >>>for now. This will ensure the tests only run for builds where the
> >>>filesystem-ts library is built, which presumably means some level of OS
> >>>support is present.
> >>>Tested x86_64-linux (old/new string ABIs, 32/64 bit), x86_64-w64-mingw32.
> >>>Committed to trunk.
> >>After this commit (r267616), I've noticed build failures for my
> >>newlib-based toolchains:
> >>aarch64-elf, arm-eabi:
> >>In file included from
> >>error: '::truncate' has not been declared
> >> 142 | using ::truncate;
> >> | ^~~~~~~~
> >>In function 'void std::filesystem::resize_file(const
> >>std::filesystem::__cxx11::path&, uintmax_t, std::error_code&)':
> >>error: 'truncate' is not a member of 'posix'
> >>1274 | else if (posix::truncate(p.c_str(), size))
> >> | ^~~~~~~~
> >>make: *** [fs_ops.lo] Error 1
> >>I'm not sure if there's an obvious fix? Note that I'm using a rather
> >>old newlib version, if that matters.
> >That's probably the reason, as I didn't see this in my tests with
> >newlib builds.
> >The fix is to add yet another autoconf check and guard the uses of
> >truncate with a _GLIBCXX_USE_TRUNCATE macro. I'll do that now ...
> Should be fixed with this patch, committed to trunk as r267647.
Yes, it works. Thanks!