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+
151To configure wolfSSL, use the following command:
252
353```
@@ -22,10 +72,60 @@ Building realm-core:
2272
2373```
2474mkdir 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
2676cmake --build build
2777./build/test/realm-tests
2878```
2979
3080You 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