# Building gollvm on Windows 10 (i386): unable to determine host target triple; string sub-command REGEX, mode MATCH needs at least 5 arguments; Unknown architecture host

**URL:** https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654
**Category:** Usage
**Tags:** os:windows, comp:clang
**Created:** [July 31, 2020, 8:15pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654 "2020-07-31T20:15:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Ivan\_Serdyuk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ivan_serdyuk/32/217_2.png) [@Ivan\_Serdyuk](https://discourse.cmake.org/u/Ivan_Serdyuk)
#### Post date: [July 31, 2020, 8:15pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654/1 "2020-07-31T20:15:52Z")

</div>

I have experienced some issues ([gollvm’s project README](https://go.googlesource.com/gollvm/+/refs/heads/master/README.md)), which look pretty much CMake related:

> cmake -DCMAKE\_BUILD\_TYPE=Debug -DCMAKE\_CXX\_FLAGS=-stdlib=libc++ -DCMAKE\_CXX\_COMPILER=clang++ -DCMAKE\_C\_COMPILER=clang -DGOLLVM\_DEFAULT\_LINKER=lld -G Ninja …/llvm-project/llvm

– The C compiler identification is Clang 10.0.0 with GNU-like command-line  
– The CXX compiler identification is Clang 10.0.0 with GNU-like command-line  
– The ASM compiler identification is Clang  
– Found assembler: C:/Program Files/LLVM/bin/clang.exe  
– Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe  
– Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe – works  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Detecting C compile features  
– Detecting C compile features - done  
– Check for working CXX compiler: C:/Program Files/LLVM/bin/clang++.exe  
– Check for working CXX compiler: C:/Program Files/LLVM/bin/clang++.exe – works  
– Detecting CXX compiler ABI info  
– Detecting CXX compiler ABI info - done  
– Detecting CXX compile features  
– Detecting CXX compile features - done  
– Looking for dlfcn.h  
– Looking for dlfcn.h - not found  
– Looking for errno.h  
– Looking for errno.h - found  
– Looking for fcntl.h  
– Looking for fcntl.h - found  
– Looking for link.h  
– Looking for link.h - not found  
– Looking for malloc/malloc.h  
– Looking for malloc/malloc.h - not found  
– Looking for signal.h  
– Looking for signal.h - found  
– Looking for sys/ioctl.h  
– Looking for sys/ioctl.h - not found  
– Looking for sys/mman.h  
– Looking for sys/mman.h - not found  
– Looking for sys/param.h  
– Looking for sys/param.h - not found  
– Looking for sys/resource.h  
– Looking for sys/resource.h - not found  
– Looking for sys/stat.h  
– Looking for sys/stat.h - found  
– Looking for sys/time.h  
– Looking for sys/time.h - not found  
– Looking for sys/types.h  
– Looking for sys/types.h - found  
– Looking for termios.h  
– Looking for termios.h - not found  
– Looking for unistd.h  
– Looking for unistd.h - not found  
– Looking for valgrind/valgrind.h  
– Looking for valgrind/valgrind.h - not found  
– Looking for fenv.h  
– Looking for fenv.h - found  
– Looking for FE\_ALL\_EXCEPT  
– Looking for FE\_ALL\_EXCEPT - found  
– Looking for FE\_INEXACT  
– Looking for FE\_INEXACT - found  
– Looking for mach/mach.h  
– Looking for mach/mach.h - not found  
– Looking for histedit.h  
– Looking for histedit.h - not found  
– Looking for CrashReporterClient.h  
– Looking for CrashReporterClient.h - not found  
– Looking for pfm\_initialize in pfm  
– Looking for pfm\_initialize in pfm - not found  
– Looking for xar\_open in xar  
– Looking for xar\_open in xar - not found  
– Looking for arc4random  
– Looking for arc4random - not found  
– Looking for backtrace  
– Looking for backtrace - not found  
– Could NOT find Backtrace (missing: Backtrace\_LIBRARY Backtrace\_INCLUDE\_DIR)  
– Performing Test C\_SUPPORTS\_WERROR\_UNGUARDED\_AVAILABILITY\_NEW  
– Performing Test C\_SUPPORTS\_WERROR\_UNGUARDED\_AVAILABILITY\_NEW - Success  
– Looking for \_Unwind\_Backtrace  
– Looking for \_Unwind\_Backtrace - not found  
– Looking for getpagesize  
– Looking for getpagesize - not found  
– Looking for sysconf  
– Looking for sysconf - not found  
– Looking for getrusage  
– Looking for getrusage - not found  
– Looking for setrlimit  
– Looking for setrlimit - not found  
– Looking for isatty  
– Looking for isatty - not found  
– Looking for futimens  
– Looking for futimens - not found  
– Looking for futimes  
– Looking for futimes - not found  
– Looking for posix\_fallocate  
– Looking for posix\_fallocate - not found  
– Looking for sigaltstack  
– Looking for sigaltstack - not found  
– Looking for lseek64  
– Looking for lseek64 - not found  
– Looking for mallctl  
– Looking for mallctl - not found  
– Looking for mallinfo  
– Looking for mallinfo - not found  
– Looking for malloc\_zone\_statistics  
– Looking for malloc\_zone\_statistics - not found  
– Looking for getrlimit  
– Looking for getrlimit - not found  
– Looking for posix\_spawn  
– Looking for posix\_spawn - not found  
– Looking for pread  
– Looking for pread - not found  
– Looking for sbrk  
– Looking for sbrk - not found  
– Looking for strerror  
– Looking for strerror - found  
– Looking for strerror\_r  
– Looking for strerror\_r - not found  
– Looking for strerror\_s  
– Looking for strerror\_s - found  
– Looking for setenv  
– Looking for setenv - not found  
– Looking for \_chsize\_s  
– Looking for \_chsize\_s - found  
– Looking for \_alloca  
– Looking for \_alloca - not found  
– Looking for \_\_alloca  
– Looking for \_\_alloca - not found  
– Looking for \_\_chkstk  
– Looking for \_\_chkstk - not found  
– Looking for \_\_chkstk\_ms  
– Looking for \_\_chkstk\_ms - not found  
– Looking for \_\_\_chkstk  
– Looking for \_\_\_chkstk - not found  
– Looking for \_\_\_chkstk\_ms  
– Looking for \_\_\_chkstk\_ms - not found  
– Looking for \_\_ashldi3  
– Looking for \_\_ashldi3 - not found  
– Looking for \_\_ashrdi3  
– Looking for \_\_ashrdi3 - not found  
– Looking for \_\_divdi3  
– Looking for \_\_divdi3 - not found  
– Looking for \_\_fixdfdi  
– Looking for \_\_fixdfdi - not found  
– Looking for \_\_fixsfdi  
– Looking for \_\_fixsfdi - not found  
– Looking for \_\_floatdidf  
– Looking for \_\_floatdidf - not found  
– Looking for \_\_lshrdi3  
– Looking for \_\_lshrdi3 - not found  
– Looking for \_\_moddi3  
– Looking for \_\_moddi3 - not found  
– Looking for \_\_udivdi3  
– Looking for \_\_udivdi3 - not found  
– Looking for \_\_umoddi3  
– Looking for \_\_umoddi3 - not found  
– Looking for \_\_main  
– Looking for \_\_main - not found  
– Looking for \_\_cmpdi2  
– Looking for _cmpdi2 - not found  
– Performing Test HAVE\_STRUCT\_STAT\_ST\_MTIMESPEC\_TV\_NSEC  
– Performing Test HAVE\_STRUCT\_STAT\_ST\_MTIMESPEC\_TV\_NSEC - Failed  
– Performing Test HAVE\_STRUCT\_STAT\_ST\_MTIM\_TV\_NSEC  
– Performing Test HAVE\_STRUCT\_STAT\_ST\_MTIM\_TV\_NSEC - Failed  
– Looking for GLIBC  
– Looking for GLIBC_ - not found  
– Performing Test HAVE\_STD\_IS\_TRIVIALLY\_COPYABLE  
– Performing Test HAVE\_STD\_IS\_TRIVIALLY\_COPYABLE - Success  
– Performing Test HAVE\_CXX\_ATOMICS\_WITHOUT\_LIB  
– Performing Test HAVE\_CXX\_ATOMICS\_WITHOUT\_LIB - Success  
– Performing Test HAVE\_CXX\_ATOMICS64\_WITHOUT\_LIB  
– Performing Test HAVE\_CXX\_ATOMICS64\_WITHOUT\_LIB - Success  
– Performing Test LLVM\_HAS\_ATOMICS  
– Performing Test LLVM\_HAS\_ATOMICS - Success  
– Performing Test SUPPORTS\_VARIADIC\_MACROS\_FLAG  
– Performing Test SUPPORTS\_VARIADIC\_MACROS\_FLAG - Success  
– Performing Test SUPPORTS\_GNU\_ZERO\_VARIADIC\_MACRO\_ARGUMENTS\_FLAG  
– Performing Test SUPPORTS\_GNU\_ZERO\_VARIADIC\_MACRO\_ARGUMENTS\_FLAG - Success  
CMake Warning at _cmake/modules/GetHostTriple.cmake:26_ (message):  
**unable to determine host target triple**  
Call Stack (most recent call first):  
_cmake/config-ix.cmake:378 (get\_host\_triple)_  
CMakeLists.txt:647 (include)

CMake Error at _cmake/config-ix.cmake:386_ (string):  
**string sub-command REGEX, mode MATCH needs at least 5 arguments total to**  
\*\* command.\*\*  
Call Stack (most recent call first):  
CMakeLists.txt:647 (include)

CMake Error at _cmake/config-ix.cmake:430_ (message):  
**Unknown architecture host**  
Call Stack (most recent call first):  
CMakeLists.txt:647 (include)

So there are 2 or 3 problems, which caused this.  
Ivan

---

<div class="post-metadata">

### Author: ![Ivan\_Serdyuk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ivan_serdyuk/32/217_2.png) [@Ivan\_Serdyuk](https://discourse.cmake.org/u/Ivan_Serdyuk)
#### Post date: [July 31, 2020, 8:56pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654/2 "2020-07-31T20:56:01Z")

</div>

I am referencing my logs:  
[https://drive.google.com/file/d/19k6pkZAMM\_JJU3W6e6g4rxfXcWcR5uJH/view?usp=sharing](https://drive.google.com/file/d/19k6pkZAMM_JJU3W6e6g4rxfXcWcR5uJH/view?usp=sharing)  
[https://drive.google.com/file/d/1Fdtpx1lNk1f3tWS6mY526fw6cH6jHFfg/view?usp=sharing](https://drive.google.com/file/d/1Fdtpx1lNk1f3tWS6mY526fw6cH6jHFfg/view?usp=sharing)

Ivan

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [July 31, 2020, 10:01pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654/3 "2020-07-31T22:01:55Z")

</div>

> [@Ivan\_Serdyuk](#):
>
> CMake Error at _cmake/config-ix.cmake:386_ (string):  
> **string sub-command REGEX, mode MATCH needs at least 5 arguments total to**  
> \*\* command.\*\*

That error is usually a sign that the project code at the location being complained about is missing some quotes around one of the arguments to the `string(REGEX MATCH)` command. That argument is likely a variable substitution that the author expected to never be empty, but it turned out to be empty for your particular situation and the argument ends up being elided. That reduces the number of arguments the command sees, leading to this error message.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 11, 2020, 9:02pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654/4 "2020-11-11T21:02:26Z")

</div>

In this case, I think it is `LLVM_HOST_TRIPLE` which is empty. This part of the output seems to agree with it. Why it can’t get a host triple is a question best left for upstream to answer.

> [@Ivan\_Serdyuk](#):
>
> CMake Warning at _cmake/modules/GetHostTriple.cmake:26_ (message):  
> **unable to determine host target triple**

---

<div class="post-metadata">

### Author: ![Ivan\_Serdyuk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ivan_serdyuk/32/217_2.png) [@Ivan\_Serdyuk](https://discourse.cmake.org/u/Ivan_Serdyuk)
#### Post date: [January 13, 2021, 8:22pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654/5 "2021-01-13T20:22:15Z")

</div>

I see.  
Now I got much more understanding of future Windows 10 port, for gollvm (not without the mentorship of experts, as you could guess).  
I will get back to this, soon - and try to use what I learned, during the previous experiments.

But it is much more probable that it would be x86\_64 build of Windows 10 (I would have to open another issue) first - and I could get back to this (or IF I would get back to this - i686 Windows 10 is getting retired; but i686 Linux port of gollvm is what I dealing with now).

---

<div class="post-metadata">

### Author: ![MilesLitteral](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mileslitteral/32/4068_2.png) [@MilesLitteral](https://discourse.cmake.org/u/MilesLitteral)
#### Post date: [December 8, 2023, 9:45pm UTC](https://discourse.cmake.org/t/building-gollvm-on-windows-10-i386-unable-to-determine-host-target-triple-string-sub-command-regex-mode-match-needs-at-least-5-arguments-unknown-architecture-host/1654/6 "2023-12-08T21:45:17Z")

</div>

try setting the host triplet as a build argument like so

```auto
-DLLVM_HOST_TRIPLE=i386

```

```auto
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DLLVM_HOST_TRIPLE=i386 -DGOLLVM_DEFAULT_LINKER=lld -G Ninja …/llvm-project/llvm

```

this helped me whenever LLVM generated this issue especially with newer OS like Win10/11
