From aa15f1a243ee20c109ce85e6d1573982ebb1bd36 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Tue, 20 Dec 2022 14:52:05 +0100 Subject: [PATCH] Avoid UNICODE characters in TMP env var Some people have Unicode characters in their TMP path. This is not properly handled by gcc, when it creates temporary files, so that it fails to compile. As a work-around we verify that TMP contains only ACSII characters, and if not set it to MSYS2's /tmp. This variable es NOT restored by "ridk disable", because the cmd and powershell mechanism to set variables doesn't support Unicode either. Fixes #320 --- lib/ruby_installer/build/msys2_installation.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ruby_installer/build/msys2_installation.rb b/lib/ruby_installer/build/msys2_installation.rb index 075b71cd2..0a374df61 100644 --- a/lib/ruby_installer/build/msys2_installation.rb +++ b/lib/ruby_installer/build/msys2_installation.rb @@ -149,6 +149,10 @@ def disable_dll_search_paths vars['ACLOCAL_PATH'] = "#{mingw_prefix}/share/aclocal:/usr/share/aclocal" vars['MANPATH'] = "#{mingw_prefix}/share/man" vars['MINGW_PACKAGE_PREFIX'] = mingw_package_prefix + if ENV['TMP'] !~ /\A[ -~]*\z/ + # TMP has some Unicode characters -> use MSYS2's /tmp to work around incompat with gcc's temporary files + vars['TMP'] = backslachs( msys_path + "/tmp" ) + end case mingwarch when 'mingw32'