2
2
3
3
[ ![ Build Status] ( https://travis-ci.org/sfackler/rust-openssl.svg?branch=master )] ( https://travis-ci.org/sfackler/rust-openssl )
4
4
5
- [ Documentation] ( https://sfackler.github.io/rust-openssl/doc/v0.8.3/openssl ) .
5
+ [ Documentation] ( https://sfackler.github.io/rust-openssl/doc/v0.9.0/openssl ) .
6
+
7
+ ## Warning
8
+
9
+ This README does not correspond to rust-openssl 0.7.x. See
10
+ [ here] ( https://github.com/sfackler/rust-openssl/blob/b8fb29db5c246175a096260eacca38180cd77dd0/README.md )
11
+ for that README.
6
12
7
13
## Building
8
14
9
- rust-openssl depends on both the OpenSSL runtime libraries and headers.
15
+ rust-openssl depends on the OpenSSL runtime libraries version 1.0.1 or above.
16
+ Currently the libraries need to be present in the build environment before this
17
+ crate is compiled, and some instructions of how to do this are in the sections
18
+ below.
10
19
11
20
### Linux
12
21
13
- On Linux, you can install OpenSSL via your package manager. The headers are
14
- sometimes provided in a separate package than the runtime libraries - look for
15
- something like ` openssl-devel ` or ` libssl-dev ` .
22
+ On Linux, you can typically install OpenSSL via your package manager. The
23
+ headers are sometimes provided in a separate package than the runtime libraries
24
+ - look for something like ` openssl-devel ` or ` libssl-dev ` .
16
25
17
26
``` bash
18
27
# On Ubuntu
@@ -23,79 +32,78 @@ sudo pacman -S openssl
23
32
sudo dnf install openssl-devel
24
33
```
25
34
35
+ If installation via a package manager is not possible, or if you're cross
36
+ compiling to a separate target, you'll typically need to compile OpenSSL from
37
+ source. That can normally be done with:
38
+
39
+ ```
40
+ curl -O https://www.openssl.org/source/openssl-1.1.0b.tar.gz
41
+ tar xf openssl-1.1.0b.tar.gz
42
+ cd openssl-1.1.0b
43
+ export CC=...
44
+ ./Configure --prefix=... linux-x86_64 -fPIC
45
+ make -j$(nproc)
46
+ make install
47
+ ```
48
+
26
49
### OSX
27
50
28
- OpenSSL 0.9.8 is preinstalled on OSX. Some features are only available when
29
- linking against OpenSSL 1.0.0 or greater; see below on how to point
30
- rust-openssl to a separate installation. OSX releases starting at 10.11, "El
31
- Capitan", no longer include OpenSSL headers which will prevent the ` openssl `
32
- crate from compiling.
51
+ Although OpenSSL 0.9.8 is preinstalled on OSX this library is being phased out
52
+ of OSX and this crate also does not support this version of OpenSSL. To use this
53
+ crate on OSX you'll need to install OpenSSL via some alternate means, typically
54
+ homebrew:
33
55
34
- For OSX 10.11 you can use brew to install OpenSSL and then set the environment variables
35
- as described below.
36
56
``` bash
37
57
brew install openssl
38
- export OPENSSL_INCLUDE_DIR=` brew --prefix openssl` /include
39
- export OPENSSL_LIB_DIR=` brew --prefix openssl` /lib
40
58
```
41
59
42
- May be necessary clean the repository with ` cargo clean ` before build again.
43
-
44
- ### Windows
60
+ ### Windows MSVC
45
61
46
- On Windows, consider building with [ mingw-w64] ( http://mingw-w64.org/ ) .
47
- Build script will try to find mingw in ` PATH ` environment variable to provide
48
- Cargo with location where openssl libs from mingw-w64 package may be found.
62
+ On MSVC it's unfortunately not always a trivial process acquiring OpenSSL.
63
+ Perhaps the easiest way to do this right now is to download [ precompiled
64
+ binaries] and install them on your system. Currently it's recommended to
65
+ install the 1.1.0b light installation if you're choosing this route.
49
66
50
- mingw-w64 can be easily installed by using [ MSYS2 ] ( http://msys2.github.io/ ) . Install MSYS2 according to the instructions, and then, from an MSYS2 Shell, install mingw-w64:
67
+ [ precompiled binaries ] : http://slproweb.com/products/Win32OpenSSL.html
51
68
52
- 32-bit:
53
- ``` bash
54
- pacman -S mingw-w64-i686-gcc
55
- ```
69
+ Once a precompiled binary is installed you can configure this crate to find the
70
+ installation via an environment variable:
56
71
57
- 64-bit
58
- ``` bash
59
- pacman -S mingw-w64-x86_64-gcc
72
+ ```
73
+ set OPENSSL_DIR=C:\OpenSSL-Win64
60
74
```
61
75
62
- and then install the mingw-w64 toolchain.
76
+ After that, you're just a ` cargo build ` away!
63
77
64
- 32-bit:
65
- ``` bash
66
- pacman -S mingw-w64-i686-toolchain
67
- ```
78
+ ### Windows GNU (MinGW)
68
79
69
- 64-bit:
70
- ``` bash
71
- pacman -S mingw-w64-x86_64-toolchain
72
- ```
80
+ The easiest way to acquire OpenSSL when working with MinGW is to ensure you're
81
+ using [ MSYS2] ( http://msys2.github.io ) and to then execute:
73
82
74
- Alternatively, install OpenSSL from [ here] [ 1 ] . Cargo will not be able to find OpenSSL if it's
75
- installed to the default location. You can either copy the ` include/openssl `
76
- directory, ` libssl32.dll ` , and ` libeay32.dll ` to locations that Cargo can find
77
- or pass the location to Cargo via environment variables:
83
+ ```
84
+ # 32-bit
85
+ pacman -S mingw-w64-i686-openssl
78
86
79
- ``` bash
80
- env OPENSSL_LIB_DIR=C:/OpenSSL-Win64 OPENSSL_INCLUDE_DIR=C:/OpenSSL-Win64/include cargo build
87
+ # 64-bit
88
+ pacman -S mingw-w64-x86_64-openssl
81
89
```
82
90
91
+ And after that, a ` cargo build ` should be all you need!
92
+
83
93
### Manual configuration
84
94
85
95
rust-openssl's build script will by default attempt to locate OpenSSL via
86
- pkg-config. This will not work in some situations, for example, on systems that
87
- don't have pkg-config, when cross compiling, or when using a copy of OpenSSL
96
+ pkg-config or other system-specific mechanisms . This will not work in some
97
+ situations however, for example cross compiling or when using a copy of OpenSSL
88
98
other than the normal system install.
89
99
90
100
The build script can be configured via environment variables:
91
- * ` OPENSSL_LIB_DIR ` - If specified, a directory that will be used to find
92
- OpenSSL runtime libraries.
93
- * ` OPENSSL_INCLUDE_DIR ` - If specified, a directory that will be used to find
94
- OpenSSL headers.
95
- * ` OPENSSL_STATIC ` - If specified, OpenSSL libraries will be statically rather
96
- than dynamically linked.
97
101
98
- If either ` OPENSSL_LIB_DIR ` or ` OPENSSL_INCLUDE_DIR ` are specified, then the
99
- build script will skip the pkg-config step.
102
+ * ` OPENSSL_DIR ` - If specified, a directory that will be used to find
103
+ OpenSSL installation. It's expected that under this directory the ` include `
104
+ folder has header files and a ` lib ` folder has the runtime libraries.
105
+ * ` OPENSSL_STATIC ` - If specified, OpenSSL libraries will be statically rather
106
+ than dynamically linked.
100
107
101
- [ 1 ] : http://slproweb.com/products/Win32OpenSSL.html
108
+ If ` OPENSSL_DIR ` is specified, then the build script will skip the pkg-config
109
+ step.
0 commit comments