# Build Error (Win): Compiling with MinGW/MSYS2 from source

**URL:** https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078
**Category:** Internals & Design
**Tags:** question
**Created:** [February 13, 2017, 12:43pm UTC](https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078 "2017-02-13T12:43:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Martin\_Florek](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)
#### Post date: [February 13, 2017, 12:43pm UTC](https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078/1 "2017-02-13T12:43:02Z")

</div>

Could you tell me how to solve this problems, please?  
I tried to compile the Julia from source code on Windows 8.1. I followed the instructions for [README.windows.md](https://github.com/JuliaLang/julia/blob/master/README.windows.md) and by the way “Compiling with MinGW/MSYS2”. I’m changed version on 0.5 with command `git checkout release-0.5` and I followed step by step instructions. When I run the build command  
`make -j 4`  
I got the following error `make: *** [Makefile:81: julia-deps] Error 2` with a piece of first error in the console

```julia
 rm -f fftwf-wisdom
checking for clock... Making clean in m4
/bin/sh: line 1: /C/Program: No such file or directory
make[1]: *** [/home/martin.florek/julia/deps/mbedtls.mk:40: build/mbedtls-2.3.0/Makefile] Error 127
make[1]: *** Waiting for unfinished jobs....
  CC src/libpcre2_8_la-pcre2_match_data.lo
rm -f ./so_locations

```

For the whole output from the console see [link](https://drive.google.com/open?id=0ByRuhkKbXjtedzdqbEltOXl3YVU).  
Thanks.

I’m also not entirely clear how to run building version of Julia by the way “Compiling with MinGW/MSYS2”, as it is not described in README.windows.md. I would expect something like julia.exe??

---

<div class="post-metadata">

### Author: ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)
#### Post date: [February 13, 2017, 1:00pm UTC](https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078/2 "2017-02-13T13:00:05Z")

</div>

The MSYS2 build is not tested, likely broken, and should probably be removed from that document unless someone wants to submit a pull request to fix it. Cross-compilation from Cygwin is the supported method for building Julia from source on Windows right now.

---

<div class="post-metadata">

### Author: ![Martin\_Florek](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Martin\_Florek](https://discourse.julialang.org/u/Martin_Florek)
#### Post date: [February 14, 2017, 8:53am UTC](https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078/3 "2017-02-14T08:53:35Z")

</div>

Thank you @tkelman for your quick reply I really appreciate it.  
Now I tried to compile the Julia with Cygwin, but compilation fell down and I got error in Makefile:215

```julia
    LINK usr/bin/julia.exe
    JULIA usr/lib/julia/inference.ji
C:/Users/martin.florek/Develop/Programs/cygwin64/home/martin.florek/julia/usr/bin/julia.exe: error while loading shared libraries: libgcc_s_seh-1.dll: cannot open shared object file: No such file or directory
make[1]: *** [Makefile:215: /home/martin.florek/julia/usr/lib/julia/inference.ji] Error 127
make: *** [Makefile:96: julia-inference] Error 2

```

This DLL is in the `bin` when I run `usr/ bin/julia.exe` give me popup window with the message:  
“The program can’t start because libwinpthread-1.dll is missing from your computer. Try reinstalling the program to fix this problem”.

I had to copy libwinpthread-1.dll from ` .../Programs/cygwin64/usr/x86_64-w64-mingw32/sys-root/mingw/bin/` to `usr/bin` to solve the problem and re-run a command `make -j 4`. Then Julia works. Is it a correct solution?

---

<div class="post-metadata">

### Author: ![tkelman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkelman/32/692_2.png) [@tkelman](https://discourse.julialang.org/u/tkelman)
#### Post date: [February 14, 2017, 10:50am UTC](https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078/4 "2017-02-14T10:50:13Z")

</div>

That should be fine for now. It’s fixed on master and I’ll be backporting the fix to release-0.5.

---

<div class="post-metadata">

### Author: ![Mikewl](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Mikewl](https://discourse.julialang.org/u/Mikewl)
#### Post date: [February 18, 2017, 2:40am UTC](https://discourse.julialang.org/t/build-error-win-compiling-with-mingw-msys2-from-source/2078/5 "2017-02-18T02:40:07Z")

</div>

I can get the msys2 build working but it takes quite a bit of effort.  
c\_check from openblas needs to be updated to the latest version  
Ninja needs to be used to build mbedtls  
Common.mk needs to remove the workaround of which cc

Even then there are still test failures!

Once openblas is bumped again I will be happy to fix the rest while also allowing for cmake\_generator to be used for more than llvm. It isn’t really necessary though as the Cygwin build works perfectly fine.

I do dream of #11754 making building on windows easier!
