public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "costas.argyris at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug driver/108865] gcc on Windows fails with Unicode path to source file
Date: Sat, 25 Feb 2023 14:15:11 +0000	[thread overview]
Message-ID: <bug-108865-4-WBnM9Ceqwa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108865-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108865

--- Comment #4 from Costas Argyris <costas.argyris at gmail dot com> ---
Using the manifest approach described in:

https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

it is possible to convert a full existing gcc + mingw-w64 toolchain (all
executables) to use UTF-8 as their active code page.

The proper solution would be to integrate the UTF-8 manifest into gcc's own
build process.    Until that happens, and to enable existing installations to
work with Unicode paths, this is the procedure to convert an existing gcc
(mingw-w64) installation on Windows to use the UTF-8 code page.

Requirements:

1) See above link to check if your version of Windows supports this.
2) You must have the manifest tool mt.exe installed and know its location.
3) Go to a temp dir and create a 'utf8_acp_setting.manifest' file with this
content:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <application>
    <windowsSettings>
      <activeCodePage
xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
    </windowsSettings>
  </application>
</assembly>

Assume that the current installation is at C:\mingw64.    We are going to
create a copy of it in C:\mingw64-UTF8 and apply the UTF-8 manifest in every
executable using mt.exe.

Add the folder of mt.exe to the path, for example

set PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;%PATH%

('where mt' should find it)

Copy the entire C:\mingw64 directory to C:\mingw64-UTF8 from the UI or using

robocopy C:\mingw64 C:\mingw64-UTF8 /e

Cd into the folder where utf8_acp_setting.manifest is and run:

for /F %f in ('dir /B /S C:\mingw64-UTF8\*.exe') do mt "-outputresource:%f;1"
-manifest "utf8_acp_setting.manifest"

After this, the toolchain under C:\mingw64-UTF8 should be able to compile the
file that was previously failing.

Make sure that you add C:\mingw64-UTF8\bin to the path instead of
C:\mingw64\bin

set PATH=C:\mingw64-UTF8\bin;%PATH%

and check with 'where gcc' - it should return the one under C:\mingw64-UTF8\bin

Now compile the file in the Unicode path that was previously failing:

C:\Users\cargyris\temp>gcc ﹏\src.c

C:\Users\cargyris\temp>echo %errorlevel%
0

no errors this time.

  parent reply	other threads:[~2023-02-25 14:15 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 21:11 [Bug driver/108865] New: " costas.argyris at gmail dot com
2023-02-20 21:23 ` [Bug driver/108865] " pinskia at gcc dot gnu.org
2023-02-20 21:39 ` costas.argyris at gmail dot com
2023-02-20 21:41 ` pinskia at gcc dot gnu.org
2023-02-25 14:15 ` costas.argyris at gmail dot com [this message]
2023-02-25 18:27 ` pinskia at gcc dot gnu.org
2023-02-28 21:01 ` costas.argyris at gmail dot com
2023-02-28 21:11 ` costas.argyris at gmail dot com
2023-02-28 21:14 ` pinskia at gcc dot gnu.org
2023-02-28 21:27 ` pinskia at gcc dot gnu.org
2023-02-28 22:07 ` costas.argyris at gmail dot com
2023-03-01 10:38 ` costas.argyris at gmail dot com
2023-03-01 17:08 ` costas.argyris at gmail dot com
2023-03-02  0:57 ` costas.argyris at gmail dot com
2023-03-02  1:11 ` pinskia at gcc dot gnu.org
2023-03-02  9:56 ` costas.argyris at gmail dot com
2023-03-02 23:50 ` pinskia at gcc dot gnu.org
2023-03-05 23:42 ` costas.argyris at gmail dot com
2023-03-05 23:50 ` pinskia at gcc dot gnu.org
2023-03-06 12:25 ` costas.argyris at gmail dot com
2023-03-09 15:00 ` cvs-commit at gcc dot gnu.org
2023-03-09 16:22 ` pinskia at gcc dot gnu.org
2023-03-22 10:00 ` lh_mouse at 126 dot com
2023-03-22 10:35 ` costas.argyris at gmail dot com
2023-03-22 15:37 ` lh_mouse at 126 dot com
2023-03-23  1:13 ` costas.argyris at gmail dot com
2023-03-23  4:48 ` lh_mouse at 126 dot com
2023-03-23  9:24 ` costas.argyris at gmail dot com
2023-03-23  9:53 ` costas.argyris at gmail dot com
2023-03-24 12:00 ` costas.argyris at gmail dot com
2023-03-24 13:33 ` rguenth at gcc dot gnu.org
2023-03-29 11:58 ` costas.argyris at gmail dot com
2023-03-29 12:01 ` costas.argyris at gmail dot com
2023-03-29 12:20 ` costas.argyris at gmail dot com
2023-11-15  0:05 ` peter0x44 at disroot dot org
2023-11-15  0:10 ` pinskia at gcc dot gnu.org
2023-11-15  0:13 ` pinskia at gcc dot gnu.org
2023-11-15  0:15 ` peter0x44 at disroot dot org
2023-11-15  1:31 ` lh_mouse at 126 dot com
2023-11-15  9:23 ` ebotcazou at gcc dot gnu.org
2023-11-15 13:16 ` costas.argyris at gmail dot com
2023-11-15 13:57 ` ebotcazou at gcc dot gnu.org
2023-11-16 13:41 ` costas.argyris at gmail dot com
2023-11-16 14:57 ` ebotcazou at gcc dot gnu.org
2023-11-18  2:41 ` aoliva at gcc dot gnu.org
2023-11-20 18:35 ` costas.argyris at gmail dot com
2023-11-23  0:49 ` cvs-commit at gcc dot gnu.org
2023-11-29 10:56 ` cvs-commit at gcc dot gnu.org

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=bug-108865-4-WBnM9Ceqwa@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).