Skip to content

Commit bd5bb6d

Browse files
Ilya Bogdanovdmitry-timofeev
Ilya Bogdanov
authored andcommitted
Use static rocksdb linkage on Mac [ECR-3324] (#1011)
RocksDB is linked statically on Mac to avoid problems with dynamic library resolving. When dynamic linking is currently used, the app has a dependency on a particular version of the library, with any new version breaking the installation. It is required to set ROCKSDB_LIB_DIR prior to running package_app.sh. (cherry picked from commit ae4593c)
1 parent 35897f3 commit bd5bb6d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ You need to install the following dependencies:
2222
* [Stable Rust](https://www.rust-lang.org/tools/install).
2323
* The [system dependencies](https://exonum.com/doc/version/0.11/get-started/install/) of Exonum.
2424
You do _not_ need to manually fetch and compile Exonum.
25+
__Important__: On Mac OS it is necessary to install RocksDB
26+
package and to set the environment variable `ROCKSDB_LIB_DIR`.
27+
To install the package via Homebrew:
28+
29+
```bash
30+
brew install rocksdb
31+
export ROCKSDB_LIB_DIR=/usr/local/lib
32+
```
33+
2534
* For automatic packaging of the Exonum Java app you need [CMake](https://cmake.org/) installed in your system.
2635
Also on Mac you need a [`coreutils`](https://formulae.brew.sh/formula/coreutils) package installed.
2736

@@ -36,6 +45,7 @@ $ mvn install
3645
```
3746

3847
#### Building Exonum Java App
48+
3949
Run:
4050

4151
```$sh

exonum-java-binding/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ the [migration guide](https://github.com/exonum/exonum-java-binding/blob/ejb/v0.
5757
`CommonTypeAdapterFactory`. `BlockTypeAdapterFactory` is renamed to `CoreTypeAdapterFactory`.
5858
`JsonSerializer#json` and `JsonSerializer#builder` register `CommonTypeAdapterFactory`
5959
by default. `CoreTypeAdapterFactory` must be registered explicitly if needed. (#971)
60-
60+
- Exonum Java App now uses static linkage for RocksDB on Mac OS. Installed RocksDB
61+
is no more necessary to run the App. (#1011)
6162

6263
### Fixed
6364
- The default [`Transaction#info`][tx-info-07] implementation causing an error on `transaction`

exonum-java-binding/package_app.sh

+11
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ function build-exonum-java-for-platform() {
4444
}
4545

4646
function build-exonum-java-macos() {
47+
# We use static linkage for RocksDB on Mac because dynamic linking
48+
# on Mac does not work: the resulting app has a dependency on a _particular_
49+
# version of the RocksDB library, hence, is incompatible with any updates
50+
# to the library, even the patch ones. It is believed to be a Cargo issue
51+
# or RocksDB build configuration issue, see ECR-3324.
52+
export ROCKSDB_STATIC=1
53+
# Check if ROCKSDB_LIB_DIR is set
54+
if [ -z "${ROCKSDB_LIB_DIR:-}" ]; then
55+
echo "Please set ROCKSDB_LIB_DIR"
56+
exit 1
57+
fi
4758
build-exonum-java-for-platform "@loader_path" "libjava_bindings.dylib"
4859
}
4960

0 commit comments

Comments
 (0)