Skip to content

Instantly share code, notes, and snippets.

@notmandatory
Last active August 19, 2021 09:05

Revisions

  1. notmandatory revised this gist Aug 19, 2021. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,16 @@
    ## Build LDK C bindings

    1. Clone `rust-lightning` git repo2.
    2. [Install `clang-12`] and set it as the [default version]
    3. Install rust-src
    2. Install `clang-12` and set it as the default version

    linux [Ubuntu install](https://apt.llvm.org/) and set it as the [default version](http://manpages.ubuntu.com/manpages/focal/en/man1/update-alternatives.1.html)

    macos
    ```
    brew install llvm
    ```

    4. Install rust-src

    linux
    ```
    @@ -22,9 +30,6 @@
    5. Check `genbindings.out` for any warning or error messages
    [Install `clang-12`]: https://apt.llvm.org/
    [default version]: http://manpages.ubuntu.com/manpages/focal/en/man1/update-alternatives.1.html
    ## Build LDK java bindings
    1. Install open JDK 11 and maven
  2. notmandatory revised this gist Aug 19, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    1. Clone `rust-lightning` git repo2.
    2. [Install `clang-12`] and set it as the [default version]
    3. Install rust-src

    linux
    ```
    rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
  3. notmandatory revised this gist Aug 19, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -5,9 +5,15 @@
    1. Clone `rust-lightning` git repo2.
    2. [Install `clang-12`] and set it as the [default version]
    3. Install rust-src
    linux
    ```
    rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
    ```
    macos
    ```
    rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
    ```
    4. Run script to build bindings
    ```
    ./genbindings.sh ../rust-lightning true >& genbindings.out
  4. notmandatory revised this gist Jul 9, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,10 @@
    ```
    4. Run script to build bindings
    ```
    ./genbindings.sh ../rust-lightning true
    ./genbindings.sh ../rust-lightning true >& genbindings.out
    ```
    5. Check `genbindings.out` for any warning or error messages
    [Install `clang-12`]: https://apt.llvm.org/
    [default version]: http://manpages.ubuntu.com/manpages/focal/en/man1/update-alternatives.1.html
  5. notmandatory revised this gist Jul 9, 2021. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -4,12 +4,14 @@

    1. Clone `rust-lightning` git repo2.
    2. [Install `clang-12`] and set it as the [default version]

    3. Run script to build bindings

    ```
    ./genbindings.sh ../rust-lightning true
    ```
    3. Install rust-src
    ```
    rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
    ```
    4. Run script to build bindings
    ```
    ./genbindings.sh ../rust-lightning true
    ```
    [Install `clang-12`]: https://apt.llvm.org/
    [default version]: http://manpages.ubuntu.com/manpages/focal/en/man1/update-alternatives.1.html
  6. notmandatory revised this gist Jul 7, 2021. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -2,15 +2,19 @@

    ## Build LDK C bindings

    ### Clone `rust-lightning` git repo
    1. Clone `rust-lightning` git repo2.
    2. [Install `clang-12`] and set it as the [default version]

    ### Run script to build bindings
    3. Run script to build bindings

    ```
    ./genbindings.sh ../rust-lightning true
    ```

    ## Build java bindings from pre-built JNI lib
    [Install `clang-12`]: https://apt.llvm.org/
    [default version]: http://manpages.ubuntu.com/manpages/focal/en/man1/update-alternatives.1.html

    ## Build LDK java bindings

    1. Install open JDK 11 and maven
    ```shell
  7. notmandatory revised this gist Jul 6, 2021. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,15 @@
    # How-to build LDK java bindings

    ## Build LDK C bindings

    ### Clone `rust-lightning` git repo

    ### Run script to build bindings

    ```
    ./genbindings.sh ../rust-lightning true
    ```

    ## Build java bindings from pre-built JNI lib

    1. Install open JDK 11 and maven
  8. notmandatory revised this gist Apr 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ cd ldk-garbagecollected
    export LD_LIBRARY_PATH=.
    mvn test
    ```
    ** All good, test passes. **
    **All good, test passes.**

    ## Build JNI lib

  9. notmandatory revised this gist Apr 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ cd ldk-garbagecollected
    export LD_LIBRARY_PATH=.
    mvn test
    ```
    ** OK good test passes. **
    ** All good, test passes. **

    ## Build JNI lib

  10. notmandatory revised this gist Apr 21, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -56,6 +56,9 @@ cargo install cbindgen g++ valgrind
    ```

    This is where I'm stuck.. with error:
    ```
    ```shell
    + clang++ -Wall -Wno-nullability-completeness -pthread -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl
    /usr/bin/ld: error: LLVM gold plugin has failed to create LTO module: Invalid record
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    ```
  11. notmandatory revised this gist Apr 21, 2021. 1 changed file with 11 additions and 7 deletions.
    18 changes: 11 additions & 7 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -8,18 +8,18 @@ sudo apt update
    sudo apt install openjdk-11-jdk maven
    ```

    2. Clone ldk-garbagecollected repo
    2. Clone `ldk-garbagecollected` repo
    ```shell
    git clone [email protected]:notmandatory/ldk-garbagecollected.git
    git clone [email protected]:lightningdevkit/ldk-garbagecollected.git
    cd ldk-garbagecollected
    git remote add upstream [email protected]:lightningdevkit/ldk-garbagecollected.git
    ```

    3. Run java tests
    ```shell
    export LD_LIBRARY_PATH=.
    mvn test
    ```
    ** OK good test passes. **

    ## Build JNI lib

    @@ -28,19 +28,18 @@ mvn test
    rustup default 1.51.0
    ```

    2. Clone Matt's rust-lightning repo
    2. Clone Matt's `rust-lightning` repo
    ```shell
    git clone https://git.bitcoin.ninja/rust-lightning
    cd rust-lightning
    git checkout 2021-03-java-bindings-base
    cd ..
    ```

    3. Clone ldk-c-bindings repo
    3. Clone `ldk-c-bindings` repo
    ```shell
    git clone https://github.com/notmandatory/ldk-c-bindings
    git clone git@github.com:lightningdevkit/ldk-c-bindings.git
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git
    ```

    4. Install tools
    @@ -54,4 +53,9 @@ cargo install cbindgen g++ valgrind
    5. Generate bindings
    ```shell
    ./genbindings.sh ../rust-lightning true
    ```

    This is where I'm stuck.. with error:
    ```
    ```
  12. notmandatory revised this gist Apr 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ export LD_LIBRARY_PATH=.
    mvn test
    ```

    ## Build C FFI bindings lib
    ## Build JNI lib

    1. Set rust toolchain
    ```shell
  13. notmandatory revised this gist Apr 21, 2021. 1 changed file with 36 additions and 18 deletions.
    54 changes: 36 additions & 18 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,57 @@
    # Steps to build ldk java bindings
    # How-to build LDK java bindings

    ### Set rust toolchain
    ## Build java bindings from pre-built JNI lib

    1. Install open JDK 11 and maven
    ```shell
    sudo apt update
    sudo apt install openjdk-11-jdk maven
    ```

    2. Clone ldk-garbagecollected repo
    ```shell
    git clone [email protected]:notmandatory/ldk-garbagecollected.git
    cd ldk-garbagecollected
    git remote add upstream [email protected]:lightningdevkit/ldk-garbagecollected.git
    ```

    3. Run java tests
    ```shell
    export LD_LIBRARY_PATH=.
    mvn test
    ```

    ## Build C FFI bindings lib

    1. Set rust toolchain
    ```shell
    rustup default 1.51.0
    ```

    ### Clone Matt's rust-lightning repo
    2. Clone Matt's rust-lightning repo
    ```shell
    git clone https://git.bitcoin.ninja/rust-lightning
    cd rust-lightning
    git checkout 2021-03-java-bindings-base
    cd ..
    ```

    ### Clone ldk-c-bindings repo
    3. Clone ldk-c-bindings repo
    ```shell
    git clone https://github.com/notmandatory/ldk-c-bindings
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git
    ```

    4. Install tools
    ```shell
    rustup target add wasm32-wasi

    # clang 10.0.1, gcc 9.3.0, g++ 9.3.0, valgrind 3.15.0
    cargo install cbindgen g++ valgrind
    ```

    5. Generate bindings
    ```shell
    ./genbindings.sh ../rust-lightning true

    ----
    # install open jdk 11 and maven
    sudo apt update
    sudo apt install openjdk-11-jdk maven

    # clone ldk-garbagecollected repo
    git clone [email protected]:notmandatory/ldk-garbagecollected.git
    cd ldk-garbagecollected
    git remote add upstream [email protected]:lightningdevkit/ldk-garbagecollected.git

    # run java tests
    export LD_LIBRARY_PATH=/home/steve/git/ldk/ldk-garbagecollected
    mvn test
    ```
  14. notmandatory revised this gist Apr 21, 2021. 1 changed file with 7 additions and 3 deletions.
    10 changes: 7 additions & 3 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,19 @@
    # Steps to build ldk java bindings

    ### set rust toolchain
    ### Set rust toolchain
    ```shell
    rustup default 1.51.0
    ```

    # clone Matt's rust-lightning repo
    ### Clone Matt's rust-lightning repo
    ```shell
    git clone https://git.bitcoin.ninja/rust-lightning
    cd rust-lightning
    git checkout 2021-03-java-bindings-base
    cd ..
    ```

    # clone ldk-c-bindings repo
    ### Clone ldk-c-bindings repo
    git clone https://github.com/notmandatory/ldk-c-bindings
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git
  15. notmandatory revised this gist Apr 21, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ## Steps to build ldk java bindings
    # Steps to build ldk java bindings

    # set rust toolchain
    ### set rust toolchain
    rustup default 1.51.0

    # clone Matt's rust-lightning repo
  16. notmandatory renamed this gist Apr 21, 2021. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions build-ldk-java-bindings.txt → build-ldk-java-bindings.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,4 @@
    Steps to build ldk java bindings

    # install c++ (9.3.0) clang (10.0.1)
    # sudo apt update
    # sudo apt install build-essential clang-12 clang-tools-12
    ## Steps to build ldk java bindings

    # set rust toolchain
    rustup default 1.51.0
    @@ -18,11 +14,15 @@ git clone https://github.com/notmandatory/ldk-c-bindings
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git

    # TODO
    genbindings.sh
    rustup target add wasm32-wasi
    # clang 10.0.1, gcc 9.3.0, g++ 9.3.0, valgrind 3.15.0
    cargo install cbindgen g++ valgrind

    ./genbindings.sh ../rust-lightning true

    ----
    # install open jdk 11 and maven
    sudo apt update
    sudo apt install openjdk-11-jdk maven

    # clone ldk-garbagecollected repo
  17. notmandatory revised this gist Apr 21, 2021. 1 changed file with 16 additions and 11 deletions.
    27 changes: 16 additions & 11 deletions build-ldk-java-bindings.txt
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    Steps to build ldk java bindings

    # install c++ (9.3.0) clang (10.0.1)
    sudo apt update
    sudo apt install llvm build-essential clang clang-tools
    # sudo apt update
    # sudo apt install build-essential clang-12 clang-tools-12

    # set rust toolchain
    rustup default 1.51.0
    @@ -13,18 +13,23 @@ cd rust-lightning
    git checkout 2021-03-java-bindings-base
    cd ..

    # clone ldk-garbagecollected repo
    git clone [email protected]:notmandatory/ldk-garbagecollected.git
    cd ldk-garbagecollected
    git remote add upstream [email protected]:lightningdevkit/ldk-garbagecollected.git
    cd ..

    # clone ldk-c-bindings repo
    git clone https://github.com/notmandatory/ldk-c-bindings
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git

    # generate bindings
    export LD_LIBRARY_PATH=../ldk-garbagecollected
    ./genbindings.sh ../rust-lightning false
    # TODO
    genbindings.sh

    ----
    # install open jdk 11 and maven
    sudo apt install openjdk-11-jdk maven

    # clone ldk-garbagecollected repo
    git clone [email protected]:notmandatory/ldk-garbagecollected.git
    cd ldk-garbagecollected
    git remote add upstream [email protected]:lightningdevkit/ldk-garbagecollected.git

    # run java tests
    export LD_LIBRARY_PATH=/home/steve/git/ldk/ldk-garbagecollected
    mvn test
  18. notmandatory revised this gist Apr 20, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion build-ldk-java-bindings.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Steps to build ldk java bindings

    # install c++
    # install c++ (9.3.0) clang (10.0.1)
    sudo apt update
    sudo apt install llvm build-essential clang clang-tools

  19. notmandatory revised this gist Apr 20, 2021. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions build-ldk-java-bindings.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,12 @@
    Steps to build ldk java bindings

    # install c++
    sudo apt update
    sudo apt install llvm build-essential clang clang-tools

    # set rust toolchain
    rustup default 1.51.0

    # clone Matt's rust-lightning repo
    git clone https://git.bitcoin.ninja/rust-lightning
    cd rust-lightning
    @@ -17,13 +24,6 @@ git clone https://github.com/notmandatory/ldk-c-bindings
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git

    # install c++
    sudo apt update
    sudo apt install llvm build-essential clang clang-tools

    # set rust toolchain
    rustup default 1.51.0

    # generate bindings
    export LD_LIBRARY_PATH=../ldk-garbagecollected
    ./genbindings.sh ../rust-lightning false
  20. notmandatory revised this gist Apr 20, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion build-ldk-java-bindings.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # in ./ldk directory
    Steps to build ldk java bindings

    # clone Matt's rust-lightning repo
    git clone https://git.bitcoin.ninja/rust-lightning
    cd rust-lightning
  21. notmandatory created this gist Apr 20, 2021.
    29 changes: 29 additions & 0 deletions build-ldk-java-bindings.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    # in ./ldk directory
    # clone Matt's rust-lightning repo
    git clone https://git.bitcoin.ninja/rust-lightning
    cd rust-lightning
    git checkout 2021-03-java-bindings-base
    cd ..

    # clone ldk-garbagecollected repo
    git clone [email protected]:notmandatory/ldk-garbagecollected.git
    cd ldk-garbagecollected
    git remote add upstream [email protected]:lightningdevkit/ldk-garbagecollected.git
    cd ..

    # clone ldk-c-bindings repo
    git clone https://github.com/notmandatory/ldk-c-bindings
    cd ldk-c-bindings
    git remote add upstream [email protected]:lightningdevkit/ldk-c-bindings.git

    # install c++
    sudo apt update
    sudo apt install llvm build-essential clang clang-tools

    # set rust toolchain
    rustup default 1.51.0

    # generate bindings
    export LD_LIBRARY_PATH=../ldk-garbagecollected
    ./genbindings.sh ../rust-lightning false