Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iroh resp. rocksdb does not compile on android #3570

Closed
r10s opened this issue Sep 1, 2022 · 12 comments
Closed

iroh resp. rocksdb does not compile on android #3570

r10s opened this issue Sep 1, 2022 · 12 comments
Labels
bug Something is not working

Comments

@r10s
Copy link
Member

r10s commented Sep 1, 2022

trying to build #3489 on android leads to different errors:

for "arm64-v8a" and "x86_64" (though printed as a "warning", compiling is aborted with an error):

  cargo:warning=rocksdb/env/io_posix.cc:1001:41: error: use of undeclared identifier 'POSIX_MADV_NORMAL'
  cargo:warning=      Madvise(mmapped_region_, length_, POSIX_MADV_NORMAL);
  cargo:warning=                                        ^
  cargo:warning=rocksdb/env/io_posix.cc:1004:41: error: use of undeclared identifier 'POSIX_MADV_RANDOM'
  cargo:warning=      Madvise(mmapped_region_, length_, POSIX_MADV_RANDOM);
  cargo:warning=                                        ^
  cargo:warning=rocksdb/env/io_posix.cc:1007:41: error: use of undeclared identifier 'POSIX_MADV_SEQUENTIAL'
  cargo:warning=      Madvise(mmapped_region_, length_, POSIX_MADV_SEQUENTIAL);
  cargo:warning=                                        ^
  cargo:warning=rocksdb/env/io_posix.cc:1010:41: error: use of undeclared identifier 'POSIX_MADV_WILLNEED'
  cargo:warning=      Madvise(mmapped_region_, length_, POSIX_MADV_WILLNEED);
  cargo:warning=                                        ^
  cargo:warning=rocksdb/env/io_posix.cc:1013:41: error: use of undeclared identifier 'POSIX_MADV_DONTNEED'
  cargo:warning=      Madvise(mmapped_region_, length_, POSIX_MADV_DONTNEED);
  cargo:warning=                                        ^
  cargo:warning=5 errors generated.
  exit status: 0
  exit status: 1

for "armv7-linux-androideabi (arm)" and "i686-linux-android (x86)"

  cargo:warning=In file included from rocksdb/cache/cache_key.cc:13:
  cargo:warning=In file included from rocksdb/util/hash.h:26:
  cargo:warning=rocksdb/util/fastrange.h:62:5: error: unknown type name '__uint128_t'
  cargo:warning=    __uint128_t wide = __uint128_t{range} * hash;
  cargo:warning=    ^
  cargo:warning=rocksdb/util/fastrange.h:62:24: error: use of undeclared identifier '__uint128_t'
  cargo:warning=    __uint128_t wide = __uint128_t{range} * hash;
  cargo:warning=                       ^
  cargo:warning=rocksdb/util/fastrange.h:62:35: error: expected ';' at end of declaration
  cargo:warning=    __uint128_t wide = __uint128_t{range} * hash;
  cargo:warning=                                  ^
  cargo:warning=                                  ;
  cargo:warning=3 errors generated.
  exit status: 1

not sure yet if x86-32bit builds on android. EDIT: it does not, i added these targets above.

@r10s r10s added the bug Something is not working label Sep 1, 2022
@dignifiedquire
Copy link
Member

@r10s what is the NDK version you are building against?

@dignifiedquire
Copy link
Member

I got it to build by setting the following things

TARGET_CC=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang \
CC=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang \
CXX=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang++ \
cargo build --target x86_64-linux-android -p deltachat_ffi --features vendored

@dignifiedquire
Copy link
Member

And for any ndk version > 21 needs a workaround like this: godot-rust/gdnative#920

@r10s
Copy link
Member Author

r10s commented Sep 1, 2022

@r10s what is the NDK version you are building against?

just having a look: i am using locally r22b, Dockerimage uses r23c.

@r10s
Copy link
Member Author

r10s commented Oct 8, 2022

And for any ndk version > 21 needs a workaround like this: godot-rust/gdnative#920

that seems to be already done at https://github.com/deltachat/deltachat-android/blob/master/scripts/ndk-make.sh#L95

@r10s
Copy link
Member Author

r10s commented Oct 8, 2022

I got it to build by setting the following things

TARGET_CC=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang
CC=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang
CXX=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang++
cargo build --target x86_64-linux-android -p deltachat_ffi --features vendored

k, stepping away from ./scripts/ndk-make.sh for a moment.

i tried the following:

compiling seem to run through for that target, so, some tiny steps, but linking throws the error:

  = note: ld: unknown option: --version-script=/var/folders/24/mxfz55k547g94mql66v050ww0000gn/T/rustcaUsENY/list
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

wondering, where the option --version-script is set.

@dignifiedquire
Copy link
Member

@r10s unclear to me where that is coming from either for me, looks like an option that is not available on macos/clangd. Can you build master with that command cleanly?

@dignifiedquire
Copy link
Member

@r10s thanks to @fabricedesre I got this script which he uses to build his projects including iroh for android phones https://gist.github.com/dignifiedquire/6d9dc7c6efff2c68e430aa700d1a2e62

@r10s
Copy link
Member Author

r10s commented Oct 9, 2022

@r10s unclear to me where that is coming from either for me, looks like an option that is not available on macos/clangd. Can you build master with that command cleanly?

good aspect to test - and indeed building with command from above on master throws the same error for me on macos.

but i double checked ./ndk-make.sh on current master and recent iroh-share pr - the latter still fails with errors as initially shown.

@fabricedesre
Copy link

@r10s
Copy link
Member Author

r10s commented Dec 5, 2022

some issues might also be related to the new toolchain, master was just updated to rust 1.65, so, let's see if master compiles and android now.

@link2xt
Copy link
Collaborator

link2xt commented Mar 15, 2023

Closing this as #3489 is closed.

@link2xt link2xt closed this as completed Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

4 participants