Trouble cross compiling Python - android

I'm trying to cross compile Python 3.7.3 to run on Android. Before the updates to the NDK to remove gcc, I had been building Python 3.5.1 without any problems in this git project. https://github.com/GRRedWings/python3-android/tree/clang
The Python build recipe can be found here https://github.com/GRRedWings/python3-android/blob/clang/mk/python/3.7.3/build.sh, with many of the exports having been set in env of the root, and build_single.sh in the mk directory.
Trying to update the to the latest NDK, and running into issues, I was unable to get any support with the older version of Python. I'm hoping that someone who understand cross compiling and configure scripts might be able to point me in the right direction.
Here is my output when I call configure
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: configure.ac: not using Automake
autoreconf: Leaving directory `.'
OUR TARGET IS aarch64-linux-android
configure: loading site script ./config.site
checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-android
checking for python3.7... no
checking for python3... python3
checking for python interpreter for cross build... configure: error: python3.7 interpreter not found
Makefile:34: recipe for target 'python-3.7.3' failed
make: *** [python-3.7.3] Error 1
So my question is, what and where should I be focusing. Should I be looking into the configure error saying python3.7 interpreter not found? Should I be looing in the config.log? The only error I see in there is about the interpreter.

Although it is an old question, I have solved it. It seems strange that if you do a cross-compiling, you need to install a local version of python with the same minor version. It is to say that if you want to build Python 3.7.x, you need to install a local version of Python 3.7.x on your build machine. I do it by using pyenv.

Related

How to setup Travis CI for an Android Project which uses both NDK and SDK to build

I've searched in so many places, even in Travis CI documentation page but I couldn't find the solution of my problem. The issue is - I already have an Android Project set up on Travis CI which works fine. Now, I have some requirement where I need to compile some native files for my project. In my local machine, the set up works perfectly as I've SDK and NDK installed. When I push the code the Travis complains about the NDK. So, I looked for how to set up the NDK for Travis. I followed below links ---
https://github.com/googlesamples/android-ndk/blob/master/.travis.yml
Travis: how to know android sdk/ndk path?
https://github.com/travis-ci/travis-ci/issues/5395
But none of the above worked. My travis.yml file is in below --
# which language/platform is used
language: android
# JDK version
jdk:
- oraclejdk8
# root permission required?
sudo: required
dist: precise
# Environment variables
env:
global:
- BRANCH_NAME=$TRAVIS_BRANCH
# android components required to build code
android:
components:
- tools
- platform-tools
- build-tools-25.0.3
- android-24
- extra-android-m2repository
- extra-google-m2repository
- extra-google-google_play_services
# clean up old stuff before we get started
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
# cache directories to use
cache:
directories:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
# Configurations to set up Android NDK
before_install:
- rm -fr $HOME/android-ndk-r16b
- curl -L http://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O
- unzip -oq android-ndk-r16b-linux-x86_64.zip
- rm android-ndk-r16b-linux-x86_64.zip
- export ANDROID_NDK_HOME=$HOME/android-ndk-r16b
- export PATH=$PATH:${ANDROID_NDK_HOME}
# Build script - which configs and creates the builds
script: "./my_script.sh"
With this setup Travis CI recognizes the NDK but while running my build script it's unable to find it. Below is the log for my Travis build --
android.install
Installing Android dependencies
creating directory /home/travis/.gradle/caches
adding /home/travis/.gradle/wrapper to cache
creating directory /home/travis/.gradle/wrapper
$ java -Xmx32m -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
$ javac -J-Xmx32m -version
javac 1.8.0_111
before_install.1
$ rm -fr $HOME/android-ndk-r16b
before_install.2
$ curl -L http://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O
before_install.3
$ unzip -oq android-ndk-r16b-linux-x86_64.zip
before_install.4
$ rm android-ndk-r16b-linux-x86_64.zip
before_install.5
$ export ANDROID_NDK_HOME=$HOME/android-ndk-r16b
before_install.6
$ export PATH=$PATH:${ANDROID_NDK_HOME}
$ ./build_cc_app.sh
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/3.3/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
Parallel execution with configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /home/travis/android-ndk-r16b.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
NDK is missing a "platforms" directory.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':client'.
> NDK not configured. /home/travis/android-ndk-r16b
Download it with SDK manager.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 29.479 secs
The error message says it is missing the platforms directory. You could probably investigate further by requesting that debug is enabled on your repository:
Running build in debug
This feature is available for private repositories and those public
repositories for which the feature is enabled. To have the feature
enabled for a public repository, please email us at
support#travis-ci.com indicating which ones. Push access to the
repository is also required.
I have found Travis are quite quick to respond but you'll also need to set up your commandline client:
Travis commandline client
So, after a lot of hassle and lots of debugging sessions on Travis CI builds, I figured out the way to solve this issue. Apparently, the default android tool-chain searches for NDK in its SDK directory. As it was not able to find that, it was complaining for the NDK. So, I had to use the Default tool chain to get the NDK. Below is a snapshot of my .travis.yml file which points to the changes that I made to resolve this issue.
To find the answer why I added tools twice, you can refer to this link. Refer to below image to figure out which portion of the Doc to refer for the answer.
So, as it's mentioned in the Travis CI documentation, when we want to build an Android Project with SDK level 24, we need to use the tools options twice in the yml script.
And then as I was using ndk-build to build my native files, I just had to add below part in the yml script.
# Configurations to set up Android NDK
before_install:
- echo y | sdkmanager "ndk-bundle"
One thing to remember. I was using C language for native project. If you are using C++, then you might need to install Cmake for that. Below is the code for that --
before_install:
- echo y | sdkmanager "ndk-bundle"
- echo y | sdkmanager "cmake;3.6.4111459" # (Check the Cmake version you want to use)

Compiling and installing OpenSSH android NDK

hi i am following this guide (https://wiki.openssl.org/index.php/Android) on compiling and installing OpenSSH for Android NDK and get the following error when i execute this command:
sudo -E make install CC=$ANDROID_TOOLCHAIN/arm-linux-androideabi-gcc RANLIB=$ANDROID_TOOLCHAIN/arm-linux-androideabi-ranlib
The error below:
make[1]: Nothing to be done for `install'.
making install in tools...
installing libcrypto.a
/bin/sh: /arm-linux-androideabi-ranlib: No such file or directory
Am not sure where it is trying to find this file or what this file is?
I had to execute export ANDROID_TOOLCHAIN= /path/to/toolchain again as the setEnv-android.sh did not set the toolchain environment for some odd reason

