Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Unable to build android bindings #15

Closed
RohanKapurDEV opened this issue Jul 12, 2020 · 2 comments · Fixed by #23
Closed

Unable to build android bindings #15

RohanKapurDEV opened this issue Jul 12, 2020 · 2 comments · Fixed by #23
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@RohanKapurDEV
Copy link

RohanKapurDEV commented Jul 12, 2020

I've installed the dependencies and modified the cargo config file as described at: https://github.com/LNP-BP/rgb-node/tree/master/ffi/android/library.

However, I get the following errors when running .\gradlew build.
OS: Windows 10

PS E:\android-libs\rgb-node\ffi\android\library> .\gradlew build

> Task :library:compileDebugJavaWithJavac FAILED
E:\android-libs\rgb-node\ffi\android\library\library\src\main\java\org\lnpbp\rgbnode\Runtime.java:9: error: package org.lnpbp.rgbnode_autogen does not exist
import org.lnpbp.rgbnode_autogen.COpaqueStruct;
                                ^
E:\android-libs\rgb-node\ffi\android\library\library\src\main\java\org\lnpbp\rgbnode\Runtime.java:10: error: package org.lnpbp.rgbnode_autogen does not exist
import org.lnpbp.rgbnode_autogen.rgb_node;
                                ^
E:\android-libs\rgb-node\ffi\android\library\library\src\main\java\org\lnpbp\rgbnode\Runtime.java:16: error: cannot find symbol
    private final COpaqueStruct runtime;
                  ^
  symbol:   class COpaqueStruct
  location: class Runtime
E:\android-libs\rgb-node\ffi\android\library\library\src\main\java\org\lnpbp\rgbnode\Runtime.java:25: error: cannot find symbol
            this.runtime = rgb_node.start_rgb(jsonArgs);
                           ^
  symbol:   variable rgb_node
  location: class Runtime
E:\android-libs\rgb-node\ffi\android\library\library\src\main\java\org\lnpbp\rgbnode\Runtime.java:35: error: cannot find symbol
            rgb_node.issue(this.runtime, jsonArgs);
            ^
  symbol:   variable rgb_node
  location: class Runtime
E:\android-libs\rgb-node\ffi\android\library\library\src\main\java\org\lnpbp\rgbnode\Runtime.java:45: error: cannot find symbol
            rgb_node.transfer(this.runtime, jsonArgs);
            ^
  symbol:   variable rgb_node
  location: class Runtime
6 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':library:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 19s
12 actionable tasks: 1 executed, 11 up-to-date

Not sure whats going on here to be completely honest. Anyone have any ideas?

Edit: My cargo config file looks like the following (the paths for android targets might seem strange but it's in windows format):

[core]
	bare = false
	repositoryformatversion = 0
	filemode = false
	symlinks = false
	ignorecase = true
	logallrefupdates = true

[target.aarch64-linux-android]
ar = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android-ar"
linker = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android26-clang"

[target.x86_64-linux-android]
ar = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android-ar"
linker = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\x86_64-linux-android26-clang"

[target.armv7-linux-androideabi]
ar = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\arm-linux-androideabi-ar"
linker = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi26-clang"

[target.i686-linux-android]
ar = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\i686-linux-android-ar"
linker = "C:\Users\rohan\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\i686-linux-android26-clang"
@dr-orlovsky
Copy link
Member

I think you need to run ./build_rust.sh in the same dir first, before gradlew

@dr-orlovsky dr-orlovsky added the help wanted Extra attention is needed label Jul 12, 2020
afilini added a commit to afilini/rgb-node that referenced this issue Jul 13, 2020
@afilini
Copy link
Contributor

afilini commented Jul 13, 2020

I opened a PR to fix the dependency issue between the tasks (we want to generate the sources before we try to compile them, which was an issue) but I don't think this will actually make it work on windows.

I can't say for sure because I know there are things like WSL and stuff but I've never tried them, so maybe with them you might manage to make it work, but I would say that for now this is largely Linux/macOS only unfortunately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants