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

no NDK aarch64-linux-android-gcc on $PATH at (eval 10) line 142. #2023

Open
anatoliy-lobanov opened this issue Dec 7, 2023 · 3 comments
Open

Comments

@anatoliy-lobanov
Copy link

System:

  • OS: macOS Ventura 13.6 (22G120)
  • strongSwan version(s): 5.9.13
  • Tested/confirmed with the latest version: yes

Describe the bug
When I launch build.sh script from strongswan/src/frontends/android/openssl/build.sh, I received the following error:
no NDK aarch64-linux-android-gcc on $PATH at (eval 10) line 142.

The full log of error:
Building OpenSSL's libcrypto for arm64-v8a
make: *** No rule to make target 'distclean'. Stop.
***** Deprecated options: no-hw
Configuring OpenSSL version 3.0.12 for target android-arm64
Using os-specific seed configuration

Failure! build file wasn't produced.
Please read INSTALL.md and associated NOTES-* files. You may also have to
look over your available compiler tool chain or change your configuration.

no NDK aarch64-linux-android-gcc on $PATH at (eval 10) line 142.

To Reproduce
Steps to reproduce the behavior:

  1. Open the Android project from path = strongswan/src/frontends/android
  2. Wait for the Gradle sync and so on
  3. Launch the script strongswan/src/frontends/android/openssl/build.sh

Expected behavior
After strongswan/src/frontends/android/openssl/build.sh script is executed, it should generate openssl for android, and put it to the folder strongswan/src/frontends/android/app/src/main/jni

Logs/Backtraces
➜ openssl git:(master) ✗ ./build.sh
[+] Building 2.3s (10/10) FINISHED docker:desktop-linux
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 685B 0.0s
=> [internal] load metadata for docker.io/library/debian:bullseye 2.2s
=> [1/5] FROM docker.io/library/debian:bullseye@sha256:ab2b95aa8d7d6d54866b92c322cf0693933c1ae8038652f24ddfda1d1763a45a 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 69B 0.0s
=> CACHED [2/5] RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends jq make perl && rm -rf 0.0s
=> CACHED [3/5] COPY compile.sh / 0.0s
=> CACHED [4/5] RUN chmod +x /compile.sh 0.0s
=> CACHED [5/5] WORKDIR /src 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:7fa378105961cde70edacc2f66e938c5cbe67c6cbe81251e6c369a710cc53264 0.0s
=> => naming to docker.io/library/strongswan-android-openssl-builder 0.0s

What's Next?
View a summary of image vulnerabilities and recommendations → docker scout quickview
Building OpenSSL's libcrypto for arm64-v8a
make: *** No rule to make target 'distclean'. Stop.
***** Deprecated options: no-hw
Configuring OpenSSL version 3.0.12 for target android-arm64
Using os-specific seed configuration

Failure! build file wasn't produced.
Please read INSTALL.md and associated NOTES-* files. You may also have to
look over your available compiler tool chain or change your configuration.

no NDK aarch64-linux-android-gcc on $PATH at (eval 10) line 142.

Additional context
Also, except this problem, when I make in the root of the project following commands:

  1. strongswan/autogen.sh -> OK
  2. strongswan/configure -> OK
  3. make -> NOT OK, and receiving following errors:
    ➜ strongswan git:(master) ✗ make
    /Library/Developer/CommandLineTools/usr/bin/make all-recursive
    Making all in src
    Making all in .
    make[3]: Nothing to be done for all-am'. Making all in include make[3]: Nothing to be done for all'.
    Making all in libstrongswan
    /bin/sh ../../ylwrap settings/settings_parser.y y.tab.c settings/settings_parser.c y.tab.h echo settings/settings_parser.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/ y.output settings/settings_parser.output -- bison -y -v -d
    /Users/xxxx/Documents/Repositories/strongswan/src/libstrongswan/settings/settings_parser.y:68.9-19: syntax error, unexpected identifier, expecting string
    make[3]: *** [settings/settings_parser.c] Error 1
    make[2]: *** [all-recursive] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
@tobiasbrunner
Copy link
Member

Please follow the build instructions for Android in the docs.

@anatoliy-lobanov
Copy link
Author

Please follow the build instructions for Android in the docs.

@tobiasbrunner , thank you a lot for the guide. I have followed by it, and still receiving the same issue. Steps are below:

  1. In the root of the project = ./autogen.sh => SUCCESS
  2. In the root of the project = ./configure => SUCCESS
  3. In the root of the project = make dist => SUCCESS
  4. export ANDROID_NDK_ROOT=/Users/xxx/Library/Android/sdk/ndk/22.1.7171670 => SUCCESS
  5. export OPENSSL_SRC=/Users/xxx/Documents/openssl/openssl-1.1.1w => SUCCESS
  6. Then = src/frontends/android/openssl/build.sh => FAILED with message below:
    ~/Documents/openssl/openssl-1.1.1w ~/Documents/Repositories/strongswan
    Building OpenSSL's libcrypto for arm64-v8a
    make: *** No rule to make target `distclean'. Stop.
    Configuring OpenSSL version 1.1.1w (0x1010117fL) for android-arm64
    Using os-specific seed configuration
    no NDK aarch64-linux-android-gcc on $PATH at (eval 10) line 142.

I do really need to build StrongSwan client for Android and launch it on real mobile device.
Please, help me to understand what I do wrong

P.S. I am using MacBook Pro 2019 (Intel Chip) with macOS Ventura 13.6 (22G120), using latest StrongSwan repository and master branch

@tobiasbrunner
Copy link
Member

Your NDK might not work for this as the build script (which runs in a Linux Docker container, by default) expects that the prebuilt Linux toolchain exists ($ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64). I guess the NDK you have is the one for macOS. So you'll either have to download the Linux-specific NDK and pass the path to that in ANDROID_NDK_ROOT, or change the path to the toolchain in compile.sh and export NO_DOCKER=1 so it builds on the host and not in a container (requires jq or specifying $ABIS manually, and also requires make and perl, so using Docker is usually easier).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants