Build wallet with Android NDK #1510

Merged
merged 1 commit into from Jan 9, 2017

Projects

None yet

5 participants

@MoroccanMalinois
Contributor

With clang and libc++, libwallet_merged and monero-wallet-cli builds and seems to works fine.
It still fails to build the daemon : something wrong about libblocks - format not recognized
I don't really understand what's being done at the first place :)

@moneromooo-monero
Contributor

A few minor comments, looks good otherwise.

@NanoAkron
Contributor

Worth squashing the commits?

@MoroccanMalinois
Contributor
MoroccanMalinois commented Dec 29, 2016 edited

Done
Thank you. Total noob here. All comments appreciated
(Here is the dockerfile that is use to build)

@moneromooo-monero

I seem to have missed committing the comments, sorry.

@@ -70,6 +70,10 @@ release-static-armv7:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
+release-static-android:
@moneromooo-monero
moneromooo-monero Dec 29, 2016 Contributor

It's a static binary, but built with position inpependant code ? Might well be right, but it seems surprising at first glance so I'm pointing it out to make sure this is right.

@MoroccanMalinois
MoroccanMalinois Dec 30, 2016 Contributor

TBH, i don't understand PIC/PIE.

only` position independent executables (PIE) are supported

is the message i got when i tried to execute it whitout PIE
this doc page and this SE made me add it
this seems to only be mandatory from android 5 and won't work with android < 4.1, so we may want to add a variable for the android api level and check it, but i don't think it's worth it to support prior versions

@moneromooo-monero
moneromooo-monero Dec 30, 2016 Contributor

Fair enough, if it works, I think it's fine :)

src/common/int-util.h
+# endif
+# if defined(__swap64) && !defined(swap64)
+# define swap64 __swap64
+# endif
@moneromooo-monero
moneromooo-monero Dec 29, 2016 Contributor

Looks like there can be missing cases in theory. If it's certain that at least one of them will exist, it's fine, otherwise you need to define the fallback below.

+#else
+ uint8_t *long_state = NULL;
+ long_state = (uint8_t *)malloc(MEMORY);
+#endif
@moneromooo-monero
moneromooo-monero Dec 29, 2016 Contributor

This does a large malloc/free at every call, which might not be good for memory churn and caching. I think it would gain from being done in slow_hash_allocate_state etc.

@MoroccanMalinois
MoroccanMalinois Dec 30, 2016 Contributor

OK. I'm investigating (doesn't look as trivial as the modif i made so far :) so it might take some days before i comment back)

@MoroccanMalinois
MoroccanMalinois Jan 5, 2017 Contributor

From what i see, there is no loop calling cn_slow_hash in the wallet and i don't think that this define will be necessary for the daemon, since a better fix would be to set stack size during the thread creation, and the cli works fine without

@vtnerd
vtnerd Jan 5, 2017 Contributor

Can you use unique_ptr then? No need for the second #ifndef below, and do not have to be concerned about throwing functions in here.. Make sure to not mix new/free or new[]/delete. Easiest is to do unique_ptr<char[]> block{new char[MEMORY]}.

@MoroccanMalinois
MoroccanMalinois Jan 6, 2017 Contributor

I don't know if it's a good idea to add c++ code in .c file. Anyway, i tried and std::unique_ptr is not defined (tried to add include memory but file not found)

@vtnerd
vtnerd Jan 7, 2017 Contributor

Ahh I missed that this was a C file.

@MoroccanMalinois MoroccanMalinois referenced this pull request in monero-project/monero-core Dec 30, 2016
Merged

Android build #370

@NanoAkron
Contributor

Pls squashup when you've finished, and have a great New Year's Eve!

@MoroccanMalinois MoroccanMalinois Build wallet with Android NDK
80abc3b
@fluffypony

Reviewed

@fluffypony fluffypony merged commit 80abc3b into monero-project:master Jan 9, 2017

7 of 10 checks passed

buildbot/monero-static-debian-armv8 Build done.
Details
buildbot/monero-static-ubuntu-arm7 Build done.
Details
buildbot/monero-static-win32 Build done.
Details
buildbot/monero-static-freebsd64 Build done.
Details
buildbot/monero-static-osx-10.10 Build done.
Details
buildbot/monero-static-osx-10.11 Build done.
Details
buildbot/monero-static-osx-10.12 Build done.
Details
buildbot/monero-static-ubuntu-amd64 Build done.
Details
buildbot/monero-static-ubuntu-i686 Build done.
Details
buildbot/monero-static-win64 Build done.
Details
@MoroccanMalinois MoroccanMalinois deleted the MoroccanMalinois:android branch Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment