You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testers needed!
Rewrite cross-compiling instructions to use docker and opensuse 13.1
and fix markdown lists
Vagrant instead of Docker
adjust msys2 setup steps
Test with msys2's python2
Remove path recommendation, not really needed any more
[av skip]
4. Install [MinGW-builds](http://sourceforge.net/projects/mingwbuilds/), a Windows port of GCC, as follows. Do **not** use the regular MinGW distribution.
68
-
1. Download the [MinGW-builds installer](http://downloads.sourceforge.net/project/mingwbuilds/mingw-builds-install/mingw-builds-install.exe).
69
-
2. Run the installer. When prompted, choose:
70
-
- Version: the most recent version (these instructions were tested with 4.8.1)
71
-
- Architecture: `x32` or `x64` as appropriate and desired.
72
-
- Threads: `win32` (not posix)
73
-
- Exception: `sjlj` (for x32) or `seh` (for x64). Do not choose dwarf2.
74
-
- Build revision: most recent available (tested with 5)
75
-
3. Do **not** install to a directory with spaces in the name. You will have to change the default installation path, for example,
76
-
-`C:\mingw-builds\x64-4.8.1-win32-seh-rev5` for 64 bits
77
-
-`C:\mingw-builds\x32-4.8.1-win32-sjlj-rev5` for 32 bits
5. Install and configure [MSYS2](http://sourceforge.net/projects/msys2), a minimal POSIX-like environment for Windows.
60
+
2. Install and configure [MSYS2](https://msys2.github.io), a minimal POSIX-like environment for Windows.
80
61
81
-
1. Download the latest base [32-bit](http://sourceforge.net/projects/msys2/files/Base/i686/) or [64-bit](http://sourceforge.net/projects/msys2/files/Base/x86_64/) distribution, consistent with the architecture you chose for MinGW-builds. The archive will have a name like `msys2-base-x86_64-yyyymmdd.tar.xz` and these instructions were tested with `msys2-base-x86_64-20140216.tar.xz`.
62
+
1. Download and run the latest installer for the [32-bit](http://sourceforge.net/projects/msys2/files/Base/i686/) or [64-bit](http://sourceforge.net/projects/msys2/files/Base/x86_64/) distribution. The installer will have a name like `msys2-i686-yyyymmdd.exe` or `msys2-x86_64-yyyymmdd.exe`.
82
63
83
-
2. Using [7-Zip](http://www.7-zip.org/download.html), extract the archive to any convenient directory.
84
-
-*N.B.* Some versions of this archive contain zero-byte files that clash with existing files. If prompted, choose **not** to overwrite existing files.
85
-
- You may need to extract the tarball in a separate step. This will create an `msys32` or `msys64` directory, according to the architecture you chose.
86
-
- Move the `msys32` or `msys64` directory into your MinGW-builds directory, which is `C:\mingw-builds` if you followed the suggestions in step 3. We will omit the "32" or "64" in the steps below and refer to this as "the msys directory".
64
+
2. Double-click `msys2_shell.bat` in the installed msys directory. Initialize the MSYS2 base system using the `pacman` package manager included in MSYS2:
87
65
88
-
3. Double-click `msys2_shell.bat` in the msys directory. This will initialize MSYS2. The shell will tell you to `exit` and restart the shell. For now, ignore it.
4. Update MSYS2 and install packages required to build julia, using the `pacman` package manager included in MSYS2:
70
+
3. Exit and restart MSYS2, then install packages required to build julia:
91
71
92
72
```
93
-
pacman-key --init #Download keys
94
73
pacman -Syu #Update package database and full system upgrade
95
-
```
96
-
Now `exit` the MSYS2 shell and restart it, *even if you already restarted it above*. This is necessary in case the system upgrade updated the main MSYS2 libs. Reopen the MSYS2 shell and continue with:
97
-
98
-
```
99
-
pacman -S diffutils git m4 make patch tar msys/openssh
74
+
pacman -S diffutils git m4 make patch tar python2 p7zip msys/openssh
100
75
```
101
76
102
-
5. Configure your MSYS2 shell for convenience:
77
+
4. Configuration of MSYS2 is complete. Now `exit` the MSYS2 shell.
103
78
79
+
3. Build Julia and its dependencies from source.
80
+
1. Open a new MSYS2 shell and clone the Julia sources
*N.B.* The `export` clobbers whatever `$PATH` is already defined. This is suggested to avoid path-masking. If you use MSYS2 for purposes other than building Julia, you may prefer to append rather than clobber.
113
-
114
-
*N.B.* All of the path-separators in the mount commands are unix-style.
115
-
116
-
117
-
6. Configuration of the toolchain is complete. Now `exit` the MSYS2 shell.
118
-
119
-
6. Build Julia and its dependencies from source.
120
-
1. Relaunch the MSYS2 shell and type
121
-
86
+
2. Run the following script to download the correct versions of the MinGW-w64 compilers
122
87
```
123
-
. ~/.bashrc # Some versions of MSYS2 do not run this automatically
88
+
contrib/windows/get_toolchain.sh 32 # for 32 bit Julia
89
+
# or
90
+
contrib/windows/get_toolchain.sh 64 # for 64 bit Julia
124
91
```
125
-
126
-
Ignore any warnings you see from `mount` about `/mingw` and `/python` not existing.
Then follow the printed instructions by running either
93
+
```
94
+
export PATH=$PWD/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH # for 32 bit Julia
95
+
# or
96
+
export PATH=$PWD/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH # for 64 bit Julia
132
97
```
98
+
to add the downloaded MinGW-w64 compilers to your path (temporarily, only needed during the shell session when you build Julia).
133
99
134
100
3. Specify the location where you installed CMake
135
101
@@ -138,15 +104,16 @@ or edit `%USERPROFILE%\.gitconfig` and add/edit the lines:
138
104
```
139
105
140
106
4. Start the build
141
-
```
107
+
```
142
108
make -j 4 # Adjust the number of cores (4) to match your build environment.
143
109
```
144
-
7. Setup Package Development Environment
110
+
111
+
4. Setup Package Development Environment
145
112
1. The `Pkg` module in Base provides many convenient tools for [developing and publishing packages](http://docs.julialang.org/en/latest/manual/packages/).
146
113
One of the packages added through pacman above was `openssh`, which will allow secure access to GitHub APIs.
147
114
Follow GitHub's [guide](https://help.github.com/articles/generating-ssh-keys) to setting up SSH keys to ensure your local machine can communicate with GitHub effectively.
148
115
149
-
5. In case of the issues with building packages (i.e. ICU fails to build with the following error message ```error compiling xp_parse: error compiling xp_make_parser: could not load module libexpat-1: %```) run ```make win-extras``` and then copy everything from the ```dist-extras``` folder into ```usr/bin```.
116
+
2. In case of the issues with building packages (i.e. ICU fails to build with the following error message ```error compiling xp_parse: error compiling xp_make_parser: could not load module libexpat-1: %```) run ```make win-extras``` and then copy everything from the ```dist-extras``` folder into ```usr/bin```.
150
117
151
118
## Cygwin-to-MinGW cross compiling
152
119
@@ -208,69 +175,40 @@ Julia can be also compiled from source in [Cygwin](http://www.cygwin.com), using
208
175
209
176
If you prefer to cross-compile, the following steps should get you started.
210
177
211
-
### Ubuntu and Mac Dependencies (these steps will work for almost any linux platform)
212
-
213
-
First, you will need to ensure your system has the required dependencies. We need wine (>=1.7.5),
3. edit `rebuild_cross.sh` and make the following two changes:
238
-
a. uncomment `export MAKE_OPT="-j 2"`, if appropriate for your machine
239
-
b. add `fortran` to the end of `--enable-languages=c,c++,objc,obj-c++`
240
-
5.`bash update_source.sh`
241
-
4.`bash rebuild_cross.sh`
242
-
5.`mv cross ~/cross-w64`
243
-
6.`export PATH=$HOME/cross-w64/bin:$PATH` # NOTE: it is important that you remember to always do this before using make in the following steps!, you can put this line in your .profile to make it easy
244
-
245
-
Then we can essentially just repeat these steps for the 32-bit compiler, reusing some of the work:
246
-
247
-
7.`cd ..`
248
-
8.`cp -a mingw-w64-dgn mingw-w32-dgn`
249
-
9.`cd mingw-w32-dgn`
250
-
10.`rm -r cross build`
251
-
11.`bash rebuild_cross.sh 32r`
252
-
12.`mv cross ~/cross-w32`
253
-
13.`export PATH=$HOME/cross-w32/bin:$PATH` # NOTE: it is important that you remember to always do this before using make in the following steps!, you can put this line in your .profile to make it easy
254
-
255
-
Note: for systems that support rpm-based package managers, the OpenSUSE build service appears to contain a fully up-to-date versions of the necessary dependencies.
256
-
257
-
### Arch Linux Dependencies
258
-
259
-
1. Install the following packages from the official Arch repository:
2. The rest of the prerequisites consist of the mingw-w64 packages, which are available in the AUR Arch repository. They must be installed exactly in the order they are given or else their installation will fail. The `yaourt` package manager is used for illustration purposes; you may instead follow the [Arch instructions for installing packages from AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages) or may use your preferred package manager. To start with, install `mingw-w64-binutils` via the command
262
-
`yaourt -S mingw-w64-binutils`
263
-
3.`yaourt -S mingw-w64-headers-svn`
264
-
4.`yaourt -S mingw-w64-headers-bootstrap`
265
-
5.`yaourt -S mingw-w64-gcc-base`
266
-
6.`yaourt -S mingw-w64-crt-svn`
267
-
7. Remove `mingw-w64-headers-bootstrap` without removing its dependent mingw-w64 installed packages by using the command
268
-
`yaourt -Rdd mingw-w64-headers-bootstrap`
269
-
8.`yaourt -S mingw-w64-winpthreads`
270
-
9. Remove `mingw-w64-gcc-base` without removing its installed mingw-w64 dependencies:
271
-
`yaourt -Rdd mingw-w64-gcc-base`
272
-
10. Complete the installation of the required `mingw-w64` packages:
273
-
`yaourt -S mingw-w64-gcc`
178
+
For maximum compatibility with packages that use [WinRPM.jl](https://github.com/JuliaLang/WinRPM.jl) for binary dependencies on Windows, it is recommended that you use OpenSUSE 13.1 for cross-compiling a Windows build of Julia. If you use a different Linux distribution or OS X, install [Vagrant](http://www.vagrantup.com/downloads) and use the following `Vagrantfile`:
179
+
```
180
+
# Vagrantfile for MinGW-w64 cross-compilation of Julia
181
+
182
+
$script = <<SCRIPT
183
+
# Change the following to i686-w64-mingw32 for 32 bit Julia:
git clone git://github.com/JuliaLang/julia.git julia
196
+
cd julia
197
+
make -j4 win-extras julia-ui-release
198
+
export WINEDEBUG=-all # suppress wine fixme's
199
+
# this last step may need to be run interactively
200
+
make -j4 binary-dist
201
+
SCRIPT
202
+
203
+
Vagrant.configure("2") do |config|
204
+
config.vm.box = "chef/opensuse-13.1"
205
+
config.vm.provider :virtualbox do |vb|
206
+
# Use VBoxManage to customize the VM. For example to change memory:
207
+
vb.memory = 2048
208
+
end
209
+
config.vm.provision :shell, :inline => $script
210
+
end
211
+
```
274
212
275
213
### Cross-building Julia
276
214
@@ -281,7 +219,7 @@ Finally, the build and install process for Julia:
281
219
3.`make`
282
220
4.`make win-extras` (Necessary before running `make binary-dist`p)
283
221
5.`make binary-dist`
284
-
6. move the julia-* directory / zip file to the target machine
222
+
6. move the julia-*.exe installer to the target machine
285
223
286
224
If you are building for 64-bit windows, the steps are essentially the same. Just replace i686 in XC_HOST with x86_64. (note: on Mac, wine only runs in 32-bit mode)
0 commit comments