public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ken Matsui <kmatsui@gcc.gnu.org>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: Re: Re: [PATCH v2 2/2] libstdc++: Use using instead of typedef in opts-common.h
Date: Thu, 11 Jan 2024 04:18:52 -0800	[thread overview]
Message-ID: <CAML+3pUB5aw+6BkuT2EzZfwe7+umnz-V2ysfxvC=GThZgsHjpg@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4nMSfuepYq109j0Rbe0DB9Umuw8CB=6GjN7GE5SugNdYw@mail.gmail.com>

On Thu, Jan 11, 2024 at 4:01 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Thu, 11 Jan 2024 at 11:28, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
> >
> > On Thu, 11 Jan 2024 at 10:50, Jonathan Wakely <jwakely@redhat.com> wrote:
> > > On Thu, 11 Jan 2024 at 10:12, Ken Matsui <kmatsui@cs.washington.edu> wrote:
> > > >
> > > > On Thu, 11 Jan 2024 at 09:55, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> > > > >    On Thu, 11 Jan 2024, 09:43 Ken Matsui, <[1]kmatsui@gcc.gnu.org> wrote:
> > > > >
> > > > >    > libstdc++-v3/ChangeLog:
> > > > >
> > > > >    >         * src/filesystem/ops-common.h (stat_type): Use using.
> > > > >
> > > > >    > Signed-off-by: Ken Matsui <[2]kmatsui@gcc.gnu.org>
> > > > >    > ---
> > > > >    >  libstdc++-v3/src/filesystem/ops-common.h | 4 ++--
> > > > >    >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > >    > diff --git a/libstdc++-v3/src/filesystem/ops-common.h
> > > > >    > b/libstdc++-v3/src/filesystem/ops-common.h
> > > > >    > index d78a54754c2..e302d8caae6 100644
> > > > >    > --- a/libstdc++-v3/src/filesystem/ops-common.h
> > > > >    > +++ b/libstdc++-v3/src/filesystem/ops-common.h
> > > > >    > @@ -118,7 +118,7 @@ namespace __gnu_posix
> > > > >    >    inline int close(int fd)
> > > > >    >    { return ::_close(fd); }
> > > > >
> > > > >    > -  typedef struct ::__stat64 stat_type;
> > > > >    > +  using stat_type = struct ::_stat64;
> > > > >
> > > > >    You've removed an underscore, is that intentional? Has this been compiled
> > > > >    + tested with mingw?
> > > > This is totally unintentional.  I'll fix it.  I've tested it with Linux
> > > > and do not have a mingw environment to test it with.  Would you have any
> > > > suggestions on how to test it?
> > >
> > > If your linux distro has prebuilt packages for mingw-w64-g++ then it's
> > > pretty easy to build a new compiler from trunk. I can give you a
> > > simple recipe for doing it on Fedora.
> > >
> > > In the meanwhile, I can test your updated patch for you.
> > >
> >
> > I am using Ubuntu and was able to install mingw-w64-g++ with apt.  I
> > tried the following command to test the patch:
> >
> > make check-target-libstdc++-v3 ALT_CXX_UNDER_TEST="$(which x86_64-w64-mingw32-g++)" RUNTESTFLAGS='conformance.exp=filesystem/*'
> >
> > But it looks like the test is not using the mingw compiler.  Also,
> > when we want to test to build GCC with a different compiler, do we
> > need to rebuild the whole GCC again (i.e., make clean && export CXX=...
> > && make)?
>
> Don't use 'make clean' with GCC, it doesn't work well. Just remove the
> build directory.
>
> Rebuilding with CXX set to your mingw compiler will not work. That
> would try to compile gcc using the mingw compiler, producing a
> compiler that would *run* on Windows. That's not what you want. You
> need to configure gcc with --target=x86_64-w64-mingw32 to build a
> compiler that *runs* on linux, but targets Windows.
>
> Do this in a separate build directory, don't try to reuse the same
> build directory that you already have for a native linux compiler.
>
> >
> > I really appreciate your recipe if it also works for Ubuntu.  Thank you!
>
> Here's what I do on Fedora:
> https://gist.github.com/jwakely/5579a4be12a86495d47cb5519f671b12#file-mingw-build-sh
>
> To figure that command out I checked the output of x86_64-w64-mingw32-g++ -v
> That will show you the sysroot used by the Ubuntu mingw compiler, and
> the other options it was built with. Copy the relevant ones and add
> those to your configure command for your mingw cross-compiler. On my
> systems, the configure command is:
>
> ../gcc/configure --prefix=/home/jwakely/gcc/mingw --with-gnu-as
> --with-as=/usr/bin/x86_64-w64-mingw32-as --with-gnu-ld
> --with-ld=/usr/bin/x86_64-w64-mingw32-ld --without-newlib
> --disable-multilib --disable-plugin --disable-libstdcxx-pch
> --with-system-zlib --disable-nls --without-included-gettext
> --disable-win32-registry --enable-threads=posix --enable-libgomp
> --target=x86_64-w64-mingw32
> --with-sysroot=/usr/x86_64-w64-mingw32/sys-root
> target_alias=x86_64-w64-mingw32 --enable-libstdcxx-debug
> --disable-libgomp --enable-libstdcxx-backtrace
> --enable-languages=c,c++
>
> The relevant parts that I copied from the output of the system
> 'x86_64-w64-mingw32-gcc -v' are:
>
> --with-as=/usr/bin/x86_64-w64-mingw32-as
> --with-ld=/usr/bin/x86_64-w64-mingw32-ld --without-newlib
> --disable-multilib --disable-plugin
> --disable-win32-registry
> --enable-threads=posix
> --target=x86_64-w64-mingw32
> --with-sysroot=/usr/x86_64-w64-mingw32/sys-root
>
> You might want the same options, but the paths to the mingw32-as,
> mingw32-ld and the sys-root will probably be different on Ubuntu.
>
> Looking at the -v output on Ubuntu, you probably want the
> --with-headers option and --enable-fully-dynamic-string (to be
> compatible with the system's mingw compiler) and
> --enable-threads=win32 as well as the --with-as and --with-ld options.
> You'll want to add a --prefix too so that you install somewhere under
> your home directory, not under /usr
>
> You might need to experiment with configure options until you get
> something to build that works.
>
> Once I have a mingw compiler that runs on my linux box, I use this
> script to test it:
> https://gist.github.com/jwakely/5579a4be12a86495d47cb5519f671b12#file-mingw_tests-sh
>
> Like so:
> find ~/src/gcc/gcc/libstdc++-v3/testsuite/27_io/filesystem -type f
> -name '*.cc' | ~/src/gcc/scripts/mingw_tests.sh
>
> That compiles all the 27_io filesystem tests using my mingw compiler
> and then runs them using Wine.
>

Thank you so much!  I will try it!

  reply	other threads:[~2024-01-11 12:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  6:22 [PATCH] libstdc++: Fix error handling for std::filesystem::equivalent [PR113250] Ken Matsui
2024-01-11  9:40 ` [PATCH v2 1/2] libstdc++: Fix error handling in filesystem::equivalent [PR113250] Ken Matsui
2024-01-11  9:40   ` [PATCH v2 2/2] libstdc++: Use using instead of typedef in opts-common.h Ken Matsui
2024-01-11  9:55     ` Jonathan Wakely
2024-01-11 10:10       ` Ken Matsui
2024-01-11 10:50         ` Jonathan Wakely
2024-01-11 11:28           ` Ken Matsui
2024-01-11 12:01             ` Jonathan Wakely
2024-01-11 12:18               ` Ken Matsui [this message]
2024-01-11 12:01           ` Jonathan Wakely
2024-01-11 12:19             ` Ken Matsui
2024-01-11 10:12   ` [PATCH v3 " Ken Matsui
2024-01-11 10:46   ` [PATCH v2 1/2] libstdc++: Fix error handling in filesystem::equivalent [PR113250] Jonathan Wakely
2024-01-11 10:55     ` Ken Matsui
2024-01-11 11:14       ` Backporting [was Re: [PATCH v2 1/2] libstdc++: Fix error handling in filesystem::equivalent [PR113250]] Jonathan Wakely
2024-01-11 11:45         ` Ken Matsui
2024-01-11 12:22           ` Ken Matsui
2024-01-11 12:26             ` Jonathan Wakely
2024-01-11 12:35               ` Ken Matsui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAML+3pUB5aw+6BkuT2EzZfwe7+umnz-V2ysfxvC=GThZgsHjpg@mail.gmail.com' \
    --to=kmatsui@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).