Skip to content

Commit bcd7dd9

Browse files
authored
Merge pull request #210 from gojimmypi/pr-realm-update
Update realm patch and build script with latest wolfssl support
2 parents e7bdf41 + c1d271d commit bcd7dd9

4 files changed

Lines changed: 1321 additions & 181 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,4 @@ openssh/regress/authorized_keys*
110110
stunnel/example/echoserver/echoserver*
111111
*.plist
112112
server_err.log
113+
/.vs

realm/README.md

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
1+
# REALM with wolfSSL
2+
3+
The wolfSSL library is enabled in [realm-core](https://github.com/realm/realm-core) with the `-DREALM_HAVE_WOLFSSL=1` parameter.
4+
5+
The upstream `realm-core` does NOT yet support wolfSSL. Please see the enclosed `realm-commit-[hash].patch files`.
6+
7+
The Linux Script Build automatically applies these patches as needed. Modify as desired with the `REALM_CORE_COMMIT` script variable.
8+
9+
## Linux Script Build
10+
11+
The [build_wolfssl_with_realm.sh](./build_wolfssl_with_realm.sh) script can be used.
12+
13+
### Script Parameters:
14+
15+
* `-t` use tarball, not git
16+
* `-u` use $USER name suffix for repository
17+
18+
###
19+
20+
Defaults are to clone [wolfSSL](https://github.com/wolfSSL/wolfssl) and [realm-core](https://github.com/realm/realm-core) to local directory.
21+
22+
If you have forks of each with your GitHub ID the same as your local user name, the `-u` is recommended.
23+
24+
Run directly from the `realm` directory:
25+
26+
```bash
27+
./build_wolfssl_with_realm.sh -u
28+
```
29+
30+
This will create these local directories, and add respective `upstream` repository settings:
31+
32+
```text
33+
./wolfssl-<your username>
34+
./realm-core-<your username>
35+
```
36+
37+
Once the desired wolfSSL library has been fetched and installed, the clone / config / build can be skipped by making these changes in the script file:
38+
39+
```
40+
# Choose to skip parts of wolfSSL build:
41+
FETCH_WOLFSSL=false
42+
CONFIGURE_WOLFSSL=false
43+
BUILD_WOLFSSL=false
44+
INSTALL_WOLFSSL=false
45+
```
46+
47+
## Linux manual build: Build wolfSSL
48+
49+
These commands are wrapped in the `build_wolfssl_with_realm.sh` script, mentioned above:
50+
151
To configure wolfSSL, use the following command:
252

353
```
@@ -22,10 +72,60 @@ Building realm-core:
2272

2373
```
2474
mkdir build
25-
cmake -B build -DREALM_ENABLE_ENCRYPTION=1 -DREALM_ENABLE_SYNC=1 -DREALM_USE_WOLFSSL=1 -DREALM_WOLFSSL_ROOT_DIR=/usr/local/lib
75+
cmake -B build -DREALM_ENABLE_ENCRYPTION=1 -DREALM_ENABLE_SYNC=1 -DREALM_HAVE_WOLFSSL=1 -DREALM_WOLFSSL_ROOT_DIR=/usr/local/lib
2676
cmake --build build
2777
./build/test/realm-tests
2878
```
2979

3080
You can also use the build_wolfssl_with_realm.sh script after adjusting the global variables as needed.
3181

82+
## Generating a new Realm-core patch file:
83+
84+
To generate a new patch compare a particular commit (a5e87a39) to your fork/branch (`dev`):
85+
86+
Save the generated file from this link to the `realm-commit-a5e87a39.patch` file:
87+
88+
89+
90+
```
91+
https://github.com/gojimmypi/realm-core/compare/a5e87a39...dev.patch
92+
93+
or
94+
95+
https://github.com/gojimmypi/realm-core/compare/a5e87a39...gojimmypi:realm-core:dev-consolidated.patch
96+
```
97+
98+
Do *not* edit the patch file for tailing spaces, etc. It must be saved exactly as generated.
99+
100+
## Troubleshooting
101+
102+
### Confirming build with wolfSSL
103+
104+
See generated `config.h` files:
105+
106+
For Linux compile: `build` directory:
107+
```
108+
[wolfssl osp root]\realm\realm-core\build\src\realm\util
109+
```
110+
111+
For Visual Studio compile: `out` directory, plus build configuration (e.g. `build\x64-Debug`):
112+
113+
```
114+
[wolfssl osp root]\realm\realm-core\out\build\x64-Debug\src\realm\util
115+
```
116+
117+
### Cannot find OpenSSL
118+
119+
```
120+
Cannot open include file: 'openssl/sha.h': No such file or directory Storage C:\workspace\osp-gojimmypi\realm\realm-core-gojimmypi\src\realm\util\aes_cryptor.hpp
121+
```
122+
123+
Check the `osp\realm\VS2022\src\realm\util` directory. The generated `config.h` should have
124+
openSSL disabled `0` and wolfSSL enabled `1` like this:
125+
126+
```
127+
#define REALM_HAVE_OPENSSL 0
128+
#define REALM_HAVE_WOLFSSL 1
129+
```
130+
131+
###

0 commit comments

Comments
 (0)