Building julia 1.0 for windows

I am not able to build julia 1.0 for windows following the Cygwin-to-MinGW cross-compiling build procedure described here:
https://github.com/JuliaLang/julia/blob/master/README.windows.md

The following linker error is the problem:

[ 81%] Linking CXX shared library ../../bin/LLVM.dll
[ 81%] Built target llvm-cfi-verify
../../lib/libLLVMAMDGPUCodeGen.a(AMDGPUISelDAGToDAG.cpp.obj):AMDGPUISelDAGToDAG.cpp:(.text$_ZN4llvm16SelectionDAGISel22getIncludePathForIndexEj+0x0): Mehrfachdefinition von »llvm::SelectionDAGISel::getIncludePathForIndex(unsigned int)«
../../lib/libLLVMSelectionDAG.a(SelectionDAGISel.cpp.obj):SelectionDAGISel.cpp:(.text$_ZN4llvm16SelectionDAGISel22getIncludePathForIndexEj+0x0): hier zuerst definiert
../../lib/libLLVMAMDGPUCodeGen.a(AMDGPUISelDAGToDAG.cpp.obj):AMDGPUISelDAGToDAG.cpp:(.text$_ZN4llvm16SelectionDAGISel18getPatternForIndexEj+0x0): Mehrfachdefinition von »llvm::SelectionDAGISel::getPatternForIndex(unsigned int)«
../../lib/libLLVMSelectionDAG.a(SelectionDAGISel.cpp.obj):SelectionDAGISel.cpp:(.text$_ZN4llvm16SelectionDAGISel18getPatternForIndexEj+0x0): hier zuerst definiert
collect2: Fehler: ld gab 1 als Ende-Status zurück
make[4]: *** [tools/llvm-shlib/CMakeFiles/LLVM.dir/build.make:213: bin/LLVM.dll] Fehler 1
make[3]: *** [CMakeFiles/Makefile2:17100: tools/llvm-shlib/CMakeFiles/LLVM.dir/all] Fehler 2
make[2]: *** [Makefile:150: all] Fehler 2
make[1]: *** [/home/Oli/julia/deps/llvm.mk:450: scratch/llvm-6.0.1/build_Release/build-compiled] Fehler 2
make[1]: *** Es wird auf noch nicht beendete Prozesse gewartet....

In english it is:

Redefinition of llvm::SelectionDAGISel::getIncludePathForIndex(unsigned int)

first definition in

../../lib/libLLVMSelectionDAG.a(SelectionDAGISel.cpp.obj):SelectionDAGISel.cpp:

second in

../../lib/libLLVMAMDGPUCodeGen.a(AMDGPUISelDAGToDAG.cpp.obj):AMDGPUISelDAGToDAG.cpp:

How to overcome this?

Building 0.7 works well, so it is not the build setup of the cygwin installation (probably).

I would post an issue in the main julia github repo.

For example I am unable to cross-compile windows.

Also take a look at the appveyor script https://github.com/JuliaLang/julia/blob/master/appveyor.yml

I think in the past I have ran appveyor_build.sh sucessfully.

Thanks for the help. Looking into
contrib\windows\appveyor_build.sh
made the build happen.
The complete steps to a successfull 64 bit windows build:

  1. start from windows build document https://github.com/JuliaLang/julia/blob/master/README.windows.md

  2. Install additional cygwin pakages:
    ccache in Category Devel
    libpcre2-devel in Libs

  3. open cygwin terminal

    git clone https://github.com/JuliaLang/julia.git
    cd julia
    export ARCH="x86_64"
    contrib/windows/appveyor_build.sh

The build still ends with an error but this is only after calling
make build-stats
The error is:

\033[34;1m ==> ./julia launch speedtest\033[0m
make: time: Kommando nicht gefunden
make: *** [Makefile:640: build-stats] Fehler 127

despite the time command is found when called from the shell.
But this is not important for me, I just need a running local build for experiments.

On some branches/commits the build fails for sysimg.jl with errors like:

LoadError("sysimg.jl", 517, LoadError("C:\\cygwin64\\home\\oheil\\julia\\usr\\share\\julia\\site\\v0.7\\SharedArrays\\src\\SharedArrays.jl", 20, ArgumentError("Module Printf not found in current path.\nRun `Pkg.add(\"Printf\")` to install the Printf package.")))
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***

This error in SharedArrays.jl can be fixed by changing line
using Printf: @sprintf
to
using Base.Printf: @sprintf

Other similar error messages in other files typically complain about Pkg not in the path, e.g.:

LoadError("sysimg.jl", 520, LoadError("C:\\cygwin64\\home\\oheil\\julia\\usr\\share\\julia\\site\\v0.7\\Test\\src\\Test.jl", 32, LoadError("C:\\cygwin64\\home\\oheil\\julia\\usr\\share\\julia\\site\\v0.7\\InteractiveUtils\\src\\InteractiveUtils.jl", 18, ArgumentError("Module Pkg not found in current path.\nRun `Pkg.add(\"Pkg\")` to install the Pkg package."))))
*** This error is usually fixed by running `make clean`. If the error persists, try `make cleanall`. ***

All these can be fixed by changing line
import Pkg
to
import ..Pkg

2 Likes

Is it possible to take advantage of conpty in newer version of windows?
https://www.bing.com/search?q=conpty&PC=U316&FORM=CHROMN

Added some workarounds for common build error.

@oheil You should be able to build julia without any issues using Cygwin with regular
make command

which directory are you trying to build to?

E.g. I am successfully able to build a cross-compiled version with cygwin in C:\Users\USERNAME\julia

I suggest you run the cygwin installer again and make sure you have the latest version of the require packages and also hit the test button in the upper right corner of the available packages and install the test versions of mingw32 ld and ming32 bindeps .

1 Like

Thanks fo your reply.
The build problems I have are in the context of
https://github.com/JuliaLang/julia/issues/26422
(you have participated there too)
With my update here I just tried to have all solutions of my build problems at a single place for future reference. Maybe I am just a little bit chaotic and I am sorry if I produce confusion.

1 Like