From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EF4D4385841A; Sat, 25 Feb 2023 14:15:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF4D4385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677334512; bh=7/r0eWLoIYlHP5HIOSr8Pdm15fWIz3jqYOmSAgXyAmE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=a3qwUlD9eQGobxgPGVtWdwS1dFu0+isXLzhMdcMVYojmkY0B5ZuRgcNqBR0VVJOTu 30VRnRDLnvYutcp3Qe8oD2NKbVTbMqWQsYK95CK7NzIzxLVvAqnUKTnwc5P0E1s+ON ruwT5WPowOEgahFGaQHa1CoOYDfgKFPHuYKf/DeQ= From: "costas.argyris at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: driver X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: costas.argyris at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108865 --- Comment #4 from Costas Argyris --- 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: UTF-8 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=3DC:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64;%PAT= H% ('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 t= he file that was previously failing. Make sure that you add C:\mingw64-UTF8\bin to the path instead of C:\mingw64\bin set PATH=3DC:\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 =EF=B9=8F\src.c C:\Users\cargyris\temp>echo %errorlevel% 0 no errors this time.=