I'm cross compiling hostapd for allwinner a13 board by following command
export PATH=PATH:/path_to_toolchain
export CC=arm-none-linux-gnueabi-gcc
make
hostapd binary generated successfully but when I execute hostapd in board then it gives
"/system/bin/sh: hostapd: No such file or directory"
adb push hostpad /system/bin/
root#android:/ # chmod 777 /system/bin/hostapd
root#android:/ # hostapd
/system/bin/sh: hostapd: No such file or directory
So how to resolve this issue?
What toolchain are you using? You should use the same NDK toolchain as was used for your Android image, otherwise you'll have architecture/library mismatch.
Execute file hostapd and file on any binary in your Android image and you'll see the difference.
you can avoid above problem by
1) compile statically or
2) compile your hostpd with same toolchain which you used in android build system.
arm-none-linux-gnueabi toolchain and android toolchain will having library mismatch.
Related
I cannot resolve this error, even though it is mentioned as resolved here in M1.
Unknown host CPU architecture: arm64 , Android NDK SiliconM1 Apple MacBook Pro
My error code.
[CXX1405] error when building with ndkBuild using /Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/src/main/jni/Android.mk: Build command failed.
Error while executing process /Users/adamheinrich/Library/Android/sdk/ndk/20.1.5948944/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/src/main/jni/Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-22 NDK_OUT=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/build/intermediates/cxx/Debug/x2j681s3/obj NDK_LIBS_OUT=/Users/adamheinrich/Desktop/android-solocoo-2.0/Solocoo/app/build/intermediates/cxx/Debug/x2j681s3/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
ERROR: Unknown host CPU architecture: arm64
After editing ndk-build with text editor I have.
What else can I do?
How can I install .dmg beta ndk? It is not available in SDK Manager via Android Studio.
Also after editing this file my OS says it is corrupted/ damaged. How can I edit it properly?
Using Sublime Text editor instead of Macbook text editor allowed me to edit it without corrupting it. Edit ndk-build file in Library/Android/sdk/ndk
to:
#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
arch -x86_64 /bin/bash $DIR/build/ndk-build "$#"
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
tinyalsa elf failed to run on android shell, anybody know what is wrong with it ?
I am new to android, :-)
here are my steps:
1. download tinyalsa source code to a ubuntu 10 vm, compile it with arm-linux-gnueabi-gcc
2. adb push xx\tinypcminfo /data/local/tmp
3. adb shell -> cd /data/local/tmp ->chmod 777 tinypcminfo
4. ./tinypcminfo
5. error happened
I am beginner with Android and I have to make a voip app and after searching I found that the better opensource library for that is PJSIP.
I download the below things to build the PJSIP library:
PJSIP from here
Android NDK
SWIG
...But I don't know how to start. I checked this link for the official PJSIP website but I didn't make any progress.
Which Directory do I have to put the Android NDK into?
How to use SWIG to build the PJSIP?!
which Directory i have to put the Android NDK ?
Put it where you want, later you will setup the path to it
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir
how to use SWIG to build the PJSIP ?!
You don't need SWIG to compile the PJSIP sources, it's needed only if you want to build and and run the sample application PJSUA.
Updated
The steps to build sources are
Download sources from PJSIP site. Pay attention if you will compile on Windows machine download .zip file, if on Unix machine (including OS X) then download .bz2 file.
Go to pjlib/include/pj/ from the downloaded sources. Create (or overwrite) a file called config_site.h. Copy the following code snippet
#define PJ_CONFIG_ANDROID 1
#include <pj/config_site_sample.h>
Open Cmd or Terminal
Go to pjsip root folder (the downloaded sources)
$ cd /path/to/your/pjsip/dir
Export bash var ANDROID_NDK_ROOT as a environment variable. Variable value should be the path of android ndk directory.
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Unix)
SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Windows)
Perform build for target armeabi
$ ./configure-android
If you need to perform build for
target arm64-v8a do $ TARGET_ABI=armeabi-v8a ./configure-android --use-ndk-cflags
target armeabi-v7a do $ TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
target x86 do $ TARGET_ABI=x86 ./configure-android --use-ndk-cflags
Compile sources
$ make dep && make clean && make
Is it possible to compile a c code in Fedora and to run it on Android with gcc? I tried to compile using gcc file.c -o f1 and it didn't work. Any seggustions? I was unable to execute it with ADB tool.
If your c code is run in terminal, you can simple cross compile it and push the executable file to your phone by using ADB tools.
get a cross compiler
download a cross compiler, for example:
http://www.mentor.com/embedded-software/sourcery-tools/sourcery- codebench/editions/lite-edition/
you can build android develop environment from:
http://source.android.com/source/building.html
use arm-eabi-gcc for compiling your c code , generate executable file ie. a.out
adb push a.out /sdcard, chmod 777, then you can run it from adb shell