-
Notifications
You must be signed in to change notification settings - Fork 734
Android builds arm arm64 and x86 #777
Android builds arm arm64 and x86 #777
Conversation
8de78a4
to
686e877
Compare
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com> (cherry picked from commit 2d681f6) Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com> Updated READMEs
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
686e877
to
bb4bede
Compare
@faisal00813 the path |
Signed-off-by: Mohammad Abdul Sami faisal00813@gmail.com Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com> Fixed credentials filtering bug Signed-off-by: artem.ivanov <artem.ivanov@dsr-company.com> fixed libsqlcipher-sys version in cargo.lock Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
# Conflicts: # libindy/Cargo.lock # libindy/Cargo.toml # libindy/build.rs
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
|
||
## Prerequisites | ||
|
||
- Docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can i build it on windows and MacOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only Linux is supported as of now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this info to per-requirements? It is better to provide info about platform that we tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That info is present in Known Issues segment at the bottom of the document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -38,17 +38,17 @@ sodium_static = [] | |||
indy-crypto = { version = "=0.4.1", optional = true } | |||
int_traits = { version = "0.1.1", optional = true } | |||
digest = "0.6.2" | |||
env_logger = "0.4.2" | |||
env_logger = "0.5.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it updated intentionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. We require 0.4.2 for android_logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, make sense
errno = "0.2.3" | ||
etcommon-rlp = "0.2.3" | ||
generic-array = "0.8.3" | ||
hex = "0.2.0" | ||
libc = "0.2.21" | ||
log = "0.3.7" | ||
log = "0.4.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it updated intentionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, make sense
libindy/Cargo.toml
Outdated
openssl = { version = "=0.9.24", optional = true } | ||
owning_ref = "0.3.3" | ||
rand = "0.3" | ||
rusqlite = "0.13.0" | ||
rusqlite = { version = "0.13.0", features=["bundled"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i understand now we start static linking with sqlite on all platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Android, we don't have SQLite binaries which we provide while building. Also, I can't recall any flag which suggests that we are doing static linking with SQLite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that we don't want to force static linking on all platforms. Only for android and iOS
- Modified to plugged/mod.rs to support arm64 Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
libindy/build.rs
Outdated
@@ -32,4 +32,40 @@ fn main() { | |||
} | |||
} | |||
} | |||
match &target { | |||
x if x.contains("aarch64-linux-android") || x.contains("armv7-linux-androideabi") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just replace this complex if with just "linux-android" as it seems present in all arch strings?
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
@@ -0,0 +1,49 @@ | |||
FROM ubuntu:16.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to rename it to something more obvious like android-build-env.dockerfile
doc/android-build.md
Outdated
|
||
## How to build. | ||
- Goto `indy-sdk/libindy/build_scripts/android` folder | ||
- Run `build.dependencies.locally.sh` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run
build.dependencies.locally.sh
Will it build dependencies for all supported architectures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The script will build for x86, arm and arm64 architectures.
mkdir -p $ARMV7_DIR | ||
mkdir -p $ARMx86_DIR | ||
|
||
git clone /~https://github.com/nsivraj/openssl_for_ios_and_android.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build must be repeatable. Se we can't use just master branch for dependencies. Use tag/release/commit
|
||
if [ ! -f "libsodium-1.0.12.tar.gz" ] ; then | ||
echo "Downloading libsodium-1.0.12.tar.gz" | ||
wget -q wget /~https://github.com/jedisct1/libsodium/releases/download/1.0.12/libsodium-1.0.12.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Master uses libsodium 1.0.14
libindy/src/utils/environment.rs
Outdated
|
||
pub struct EnvironmentUtils {} | ||
|
||
impl EnvironmentUtils { | ||
pub fn indy_home_path() -> PathBuf { | ||
// TODO: FIXME: Provide better handling for the unknown home path case!!! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code doesn't look correct for me.
- I see 2 unwraps. Will we crash if there is no EXTERNAL_STORAGE variable?
- Why we create directories here? It isn't responsibility of this function
- Flow also looks very non-obvious? Can you just use on match or if/if else/if else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Libindy will now panic! if it cannot find the EXTERNAL_STORAGE .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @vimmerru. Please fix all 3 points
#777 (comment)
I suggest not to use cd ../../../.. to get to the root of indy-sdk from the build scripts but to use #!/usr/bin/env bash BASEDIR=$(dirname "$0") DEPS_FOLDER=$BASEDIR/dependencies I have send the changed script via email to @faisal00813 Another thing: Why delete the android ndk? I copied it here so that it does not get downloaded everytime. |
It would be nice to have a script in libindy root folder that will build artifacts for all platforms. |
You use /~https://github.com/nsivraj/openssl_for_ios_and_android to build openssl, This script isn't performed in isolated environment. Does it require any pre-requirements? Can we just use pre-built binary from the same site? |
Build looks a bit over-complicated now. You use dockerfiles that just perform builds of one thing. It can be much faster (and easy to understand) to have one dockerfile that setups all necessary environment and set of scripts to execute inside of this dockerfile. |
Is there a way to execute tests? |
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
[WIP] updated build scripts to download and use prebuilt dependencies Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Android NDK 17 is out. Update this? |
…l the architecture. Removed dependencies building scripts and instructions. Libnullpay uses same mechanism for building as libindy Build scripts downloads prebuilt binaries while building. Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
@AxelNennker I don't see any immediate need for updating to NDK17. The changelog suggests deprecation of GCC and we use CLANG in our scripts. |
@vimmerru I have simplified the build scripts. Now a single script in root folder of each module (libindy and libnullpay) builds for all the architectures. |
I switched out r16 and moved to r17 and rebuild using my scripts and had no problems doing that. |
Also addressed the concern regarding /~https://github.com/nsivraj/openssl_for_ios_and_android . Now we use a fork /~https://github.com/evernym/indy-android-dependencies with a tag. |
…nother function Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
…ble on android. Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix active review comments above. Right now it's only about codestyle, if required I can review build scripts structure as next round of review.
libindy/build.rs
Outdated
@@ -32,4 +32,38 @@ fn main() { | |||
} | |||
} | |||
} | |||
match &target { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please clean-up code here. Seems like this section should be in else if
for previous one (windows)
libindy/src/utils/environment.rs
Outdated
|
||
pub struct EnvironmentUtils {} | ||
|
||
impl EnvironmentUtils { | ||
pub fn indy_home_path() -> PathBuf { | ||
// TODO: FIXME: Provide better handling for the unknown home path case!!! | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @vimmerru. Please fix all 3 points
#777 (comment)
@@ -6,7 +6,7 @@ build = "build.rs" | |||
|
|||
[lib] | |||
name = "nullpay" | |||
crate-type = ["cdylib", "rlib"] | |||
crate-type = ["staticlib","cdylib", "rlib"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like staticlib should be android-specific target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if rust supports the conditional crate-type declaration. Does it?
There are two issues related to it though, rust-lang/cargo#5367 and rust-lang/cargo#4900 .
libnullpay/build.rs
Outdated
@@ -4,19 +4,29 @@ use std::path::Path; | |||
fn main() { | |||
let target = env::var("TARGET").unwrap(); | |||
println!("target={}", target); | |||
match &target { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match
construction is ugly here. please clean-up and use if else
android_logger = "0.5" | ||
[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies] | ||
rusqlite = { version = "0.13.0", features=["bundled"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please specify common and android rusqlite dependence as neighbors to avoid partial update in the future
@faisal00813 After auto-merge test compilation is failed, please fix it also |
updated android-build.doc Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
…cargo.toml for better visibility Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami <faisal00813@gmail.com>
Signed-off-by: Mohammad Abdul Sami faisal00813@gmail.com