diff -ur a/SConstruct b/SConstruct
--- a/SConstruct	2022-09-03 04:02:06.000000000 +0800
+++ b/SConstruct	2024-05-24 21:06:09.204032200 +0800
@@ -311,10 +311,8 @@
 def GetArcSuffix(env, unicode = None):
 	if unicode is None:
 		unicode = 'UNICODE' in env['CPPDEFINES']
-	suff = '-unicode'
-	if not unicode:
-		suff = '-ansi'
-	return GetArcCPU(env) + suff
+	# We do not use GetArcCPU here because this is constant in the MSYS2 package
+	return 'unicode' if unicode else 'ansi'
 
 def SafeFile(f):
 	from types import StringType
diff -ur a/Source/build.cpp b/Source/build.cpp
--- a/Source/build.cpp	2023-07-28 01:18:23.532000000 +0800
+++ b/Source/build.cpp	2024-05-24 21:06:09.312533000 +0800
@@ -3766,7 +3766,7 @@
 
   tstring searchPath = definedlist.find(_T("NSISDIR"));
   searchPath += PLATFORM_PATH_SEPARATOR_STR _T("Plugins") PLATFORM_PATH_SEPARATOR_STR;
-  searchPath += get_target_suffix();
+  searchPath += get_target_suffix(false);
 
   SCRIPT_MSG(_T("Processing default plugins: \"%") NPRIs PLATFORM_PATH_SEPARATOR_STR _T("*.dll\"\n"), searchPath.c_str());
   if (!m_pPlugins->Initialize(searchPath.c_str(), is_target_64bit(), !!display_script))
@@ -4035,14 +4035,14 @@
   return success ? PS_OK : PS_ERROR;
 }
 
-const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval) const
+const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt, const bool include_arch, const TCHAR*defval) const
 {
   switch(tt)
   {
-  case TARGET_X86ANSI   : return _T("x86-ansi");
-  case TARGET_X86UNICODE: return _T("x86-unicode");
-  case TARGET_AMD64     : return _T("amd64-unicode");
-  case TARGET_ARM64     : return _T("arm64-unicode");
+  case TARGET_X86ANSI   : return include_arch? _T("x86-ansi") : _T("ansi");
+  case TARGET_X86UNICODE: return include_arch? _T("x86-unicode") : _T("unicode");
+  case TARGET_AMD64     : return include_arch? _T("amd64-unicode") : _T("unicode");
+  case TARGET_ARM64     : return include_arch? _T("arm64-unicode") : _T("unicode");
   default: return defval;
   }
 }
@@ -4079,10 +4079,22 @@
 
 CEXEBuild::TARGETTYPE CEXEBuild::get_target_type(const TCHAR*s) const
 {
+  tstring str = s;
+#if defined(__GNUC__)
+  if (s && !_tcsstr(s, _TEXT("-")))
+#if defined(__x86_64__) || defined(__LP64__)
+    str = _TEXT("amd64-") + str;
+#else
+    str = _TEXT("x86-") + str;
+#endif
+#endif
+
   for(int i = CEXEBuild::TARGETFIRST; i < CEXEBuild::TARGETCOUNT; ++i)
   {
     CEXEBuild::TARGETTYPE tt = (CEXEBuild::TARGETTYPE) i;
-    if (!_tcsicmp(get_target_suffix(tt, _T("")),s) && *s) return tt;
+    if (!_tcsicmp(get_target_suffix(tt, true, _T("")),str.c_str()) && *s) return tt;
+    if (!_tcsicmp(get_target_suffix(tt, false, _T("")),str.c_str()) && *s) return tt;
+
   }
   return TARGET_UNKNOWN;
 }
@@ -4093,17 +4105,22 @@
   errstr += _T(": Target parameter must be one of: "), errstr += prefix;
   for(int comma = 0, i = CEXEBuild::TARGETFIRST; i < CEXEBuild::TARGETCOUNT; ++i)
   {
-    const TCHAR *ts = get_target_suffix((CEXEBuild::TARGETTYPE) i, 0);
+    // TODO: test this
+    const TCHAR *ts = get_target_suffix((CEXEBuild::TARGETTYPE) i, true, 0);
+    const TCHAR *ts2 = get_target_suffix((CEXEBuild::TARGETTYPE) i, false, 0);
     if (!ts) continue;
     if (comma++) errstr += _T(", "), errstr += prefix;
     errstr += ts;
+    if (!ts2) continue;
+    errstr += _T(", /");
+    errstr += ts2;
   }
   ERROR_MSG(_T("Error: %") NPRIs _T("\n"), errstr.c_str());
 }
 
 int CEXEBuild::load_stub()
 {
-  return update_exehead(stub_filename+_T("-")+get_target_suffix(), &m_exehead_original_size);
+  return update_exehead(stub_filename+_T("-")+get_target_suffix(false), &m_exehead_original_size);
 }
 
 int CEXEBuild::update_exehead(const tstring& file, size_t *size/*=NULL*/) {
diff -ur a/Source/build.h b/Source/build.h
--- a/Source/build.h	2023-07-28 01:18:23.435000000 +0800
+++ b/Source/build.h	2024-05-24 21:06:09.374846500 +0800
@@ -246,8 +246,8 @@
     TARGETTYPE m_target_type;
     TARGETTYPE get_target_type(const TCHAR*s) const;
     bool m_previous_x86_unicode;
-    const TCHAR* get_target_suffix(CEXEBuild::TARGETTYPE tt, const TCHAR*defval = _T("?")) const;
-    const TCHAR* get_target_suffix() const { return get_target_suffix(m_target_type); }
+    const TCHAR* get_target_suffix(CEXEBuild::TARGETTYPE tt, const bool include_arch, const TCHAR*defval = _T("?")) const;
+    const TCHAR* get_target_suffix(const bool include_arch) const { return get_target_suffix(m_target_type, include_arch); }
     static bool is_targettype_64bit(TARGETTYPE tt) { return TARGET_AMD64 == tt || TARGET_ARM64 == tt; }
     bool is_target_64bit() const { return is_targettype_64bit(m_target_type); }
     void print_bad_targettype_parameter(const TCHAR*cmdname, const TCHAR*prefix = _T("")) const;
diff -ur a/Source/makenssi.cpp b/Source/makenssi.cpp
--- a/Source/makenssi.cpp	2023-07-28 01:18:23.000000000 +0800
+++ b/Source/makenssi.cpp	2024-05-24 21:06:09.404111600 +0800
@@ -663,7 +663,7 @@
     _ftprintf(g_output,_T("\nProcessed "));
     if (files_processed) _ftprintf(g_output,_T("%d file%") NPRIs _T(", "),files_processed,files_processed==1?_T(""):_T("s"));
     if (cmds_processed) _ftprintf(g_output,_T("%d command line command%") NPRIs _T(", "),cmds_processed,cmds_processed==1?_T(""):_T("s"));
-    _ftprintf(g_output,_T("writing output (%") NPRIs _T("):\n"),build.get_target_suffix());
+    _ftprintf(g_output,_T("writing output (%") NPRIs _T("):\n"),build.get_target_suffix(true));
     fflush(g_output);
   }
   
diff -ur a/Source/script.cpp b/Source/script.cpp
--- a/Source/script.cpp	2023-05-24 23:16:05.013000000 +0800
+++ b/Source/script.cpp	2024-05-24 21:06:09.502163100 +0800
@@ -3725,7 +3725,7 @@
             {
               pluginfullpath = definedlist.find(_T("NSISDIR"));
               pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + _T("Plugins");
-              pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + get_target_suffix();
+              pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + get_target_suffix(false);
               pluginfullpath += tstring(PLATFORM_PATH_SEPARATOR_STR) + t;
             }
             t = (TCHAR*) pluginfullpath.c_str();
