# Invalid version string during Windows build

**URL:** https://discourse.julialang.org/t/invalid-version-string-during-windows-build/53474
**Category:** Internals & Design
**Tags:** build
**Created:** [January 17, 2021, 7:32am UTC](https://discourse.julialang.org/t/invalid-version-string-during-windows-build/53474 "2021-01-17T07:32:10Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [January 17, 2021, 7:32am UTC](https://discourse.julialang.org/t/invalid-version-string-during-windows-build/53474/1 "2021-01-17T07:32:11Z")

</div>

I encountered the following error when trying to build Julia on Windows via Cygwin.

```julia
$ make -j8
...
    JULIA usr/lib/julia/sys.ji
...
error during bootstrap:
LoadError("sysimg.jl", 3, LoadError("Base.jl", 226, LoadError("version.jl", 245,
 ArgumentError("invalid version string: "))))
parse at .\version.jl:126 [inlined]

```

The relevant lines are here:  
[https://github.com/JuliaLang/julia/blob/7647ab574fba6460877d0c1c571a86fdf18b5d31/base/version.jl#L245-L251](https://github.com/JuliaLang/julia/blob/7647ab574fba6460877d0c1c571a86fdf18b5d31/base/version.jl#L245-L251)

I’ve already figured out the solution below, but I’m mainly posting in case anyone else encounters this issue.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [January 17, 2021, 7:50am UTC](https://discourse.julialang.org/t/invalid-version-string-during-windows-build/53474/2 "2021-01-17T07:50:04Z")

</div>

As the lines in version.jl hint at, the issue has to do with `libllvm_version_string`.

In my case, I found the following in `base/build.h`:

```julia
const libllvm_version_string = ""

```

This indicates a failure of getting `LLVM_CONFIG_HOST` to run.  
[https://github.com/JuliaLang/julia/blob/33cfcc44f23736346a8489399c1dd682cc6ba81f/base/Makefile#L68](https://github.com/JuliaLang/julia/blob/33cfcc44f23736346a8489399c1dd682cc6ba81f/base/Makefile#L68)

Indeed, we see that `llvm-config.exe` (in the julia source tree) produces no output and silently fails.

```julia
$ cat VERSION
1.7.0-DEV

$ usr/tools/llvm-config.exe --version

$ echo $?
127

$ ldd usr/tools/llvm-config.exe
        ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffc5e420000)
        KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffc5d010000)
        KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffc5b570000)
        msvcrt.dll => /cygdrive/c/WINDOWS/System32/msvcrt.dll (0x7ffc5cef0000)
        libstdc++-6.dll => /cygdrive/c/Users/kittisopikulm/AppData/Local/Programs/Julia 1.5.0/bin/libstdc++-6.dll (0x6fc40000)
        LLVM.dll => /cygdrive/c/Users/kittisopikulm/AppData/Local/Programs/Julia 1.5.0/bin/LLVM.dll (0x66740000)

```

The last two lines indicate that `libstdc++-6.dll` and `LLVM.dll` are getting dynamically linked from by Julia 1.5 install. This is because the Julia 1.5 installer added it to my Windows path:

```julia
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Users/kittisopikulm/AppData/Local/Programs/Julia 1.5.0/bin

```

If we prepend `usr/bin` in the Julia repo to the path, then the results look much more reasonable.

```julia
$ PATH="usr/bin:$PATH" usr/tools/llvm-config.exe --version
11.0.0jl

$ PATH="usr/bin:$PATH" ldd usr/tools/llvm-config.exe
        ntdll.dll => /cygdrive/c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffc5e420000)
        KERNEL32.DLL => /cygdrive/c/WINDOWS/System32/KERNEL32.DLL (0x7ffc5d010000)
        KERNELBASE.dll => /cygdrive/c/WINDOWS/System32/KERNELBASE.dll (0x7ffc5b570000)
        msvcrt.dll => /cygdrive/c/WINDOWS/System32/msvcrt.dll (0x7ffc5cef0000)
        libstdc++-6.dll => /cygdrive/c/Users/kittisopikulm/source/repos/julia/usr/bin/libstdc++-6.dll (0x6fc40000)
        LLVM.dll => /cygdrive/c/Users/kittisopikulm/source/repos/julia/usr/bin/LLVM.dll (0x66740000)
        ADVAPI32.dll => /cygdrive/c/WINDOWS/System32/ADVAPI32.dll (0x7ffc5e330000)
        sechost.dll => /cygdrive/c/WINDOWS/System32/sechost.dll (0x7ffc5ca20000)
        libgcc_s_seh-1.dll => /cygdrive/c/Users/kittisopikulm/source/repos/julia/usr/bin/libgcc_s_seh-1.dll (0x61440000)
        libwinpthread-1.dll => /cygdrive/c/Users/kittisopikulm/source/repos/julia/usr/bin/libwinpthread-1.dll (0x64940000)
        RPCRT4.dll => /cygdrive/c/WINDOWS/System32/RPCRT4.dll (0x7ffc5e1b0000)
        libgcc_s_seh-1.dll => /cygdrive/c/Users/kittisopikulm/source/repos/julia/usr/bin/libgcc_s_seh-1.dll (0x1460000)
        ole32.dll => /cygdrive/c/WINDOWS/System32/ole32.dll (0x7ffc5cd90000)
        combase.dll => /cygdrive/c/WINDOWS/System32/combase.dll (0x7ffc5d5a0000)
        ucrtbase.dll => /cygdrive/c/WINDOWS/System32/ucrtbase.dll (0x7ffc5bc10000)
        bcryptPrimitives.dll => /cygdrive/c/WINDOWS/System32/bcryptPrimitives.dll (0x7ffc5b9c0000)
        GDI32.dll => /cygdrive/c/WINDOWS/System32/GDI32.dll (0x7ffc5d500000)
        win32u.dll => /cygdrive/c/WINDOWS/System32/win32u.dll (0x7ffc5c4a0000)
        gdi32full.dll => /cygdrive/c/WINDOWS/System32/gdi32full.dll (0x7ffc5b820000)
        msvcp_win.dll => /cygdrive/c/WINDOWS/System32/msvcp_win.dll (0x7ffc5b3a0000)
        USER32.dll => /cygdrive/c/WINDOWS/System32/USER32.dll (0x7ffc5d0d0000)
        SHELL32.dll => /cygdrive/c/WINDOWS/System32/SHELL32.dll (0x7ffc5d9b0000)
        cfgmgr32.dll => /cygdrive/c/WINDOWS/System32/cfgmgr32.dll (0x7ffc5b440000)
        shcore.dll => /cygdrive/c/WINDOWS/System32/shcore.dll (0x7ffc5e0a0000)
        windows.storage.dll => /cygdrive/c/WINDOWS/System32/windows.storage.dll (0x7ffc5bd10000)
        profapi.dll => /cygdrive/c/WINDOWS/System32/profapi.dll (0x7ffc5b370000)
        powrprof.dll => /cygdrive/c/WINDOWS/System32/powrprof.dll (0x7ffc5b320000)
        UMPDC.dll => /cygdrive/c/WINDOWS/System32/UMPDC.dll (0x7ffc5b2d0000)
        shlwapi.dll => /cygdrive/c/WINDOWS/System32/shlwapi.dll (0x7ffc5e150000)
        kernel.appcore.dll => /cygdrive/c/WINDOWS/System32/kernel.appcore.dll (0x7ffc5b2e0000)
        cryptsp.dll => /cygdrive/c/WINDOWS/System32/cryptsp.dll (0x7ffc5baa0000)

```

The short term fix is to remove any Julia bin directories from your PATH. The long term fix is to have the Makefile prepend rather than append the `usr/bin` path as I detailed in

[https://github.com/JuliaLang/julia/pull/39275](https://github.com/JuliaLang/julia/pull/39275).
