1

I am new in NDK, I am trying to add openssl to my android project using C, I have looked and tried and I cannot figure out how to linked openssl libraries in Android, another reason I am asking this is because most page and post I've found that talk or say information about it don't say anything for 64 bit arch's(ARM64, MIPS64 and x86_64), only for ARM and X86 arch's, I haven't found any recent post using NDK 10 and 64 bit arch.

I tried this link and I get an error when I try the line:

$ . ./setenv-android.sh

bash: ./setenv-android.sh: line 106: do

the 106 line says:

for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86"
  do
    if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then
    ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin"
    break
  fi
done

but I don't know how to fix the code, and it kind of old that post.

Also I tried this link but I couldn't make the step 1. gpg --import # paste PGP public key block on stdin When I tried it with the corresponding public key block it didn't do something and when trying ./import_openssl.sh import openssl-*.tar.gz it show an error and ./import_openssl.sh regenerate patches/*.patch didn't fix it also didn't know how to modify openssl.config and patches and also I don't think that work for 64 bit arch.

Can sombody tell me or send me how to linked openssl libraries in NDK for all ABI, I am using Windows 7, Cygwin, and NDK 10d

  • Well, it looks OK to me. It seems to be one f two things. First, ensure you are using Unix/Linux newline (`LF`), and not Windows (`CRLF`) or OS X (`CR`). Second, add a semi colon after `for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86";`. The odd thing is the semi-colon should only be required if the `do` was on the same line as the `if`. (BTW, I wrote that script. I may have crossed Windows and OS X because I work on both platforms regularly). – jww Apr 28 '15 at 22:01
  • I change the Unix/Linux newline (LF) and it works, thanks, but I'm getting 2 errors when I make the command `make depend`: `cryptlib.c:170:3: error: # error "Inconsistency between crypto.h and cryptlib.c"` cryptlib.c:170:3 says `#if CRYPTO_NUM_LOCKS != 41 # error "Inconsistency between crypto.h and cryptlib.c" #endif` and the other error `uid.c:77:10: error: #include expects "FILENAME" or #include OPENSSL_UNISTD` – Fernando Berra Apr 29 '15 at 16:13
  • Start a new thread for the issue with `#errors`. – jww Apr 29 '15 at 19:48

1 Answers1

0

I resolve partially my problem but it's not completely answer, I did compile openssl for android x86 and arm architecture in this link I post my advances.

I'm not going to mark this answer as correct till I'll compile openssl for all architectures

EDIT:

I post the answer in this link

Community
  • 1
  • 1
  • You question was related to errors running the script. Your answer was *"I changed the Unix/Linux newline (LF) and it works"*. You should provide the answer in this block; and then mark it as accepted. Don't change the question or leave it open. If you have a new question, then you should ask a new question. That's how Stack Overflow works. – jww May 07 '15 at 19:53
  • But the question was about cross-compiling libraries for android, the change to Unix newline(LF) fix one problem, but I got new problems aftert that and I "fixed" those new problem but the final product (cross-compiling in all android abi) it's not finish, I don't think I should provide the answer on this block yet, I am close to get the openssl .so libraries for all abi in android (that's the main objetive in this question), when I finnish I'll post my answer and close this thread but I don't want to give and incomplete answer – Fernando Berra May 08 '15 at 01:54