getting error when running ndk-build i cygwin

when i trying to running the command code ndk-build ,the error prompt out like this
leo#leo-PC /cygdrive
$ ndk-build
/bin/sh: NUL: No such file or directory
Error: Current working directory is a virtual Cygwin directory which does
not exist for a native Windows application.
Can't start native Windows application from here.
make: execvp: /cygdrive/c/Users/leo/Desktop/android/android-ndk-r9d/prebuilt/windows-x86_64/bin/awk.exe: Not a directory
Android NDK: Host 'awk' tool is outdated. Please define NDK_HOST_AWK to point to Gawk or Nawk !
/cygdrive/c/Users/leo/Desktop/android/android-ndk-r9d/build/core/init.mk:377: *** Android NDK: Aborting. . Stop.
i had following all the step here https://developer.vuforia.com/resources/dev-guide/step-1-setting-development-environment-android-sdk and also crated the windows path for them but i still facing this problem .

NDK build error with cygwin

i am tying to build a tesseract project to use as a library for my project. I am getting this error with cygwin when trying to build on windows 7 with User Account Controls turned off.
$ /cygdrive/c/android-ndk-r8/ndk-build
SharedLibrary : liblept.so
C:/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libgnustl_static.a: No such file: Permission denied
collect2: ld returned 1 exit status
/cygdrive/c/android-ndk-r8/build/core/build-binary.mk:369: recipe for target `obj/local/armeabi/liblept.so' failed
make: *** [obj/local/armeabi/liblept.so] Error 1
please let me know what i should do to build the project.
Sorry It's my first time answering a question.
I was having a same issue as yours.
Then I solve it using cygwin bash with command: $ chmod -R 777 /cygdrive/c/android/workspace
C:/Android/workspace is my Eclipse work space.
Some one here gave me the insight
A lot of people have struggled with compiling tesseract under Windows, and Cygwin is normally suggested, however its often not necessary.
Have you tried looking at the tess-two project on github? Its tesseract wrapped with some handy android classes, compiling a running is simply a case of :
git clone git://github.com/rmtheis/tess-two tess
cd tess
cd tess-two
ndk-build
android update project --path .
ant release
I've been able to compile the above on 3 windows7 machines, a mac, and ubuntu without any issues.
if you're developing under windows, go to the file, and change it's premissions to full control.
it will be in /obj dir

Compile Linphone for Android

I'm facing an issue on compiling the NDK code. I'm using Ubuntu 10.04
x64. Basically i have performed the following steps:
Download the NDK. (I also tried the last one but the same issue)
Open terminal and make sudo -s. Input the root password.
apt-get install autoconf automake libtool pkg-config
Download source code through command:
git clone git://git.linphone.org/linphone-android.git --recursive
Go to my project root:
cd /home/silviu/linphone-android
In my project root:
export PATH=/home/silviu/androidndk:$PATH
Run ./prepare_sources.sh in my project root.
I receive an error in prepare_sources.sh:
Configuring selected codecs
enabling vp8_encoder
enabling vp8_decoder
Configuring for target 'armv7-android-gcc'
enabling armv7
enabling armv6
enabling armv5te
enabling fast_unaligned
enabling realtime_only
Toolchain is unable to link executables
Configuration failed. This could reflect a misconfiguration of your
toolchains, improper options selected, or another problem. If you
don't see any useful error messages above, the next step is to look at
the configure error log file (config.err) to determine what configure
was trying to do when it died. VP8 prepare stage failed.
Have anybody facing this issue?

Categories

Resources